From d4c96f965e314f38257c04f33b5a7f87d3056ffe Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 27 Jun 2019 13:37:18 -0700 Subject: [PATCH] Fix ordering of check minimized state callback - 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 --- .../com/android/server/wm/DockedStackDividerController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java index 1d76a71aaea17..b1bc219774051 100644 --- a/services/core/java/com/android/server/wm/DockedStackDividerController.java +++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java @@ -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) {