OSDN Git Service

Always remove starting window in performShow
authorJorim Jaggi <jjaggi@google.com>
Thu, 29 Dec 2016 10:51:42 +0000 (11:51 +0100)
committerJorim Jaggi <jjaggi@google.com>
Thu, 12 Jan 2017 15:28:08 +0000 (16:28 +0100)
When going to homescreen and then opening apps quickly again, the
surface was not yet fully destroyed so we never triggered the
codepath to remove the starting window in that case, so it was
lingering around forever.

Test: Open app, press home, reopen app immidiately again, make sure
snapshot starting window is removed.
Bug: 31339431
Change-Id: I946e681e7dc222e3dedfd3edacb8f37aee4a198b

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

index b0945ee..608f056 100644 (file)
@@ -3715,6 +3715,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
 
         logPerformShow("performShow on ");
 
+        final int drawState = mWinAnimator.mDrawState;
+        if ((drawState == HAS_DRAWN || drawState == READY_TO_SHOW)
+                && mAttrs.type != TYPE_APPLICATION_STARTING && mAppToken != null) {
+            mAppToken.onFirstWindowDrawn(this, mWinAnimator);
+        }
+
         if (mWinAnimator.mDrawState != READY_TO_SHOW || !isReadyForDisplay()) {
             return false;
         }
@@ -3749,10 +3755,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
             }
         }
 
-        if (mAttrs.type != TYPE_APPLICATION_STARTING && mAppToken != null) {
-            mAppToken.onFirstWindowDrawn(this, mWinAnimator);
-        }
-
         if (mAttrs.type == TYPE_INPUT_METHOD) {
             getDisplayContent().mDividerControllerLocked.resetImeHideRequested();
         }