From 19709e9e16868f9651d62de7d3cf3091ab397953 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Mon, 12 Jun 2023 05:04:00 +0000 Subject: [PATCH] Preventing from double remove starting window after Activity destoryed All client views will be removed after activity destoryed, so and the starting window. Checking whether the view was detached from window before remove it from WindowManagerGlobal to prevent the extra remove calls. Bug: 286563704 Test: atest StartingSurfaceDrawerTests Change-Id: Iefd390825fabac2fc1e46b0a9404f9909f159cf9 --- .../wm/shell/startingsurface/SplashscreenWindowCreator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java index ae722208782e5..4cfbbd971fe38 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenWindowCreator.java @@ -20,6 +20,7 @@ import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Choreographer.CALLBACK_INSETS_ANIMATION; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; +import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; @@ -370,8 +371,11 @@ class SplashscreenWindowCreator extends AbsSplashWindowCreator { mStartingWindowRecordManager.addRecord(taskId, tView); } - private void removeWindowInner(View decorView, boolean hideView) { + private void removeWindowInner(@NonNull View decorView, boolean hideView) { requestTopUi(false); + if (!decorView.isAttachedToWindow()) { + return; + } if (hideView) { decorView.setVisibility(View.GONE); }