diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index be3b924aaeb7e..deae923a334e4 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -1331,9 +1331,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (prevDc == null || prevDc == mDisplayContent) { return; } - - prevDc.mOpeningApps.remove(this); - if (prevDc.mChangingApps.remove(this)) { + if (prevDc.mChangingApps.contains(this)) { // This gets called *after* the AppWindowToken has been reparented to the new display. // That reparenting resulted in this window changing modes (eg. FREEFORM -> FULLSCREEN), // so this token is now "frozen" while waiting for the animation to start on prevDc @@ -1342,8 +1340,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // so we need to cancel the change transition here. clearChangeLeash(getPendingTransaction(), true /* cancel */); } - prevDc.mClosingApps.remove(this); - if (prevDc.mFocusedApp == this) { prevDc.setFocusedApp(null); final TaskStack stack = dc.getTopStack(); @@ -3229,6 +3225,16 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree true /* topToBottom */); } + void removeFromPendingTransition() { + if (isWaitingForTransitionStart() && mDisplayContent != null) { + mDisplayContent.mOpeningApps.remove(this); + if (mDisplayContent.mChangingApps.remove(this)) { + clearChangeLeash(getPendingTransaction(), true /* cancel */); + } + mDisplayContent.mClosingApps.remove(this); + } + } + private void updateColorTransform() { if (mSurfaceControl != null && mLastAppSaturationInfo != null) { getPendingTransaction().setColorTransform(mSurfaceControl, diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 80848a8f24f06..c3a769b63e5a0 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -2377,6 +2377,9 @@ class DisplayContent extends WindowContainer