From 2c7141ed4c474d9257a7bcbbeefceb0581314d30 Mon Sep 17 00:00:00 2001 From: Tiger Date: Wed, 22 Feb 2023 17:55:28 +0800 Subject: [PATCH] Fix DisplayPolicy#isOverlappingWithNavBar The function name didn't match its logic. It only worked when win.mActivityRecord is not null. This CL fixes the logic and make the dimming window and the window with TYPE_VOICE_INTERACTION be able to be mNavBarColorWindowCandidate. Fix: 270298341 Bug: 268052229 Test: atest DisplayPolicyTests Merged-In: If216cf2f73615d82129e51fbacc326fd02cbb8f8 Change-Id: If216cf2f73615d82129e51fbacc326fd02cbb8f8 (cherry picked from commit c2e683bb667ad359629c687fc24405ec026a86fe) --- .../java/com/android/server/wm/DisplayPolicy.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 8e9a214906458..41130812d6581 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1577,9 +1577,8 @@ public class DisplayPolicy { applyKeyguardPolicy(win, imeTarget); // Check if the freeform window overlaps with the navigation bar area. - final boolean isOverlappingWithNavBar = isOverlappingWithNavBar(win); - if (isOverlappingWithNavBar && !mIsFreeformWindowOverlappingWithNavBar - && win.inFreeformWindowingMode()) { + if (!mIsFreeformWindowOverlappingWithNavBar && win.inFreeformWindowingMode() + && win.mActivityRecord != null && isOverlappingWithNavBar(win)) { mIsFreeformWindowOverlappingWithNavBar = true; } @@ -1637,7 +1636,7 @@ public class DisplayPolicy { // mode; if it's in gesture navigation mode, the navigation bar will be // NAV_BAR_FORCE_TRANSPARENT and its appearance won't be decided by overlapping // windows. - if (isOverlappingWithNavBar) { + if (isOverlappingWithNavBar(win)) { if (mNavBarColorWindowCandidate == null) { mNavBarColorWindowCandidate = win; addSystemBarColorApp(win); @@ -1665,7 +1664,7 @@ public class DisplayPolicy { addSystemBarColorApp(win); } } - if (isOverlappingWithNavBar && mNavBarColorWindowCandidate == null) { + if (isOverlappingWithNavBar(win) && mNavBarColorWindowCandidate == null) { mNavBarColorWindowCandidate = win; } } @@ -2858,7 +2857,7 @@ public class DisplayPolicy { @VisibleForTesting static boolean isOverlappingWithNavBar(@NonNull WindowState win) { - if (win.mActivityRecord == null || !win.isVisible()) { + if (!win.isVisible()) { return false; }