summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author wilsonshih <wilsonshih@google.com> 2022-12-06 18:14:59 +0800
committer Wei Sheng Shih <wilsonshih@google.com> 2022-12-07 03:08:17 +0000
commit478bb4ddb4747bed7daf93aa8fb8193117614740 (patch)
tree48eef8ccb7abe5912b1a616147ee52c1b58d374f
parent864e20b981268e76a2419a1d6857b9ddc235dea2 (diff)
Do not let snapshot window control the bar
But allow splash screen window to control the bar. Unlike snapshot starting window, all system bar corresponding attributes are read from app theme, so ideally the initial value should equals to the first activity main window. Even if the activity set another theme, it should only produce an one-time transition. (Ref: I3d7ba6b7d78c0508ddeccbf1d3408d723bd8e2c0) Bug: 261247891 Test: atest WindowStateTests Change-Id: I957e1eddcfa3f7b873f7a9b32eeaf69db5927b00
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java9
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java5
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java10
3 files changed, 16 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 9ac1762c995e..1e2598a03f2b 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -2135,15 +2135,10 @@ public class DisplayPolicy {
}
void updateSystemBarAttributes() {
- WindowState winCandidate = mFocusedWindow;
- if (winCandidate == null && mTopFullscreenOpaqueWindowState != null
- && (mTopFullscreenOpaqueWindowState.mAttrs.flags
- & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0) {
- // Only focusable window can take system bar control.
- winCandidate = mTopFullscreenOpaqueWindowState;
- }
// If there is no window focused, there will be nobody to handle the events
// anyway, so just hang on in whatever state we're in until things settle down.
+ WindowState winCandidate = mFocusedWindow != null ? mFocusedWindow
+ : mTopFullscreenOpaqueWindowState;
if (winCandidate == null) {
return;
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 73759d3a3362..2dc0dc465861 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2090,7 +2090,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
} else {
final Task task = getTask();
final boolean canFromTask = task != null && task.canAffectSystemUiFlags();
- return canFromTask && mActivityRecord.isVisible();
+ return canFromTask && mActivityRecord.isVisible()
+ // Do not let snapshot window control the bar
+ && (mAttrs.type != TYPE_APPLICATION_STARTING
+ || !(mStartingData instanceof SnapshotStartingData));
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
index 1b79dd35082e..7b73c7b10aa7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -413,6 +413,16 @@ public class WindowStateTests extends WindowTestsBase {
}
@Test
+ public void testCanAffectSystemUiFlags_starting() {
+ final WindowState app = createWindow(null, TYPE_APPLICATION_STARTING, "app");
+ app.mActivityRecord.setVisible(true);
+ app.mStartingData = new SnapshotStartingData(mWm, null, 0);
+ assertFalse(app.canAffectSystemUiFlags());
+ app.mStartingData = new SplashScreenStartingData(mWm, 0, 0);
+ assertTrue(app.canAffectSystemUiFlags());
+ }
+
+ @Test
public void testCanAffectSystemUiFlags_disallow() {
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
app.mActivityRecord.setVisible(true);