From 4753bdeb1649f958fd64b57bb60303fcb02a3440 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 14 Oct 2021 16:11:48 +0900 Subject: [PATCH] Keep nav bar position updated The change is to update the nav bar position variable every time when we layout the navigation bar. This is necessary to make the nav bar color control works correctly, and also the transient bar gesture control works correctly. Test: Open light themed app in landscape and enable IME, check the bar color. Test: landscape immersive mode app swipe from the side. Bug: 202476380 Change-Id: I736af97326763b8ccb0afb2c82bbf25edf8d25c4 --- .../core/java/com/android/server/wm/DisplayPolicy.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 5a522fc5190b6..fd164f2ee7dc2 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1898,6 +1898,13 @@ public class DisplayPolicy { */ public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget) { + if (INSETS_LAYOUT_GENERALIZATION && attrs.type == TYPE_NAVIGATION_BAR) { + // Keep mNavigationBarPosition updated to make sure the transient detection and bar + // color control is working correctly. + final DisplayFrames displayFrames = mDisplayContent.mDisplayFrames; + mNavigationBarPosition = navigationBarPosition(displayFrames.mDisplayWidth, + displayFrames.mDisplayHeight, displayFrames.mRotation); + } final boolean affectsSystemUi = win.canAffectSystemUiFlags(); if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": affectsSystemUi=" + affectsSystemUi); applyKeyguardPolicy(win, imeTarget);