summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger <tigerhuang@google.com> 2024-02-26 16:26:45 +0800
committer Tiger <tigerhuang@google.com> 2024-02-26 17:08:26 +0800
commit90fbb6a06cf44f92bc296f054973ed9b5d7d161b (patch)
tree822a308feef671a3d864800245787bcb96eceec9
parent599156ecc15cfc09b7b6c0ab86442eda754689f7 (diff)
Don't let exiting starting window control system bars
When an activity (appA) starts another activity (appB) behind a starting window (winS), the app window (winA) of A will lose the window focus. And then mTopFullscreenOpaqueWindowState will control the system bars while there is no focused window. WinS might become the controlling window temporarily before it is removed. The controlling windows could be: winS --> winA --> winS (exiting) --> winA --> winB If the requested visibilities of system bars between winS and winA are different, system bars might look flickering. This CL is to let winA keep controlling system bars until the app window (winB) of appB becomes the focused window. The controlling windows with the new logic will be: winS --> winA --> winB Fix: 322768312 Test: Cold-start `The Spectator` on a device with a pinned taskbar and set animator duration scale to animation off. See if taskbar flashes on the starting window. Change-Id: Ic3081d97edf755a3bd2d6ec8703f6ca42bb39dab
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 5cf9acdbc0d6..7f3df958664c 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -47,6 +47,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INTERCEPT_GLO
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_UNRESTRICTED_GESTURE_EXCLUSION;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
@@ -1533,9 +1534,19 @@ public class DisplayPolicy {
// Check the windows that overlap with system bars to determine system bars' appearance.
if ((appWindow && attached == null && attrs.isFullscreen())
|| attrs.type == TYPE_VOICE_INTERACTION) {
- // Record the top-fullscreen-app-window which will be used to determine system UI
+
+ // If this is the exiting starting window, don't let it control the system bars.
+ // The app window behind it should be the controlling window instead. Reason: when an
+ // activity starts another activity behind a starting window, the app window of the
+ // first activity will lose the window focus. And then mTopFullscreenOpaqueWindowState
+ // will control the system bars. The logic here is to let first app window keep
+ // controlling system bars until the second app window is ready.
+ final boolean exitingStartingWindow =
+ attrs.type == TYPE_APPLICATION_STARTING && win.mAnimatingExit;
+
+ // Record the top-fullscreen-app-window which will be used to determine the system UI
// controlling window.
- if (mTopFullscreenOpaqueWindowState == null) {
+ if (mTopFullscreenOpaqueWindowState == null && !exitingStartingWindow) {
mTopFullscreenOpaqueWindowState = win;
}