From cb956050d5e4f7450dc8d6b362eff02455ebe264 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 9 May 2017 16:27:24 +0200 Subject: [PATCH] Always remove orphaned starting windows, no matter what the state We orphaned a starting window because of the following sequence: - Task was moved to front, thus starting window was added. - activityPaused on Launcher was called - In the meantime, any other activity was launched. - When activityPause was completed, we didn't set the visibility of the original task *not* to true. Thus, we didn't have any signal to remove the starting window. Note that this was more easy to repro with trampoline activities, but in theory can also happen without trampoline activities. We already have a way to remove orphaned starting windows so let's reuse them independantly of the activity state. Test: Hot launch calendar, immediately press home again. Make sure not starting window is leaked. Fixes: 37888853 Change-Id: Ide72c55e66a15b44a51380208bbb29dda00f7694 --- services/core/java/com/android/server/am/ActivityRecord.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 01fbdd454b900..a5cfbcf30b3fe 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -2174,9 +2174,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } void removeOrphanedStartingWindow(boolean behindFullscreenActivity) { - if (state == INITIALIZING - && mStartingWindowState == STARTING_WINDOW_SHOWN - && behindFullscreenActivity) { + if (mStartingWindowState == STARTING_WINDOW_SHOWN && behindFullscreenActivity) { if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY, "Found orphaned starting window " + this); mStartingWindowState = STARTING_WINDOW_REMOVED; mWindowContainerController.removeStartingWindow();