From 0faf1aa91b9b59370f58d0a6a9c02d5d97a46131 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 11 Jun 2021 20:58:20 -0700 Subject: [PATCH] Remove display policy references while waiting for window animation to complete - Currently, the display policy references to singleton windows are maintained until the deferred window removal completes after a window animation. This can cause issues when recreating a window because we validate that these windows are singletons. But if we know that the window is in the process of being removed, we can reset these references early to reflect the actual state. Bug: 183947954 Test: Trigger configuration change repeatedly to recreate the nav bar and verify it doesn't crash w/ error about singleton windows Change-Id: I225cd7950e1e3e9f6689662d1596b60e94ef6530 --- services/core/java/com/android/server/wm/WindowState.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 03762b3ee8bf2..1a5b6bebd9a27 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2567,6 +2567,7 @@ class WindowState extends WindowContainer implements WindowManagerP private void setupWindowForRemoveOnExit() { mRemoveOnExit = true; setDisplayLayoutNeeded(); + getDisplayContent().getDisplayPolicy().removeWindowLw(this); // Request a focus update as this window's input channel is already gone. Otherwise // we could have no focused window in input manager. final boolean focusChanged = mWmService.updateFocusedWindowLocked(