From 3554059f9c24275e4e80c22f86b3cbd0a4b70ca8 Mon Sep 17 00:00:00 2001 From: Tiger Date: Wed, 13 Sep 2023 19:05:24 +0800 Subject: Only draw legacy nav bar background when it is visible We checked the nav bar visibility before the commit: ff4891638d2c3b2e12ee841ae8e42f26aa497f04 . But it was based on mNavigationColorViewState.visible which would be always false if FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS is not applied. So the commit removed the visible check, and caused the black bar issue on dream windows. This CL adds the visibility check back, uses the requested visibility instead, which is independent from FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS. Fix: 273495037 Test: Enable screen saver, and press power putton to show it while in split-screen mode. Make sure there is no black bar at the bottom. Test: Show IME in combinations of a. floating mode or non-floating mode b. gesture navigation or 3-button navigation c. taskbar or navigation bar d. light theme or dark theme And see if there is anything unexpected Change-Id: I9b44aa801da7d5be2938406b47b639616f373e43 --- core/java/com/android/internal/policy/DecorView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 86ca077d77d9..a93e984294f7 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -1160,7 +1160,9 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mForceWindowDrawsBarBackgrounds, requestedVisibleTypes); boolean oldDrawLegacy = mDrawLegacyNavigationBarBackground; mDrawLegacyNavigationBarBackground = - (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0; + ((requestedVisibleTypes | mLastForceConsumingTypes) + & WindowInsets.Type.navigationBars()) != 0 + && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0; if (oldDrawLegacy != mDrawLegacyNavigationBarBackground) { mDrawLegacyNavigationBarBackgroundHandled = mWindow.onDrawLegacyNavigationBarBackgroundChanged( -- cgit v1.2.3-59-g8ed1b