From 8f5412527d76b5daddc4b86802c080b633b372ab Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Thu, 15 Jun 2023 08:35:53 +0000 Subject: [PATCH] Fix status bar is barely visible when the dim window is above it Previously, the system will force the status bar content to white when the dim window is shown. It's ok for the case when the dim window is below status bar window but it will make the content barely visible if the status bar background of an app is also white and the dim window is above the status bar window. We should seperate the two cases and only update the color when the dim window is below status bar window. Bug: 241274551 Test: 1. Add an account and setup fingerprint unlock 2. Go to "Settings>Passwords & accounts>add account" to add another account 3. Wait for BiometricPrompt to pop up and check the status bar. Change-Id: Ib4e2cbb34b6fecd50da58dc018bd39e309dea47b --- .../java/com/android/server/wm/DisplayPolicy.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 5bd8dd3caa7c4..664c0c43c1a7f 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1527,9 +1527,14 @@ public class DisplayPolicy { } } else if (win.isDimming()) { if (mStatusBar != null) { - if (addStatusBarAppearanceRegionsForDimmingWindow( - win.mAttrs.insetsFlags.appearance & APPEARANCE_LIGHT_STATUS_BARS, - mStatusBar.getFrame(), win.getBounds(), win.getFrame())) { + // If the dim window is below status bar window, we should update the appearance + // region if needed. Otherwise, leave it as it is. + final int statusBarLayer = mStatusBar.mToken.getWindowLayerFromType(); + final int targetWindowLayer = win.mToken.getWindowLayerFromType(); + if (targetWindowLayer < statusBarLayer + && addStatusBarAppearanceRegionsForDimmingWindow( + win.mAttrs.insetsFlags.appearance & APPEARANCE_LIGHT_STATUS_BARS, + mStatusBar.getFrame(), win.getBounds(), win.getFrame())) { addSystemBarColorApp(win); } }