From 11dcabfff1d64270a63a14d22aa430ae7ce8bb44 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 6 Aug 2020 19:43:36 -0700 Subject: Ignore nav bar alpha changes while user is not yet setup - SUW can change the display configuration which causes the nav bar fragment to be recreated which adds a listener to OverviewProxyService which calls back this method with the last alpha (default 1). When in 2/3 button, it's not an issue because the back button is visible anyways. But since we switched to gesture nav during SUW with the artifical back button, this code was causing the home handle to be updated as well to alpha 1. Bug: 161081668 Test: Start SUW > Change font size > verify bar doesn't show Change-Id: If0271d78d319f89f25d4c51da29e6676e8218812 (cherry picked from commit 79dcb872898927a1a722b393e9f5b910216b993d) --- .../systemui/statusbar/phone/NavigationBarFragment.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index c99a1deb8000..f3c4d052c403 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -192,6 +192,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback private int mLayoutDirection; private boolean mForceNavBarHandleOpaque; + private boolean mIsCurrentUserSetup; /** @see android.view.WindowInsetsController#setSystemBarsAppearance(int) */ private @Appearance int mAppearance; @@ -311,6 +312,10 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback @Override public void onNavBarButtonAlphaChanged(float alpha, boolean animate) { + if (!mIsCurrentUserSetup) { + // If the current user is not yet setup, then don't update any button alphas + return; + } ButtonDispatcher buttonDispatcher = null; boolean forceVisible = false; if (QuickStepContract.isSwipeUpMode(mNavBarMode)) { @@ -384,6 +389,14 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } }; + private final DeviceProvisionedController.DeviceProvisionedListener mUserSetupListener = + new DeviceProvisionedController.DeviceProvisionedListener() { + @Override + public void onUserSetupChanged() { + mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup(); + } + }; + @Inject public NavigationBarFragment(AccessibilityManagerWrapper accessibilityManagerWrapper, DeviceProvisionedController deviceProvisionedController, MetricsLogger metricsLogger, @@ -451,6 +464,9 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback /* defaultValue = */ true); DeviceConfig.addOnPropertiesChangedListener( DeviceConfig.NAMESPACE_SYSTEMUI, mHandler::post, mOnPropertiesChangedListener); + + mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup(); + mDeviceProvisionedController.addCallback(mUserSetupListener); } @Override @@ -459,6 +475,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mNavigationModeController.removeListener(this); mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener); mContentResolver.unregisterContentObserver(mAssistContentObserver); + mDeviceProvisionedController.removeCallback(mUserSetupListener); DeviceConfig.removeOnPropertiesChangedListener(mOnPropertiesChangedListener); } -- cgit v1.2.3-59-g8ed1b