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
This commit is contained in:
Yunfan Chen
2021-10-14 16:11:48 +09:00
parent dde83e104c
commit 4753bdeb16

View File

@@ -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);