From 6d8e06bad4a8cda1893a67ee1014c39c93dca557 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 5 Jan 2016 10:43:25 -0800 Subject: [PATCH] Don't set replacing flag in starting windows. When ever an app is changing stacks we set replacing flag on all it's windows. Starting windows can be part of an apps window list, but is added by window manager not the app. So, when we set replacing flag on the starting window it can cause the starting window never to be cleaned up since we are expecting the client to replace it which will never happen since it was added by window manager. We shouldn't be setting replacing flag on starting windows since they can never be replaced. Bug: 26294740 Change-Id: I0a4f1e44188e96e73614130cbea02a3860850f58 --- .../java/com/android/server/wm/WindowState.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 4c38f92d6c9a8..6e4e01f38212f 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2352,10 +2352,15 @@ final class WindowState implements WindowManagerPolicy.WindowState { } void setReplacing(boolean animate) { - if ((mAttrs.privateFlags & PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH) == 0) { - mWillReplaceWindow = true; - mReplacingWindow = null; - mAnimateReplacingWindow = animate; + if ((mAttrs.privateFlags & PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH) != 0 + || mAttrs.type == TYPE_APPLICATION_STARTING) { + // We don't set replacing on starting windows since they are added by window manager and + // not the client so won't be replaced by the client. + return; } + + mWillReplaceWindow = true; + mReplacingWindow = null; + mAnimateReplacingWindow = animate; } }