From 1ab5329fd3a7af0a5e06d231c393369c2321cb31 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 6 Jan 2023 13:28:46 +0000 Subject: [PATCH] Notify draw for relaunch with preserved window In case any logic depends on ActivityRecord#startRelaunching ~ WindowState#finishDrawing can receive paired invocation. Bug: 264634241 Bug: 263066320 Test: An activity calls recreate(). There will be a log "finishDrawing of relaunch: Window". Change-Id: I9406ab5cbca5b3c9c407a136bf4fcb97111d78b8 (cherry picked from commit 5b49c7fbbf14de2f691bc9001685ae8e9c3cfdd8) --- core/java/android/view/ViewRootImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 43bbcfb1e94ae..e946e3a990509 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1113,6 +1113,8 @@ public final class ViewRootImpl implements ViewParent, // Update the last resource config in case the resource configuration was changed while // activity relaunched. updateLastConfigurationFromResources(getConfiguration()); + // Make sure to report the completion of draw for relaunch with preserved window. + reportNextDraw("rebuilt"); } private Configuration getConfiguration() {