From 7fed68d116f037847f298b7d52f537998c315298 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 19 Jan 2016 21:24:57 -0800 Subject: [PATCH] Do not clear exiting flag following explicit remove. If we begin an exit animation (setting the mExiting flag) in response to an explicit client remove request, we depend on mExiting in WindowStateAnimator::finishExit to perform the final clenaup of the window. If we are transitioning back in to the app, and it calls removeWindow before the app transition is ready, we could have handleOpeningApps clear the mExiting flag leaving this partially disposed window around due to the above mechanism. Bug: 26157153 Change-Id: I512fbbd080d423336796284fca490c2c22709180 --- .../java/com/android/server/wm/WindowSurfacePlacer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java index f77e5a6cab32e..ab6667a2f3839 100644 --- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java +++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java @@ -1197,7 +1197,12 @@ class WindowSurfacePlacer { // if app window is removed, or window relayout to invisible. We don't want to // clear it out for windows that get replaced, because the animation depends on // the flag to remove the replaced window. - if (!win.mWillReplaceWindow) { + // + // We also don't clear the mExiting flag for windows which have the + // mRemoveOnExit flag. This indicates an explicit remove request has been issued + // by the client. We should let animation proceed and not clear this flag or + // they won't eventually be removed by WindowStateAnimator#finishExit. + if (!win.mWillReplaceWindow && !win.mRemoveOnExit) { win.mExiting = false; } if (win.mWinAnimator.mAnimLayer > layer) {