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 79dcb87289)
This commit is contained in:
Winson Chung
2020-08-06 19:43:36 -07:00
parent 4eb63b672f
commit 11dcabfff1

View File

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