OSDN Git Service

Fix ordering of check minimized state callback
authorWinson Chung <winsonc@google.com>
Thu, 27 Jun 2019 20:37:18 +0000 (13:37 -0700)
committerWinson Chung <winsonc@google.com>
Tue, 9 Jul 2019 17:25:18 +0000 (17:25 +0000)
- We previously notified the docked stack minimized changed asynchronously
  (ag/6130053) but now this is a direct call, which causes the notify to
  trigger a cancel of the recents animation, which triggers another
  notifyDockedStackMinimizedChanged() call with the new state, which leads
  to an inversion of delivered states to sysui.  Instead, always notify
  the remote listeners prior to synchronously updating the internal state.

Bug: 133243292
Test: Show the IME in split screen and try to swipe up (this should just
      dismiss the IME and not leave the user in a broken split screen
      minimized state)

Change-Id: I181e039d5823b635e36657a795d05c9e30366364

services/core/java/com/android/server/wm/DockedStackDividerController.java

index 1d76a71..b1bc219 100644 (file)
@@ -569,7 +569,6 @@ public class DockedStackDividerController {
             mMaximizeMeetFraction = getClipRevealMeetFraction(stack);
             animDuration = (long) (mAnimationDuration * mMaximizeMeetFraction);
         }
-        mService.mAtmInternal.notifyDockedStackMinimizedChanged(minimizedDock);
         final int size = mDockedStackListeners.beginBroadcast();
         for (int i = 0; i < size; ++i) {
             final IDockedStackListener listener = mDockedStackListeners.getBroadcastItem(i);
@@ -581,6 +580,9 @@ public class DockedStackDividerController {
             }
         }
         mDockedStackListeners.finishBroadcast();
+        // Only notify ATM after we update the remote listeners, otherwise it may trigger another
+        // minimize change, which would lead to an inversion of states send to the listeners
+        mService.mAtmInternal.notifyDockedStackMinimizedChanged(minimizedDock);
     }
 
     void notifyDockSideChanged(int newDockSide) {