From 35e049a68f4a151ed209330c2955c8e8236b6c42 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 16 Jul 2019 15:03:14 +0200 Subject: [PATCH] Do not detach children of starting windows In case we need to relaunch an activity, we detach it's children just about at the same time when we add the splash screen. However, detaching will have the side effect that all transactions will be ignored so the starting window will never become visible, leading to an ugly hole. I don't think there is any good reason to detach the children of the starting window This is a regression from the task snapshot scaling change, so it's important to fix. Test: Open app, go home, toggle battery saver, reopen app Fixes: 137284423 Change-Id: Id2f4e5e4225c1c693b1fbcb5b0d7cf4b17f9a6e7 --- .../java/com/android/server/wm/WindowStateAnimator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 2c0a733eebdec..3505afb5e7a3f 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1493,6 +1493,12 @@ class WindowStateAnimator { } void detachChildren() { + + // Do not detach children of starting windows, as their lifecycle is well under control and + // it may lead to issues in case we relaunch when we just added the starting window. + if (mWin.mAttrs.type == TYPE_APPLICATION_STARTING) { + return; + } if (mSurfaceController != null) { mSurfaceController.detachChildren(); }