Merge "Use non-cached value when calculation button forced visible state" into udc-dev
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index 006cedf..a233cdc 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
@@ -164,6 +164,8 @@
import com.android.wm.shell.back.BackAnimation;
import com.android.wm.shell.pip.Pip;
+import dagger.Lazy;
+
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Map;
@@ -173,8 +175,6 @@
import javax.inject.Inject;
-import dagger.Lazy;
-
/**
* Contains logic for a navigation bar view.
*/
@@ -251,12 +251,6 @@
private boolean mTransientShown;
private boolean mTransientShownFromGestureOnSystemBar;
- /**
- * This is to indicate whether the navigation bar button is forced visible. This is true
- * when the setup wizard is on display. When that happens, the window frame should be provided
- * as insets size directly.
- */
- private boolean mIsButtonForceVisible;
private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
private LightBarController mLightBarController;
private final LightBarController mMainLightBarController;
@@ -670,8 +664,7 @@
mView.setTouchHandler(mTouchHandler);
setNavBarMode(mNavBarMode);
mEdgeBackGestureHandler.setStateChangeCallback(mView::updateStates);
- mEdgeBackGestureHandler.setButtonForceVisibleChangeCallback((forceVisible) -> {
- mIsButtonForceVisible = forceVisible;
+ mEdgeBackGestureHandler.setButtonForcedVisibleChangeCallback((forceVisible) -> {
repositionNavigationBar(mCurrentRotation);
});
mNavigationBarTransitions.addListener(this::onBarTransition);
@@ -1710,7 +1703,7 @@
private InsetsFrameProvider[] getInsetsFrameProvider(int insetsHeight, Context userContext) {
final InsetsFrameProvider navBarProvider;
- if (insetsHeight != -1 && !mIsButtonForceVisible) {
+ if (insetsHeight != -1 && !mEdgeBackGestureHandler.isButtonForcedVisible()) {
navBarProvider = new InsetsFrameProvider(
ITYPE_NAVIGATION_BAR, Insets.of(0, 0, 0, insetsHeight));
// Use window frame for IME.
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
index f28c275..163b6fa 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
@@ -178,7 +178,7 @@
private final OverviewProxyService mOverviewProxyService;
private final SysUiState mSysUiState;
private Runnable mStateChangeCallback;
- private Consumer<Boolean> mButtonForceVisibleCallback;
+ private Consumer<Boolean> mButtonForcedVisibleCallback;
private final PluginManager mPluginManager;
private final ProtoTracer mProtoTracer;
@@ -246,7 +246,7 @@
private boolean mGestureBlockingActivityRunning;
private boolean mIsNewBackAffordanceEnabled;
private boolean mIsTrackpadGestureBackEnabled;
- private boolean mIsButtonForceVisible;
+ private boolean mIsButtonForcedVisible;
private InputMonitor mInputMonitor;
private InputChannelCompat.InputEventReceiver mInputEventReceiver;
@@ -413,8 +413,8 @@
mStateChangeCallback = callback;
}
- public void setButtonForceVisibleChangeCallback(Consumer<Boolean> callback) {
- mButtonForceVisibleCallback = callback;
+ public void setButtonForcedVisibleChangeCallback(Consumer<Boolean> callback) {
+ mButtonForcedVisibleCallback = callback;
}
public int getEdgeWidthLeft() {
@@ -429,13 +429,14 @@
Resources res = mNavigationModeController.getCurrentUserContext().getResources();
mEdgeWidthLeft = mGestureNavigationSettingsObserver.getLeftSensitivity(res);
mEdgeWidthRight = mGestureNavigationSettingsObserver.getRightSensitivity(res);
- final boolean previousForceVisible = mIsButtonForceVisible;
- mIsButtonForceVisible =
+ final boolean previousForcedVisible = mIsButtonForcedVisible;
+ mIsButtonForcedVisible =
mGestureNavigationSettingsObserver.areNavigationButtonForcedVisible();
- if (previousForceVisible != mIsButtonForceVisible && mButtonForceVisibleCallback != null) {
- mButtonForceVisibleCallback.accept(mIsButtonForceVisible);
+ if (previousForcedVisible != mIsButtonForcedVisible
+ && mButtonForcedVisibleCallback != null) {
+ mButtonForcedVisibleCallback.accept(mIsButtonForcedVisible);
}
- mIsBackGestureAllowed = !mIsButtonForceVisible;
+ mIsBackGestureAllowed = !mIsButtonForcedVisible;
final DisplayMetrics dm = res.getDisplayMetrics();
final float defaultGestureHeight = res.getDimension(
@@ -635,6 +636,10 @@
return mIsEnabled && mIsBackGestureAllowed;
}
+ public boolean isButtonForcedVisible() {
+ return mIsButtonForcedVisible;
+ }
+
/**
* Update the PiP bounds, used for exclusion calculation.
*/