From ab34d09bb8ae4f34fda50e4222de74c8786daa8f Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 23 Feb 2023 16:19:28 -0600 Subject: [PATCH] Always resume view when relaunching with preserved window This relaxes the condition added in [1]. Because IWindow#dispatchAppVisibility(true) may arrive after the relaunch message, then getHostVisibility() will be GONE because mAppVisible is still false. The original concern is not a problem: call Activity#recreate() while the activity is invisible. Because a stopped activity won't use preserveWindow=true, it won't call VRI#notifyChildRebuilt. [1]: Iee780c12535217a5a9726f9f4d6b21952ce56d70 Bug: 269179932 Test: WMShellFlickerTests:CopyContentInSplit Change-Id: I7ea7d54f0c6bbf67b295ac3a2c97a62d81b0458b --- core/java/android/view/ViewRootImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index e9b3e2808a6d6..f430ec300b5bf 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1136,7 +1136,7 @@ public final class ViewRootImpl implements ViewParent, // Make sure to report the completion of draw for relaunch with preserved window. reportNextDraw("rebuilt"); // Make sure to resume this root view when relaunching its host activity which was stopped. - if (mStopped && getHostVisibility() != View.GONE) { + if (mStopped) { setWindowStopped(false); } }