Merge "Fix NPE before CentralSurfaces is registered" into tm-qpr-dev am: eaa63dbd88
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20499568 Change-Id: I9e91a55bff21bd49fba5fc6345f9b25bcd3b161e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -219,7 +219,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
|
|
||||||
protected LockPatternUtils mLockPatternUtils;
|
protected LockPatternUtils mLockPatternUtils;
|
||||||
protected ViewMediatorCallback mViewMediatorCallback;
|
protected ViewMediatorCallback mViewMediatorCallback;
|
||||||
protected CentralSurfaces mCentralSurfaces;
|
@Nullable protected CentralSurfaces mCentralSurfaces;
|
||||||
private NotificationPanelViewController mNotificationPanelViewController;
|
private NotificationPanelViewController mNotificationPanelViewController;
|
||||||
private BiometricUnlockController mBiometricUnlockController;
|
private BiometricUnlockController mBiometricUnlockController;
|
||||||
private boolean mCentralSurfacesRegistered;
|
private boolean mCentralSurfacesRegistered;
|
||||||
@@ -267,7 +267,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
private final KeyguardUpdateMonitor mKeyguardUpdateManager;
|
private final KeyguardUpdateMonitor mKeyguardUpdateManager;
|
||||||
private final LatencyTracker mLatencyTracker;
|
private final LatencyTracker mLatencyTracker;
|
||||||
private final KeyguardSecurityModel mKeyguardSecurityModel;
|
private final KeyguardSecurityModel mKeyguardSecurityModel;
|
||||||
private KeyguardBypassController mBypassController;
|
@Nullable private KeyguardBypassController mBypassController;
|
||||||
@Nullable private AlternateBouncer mAlternateBouncer;
|
@Nullable private AlternateBouncer mAlternateBouncer;
|
||||||
|
|
||||||
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
|
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
|
||||||
@@ -744,6 +744,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateAlternateBouncerShowing(boolean updateScrim) {
|
private void updateAlternateBouncerShowing(boolean updateScrim) {
|
||||||
|
if (!mCentralSurfacesRegistered) {
|
||||||
|
// if CentralSurfaces hasn't been registered yet, then the controllers below haven't
|
||||||
|
// been initialized yet so there's no need to attempt to forward them events.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean isShowingAlternateBouncer = isShowingAlternateBouncer();
|
final boolean isShowingAlternateBouncer = isShowingAlternateBouncer();
|
||||||
if (mKeyguardMessageAreaController != null) {
|
if (mKeyguardMessageAreaController != null) {
|
||||||
mKeyguardMessageAreaController.setIsVisible(isShowingAlternateBouncer);
|
mKeyguardMessageAreaController.setIsVisible(isShowingAlternateBouncer);
|
||||||
|
|||||||
@@ -587,4 +587,40 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
|||||||
mStatusBarKeyguardViewManager.hideBouncer(false);
|
mStatusBarKeyguardViewManager.hideBouncer(false);
|
||||||
verify(mPrimaryBouncerInteractor, never()).hide();
|
verify(mPrimaryBouncerInteractor, never()).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void hideAlternateBouncer_beforeCentralSurfacesRegistered() {
|
||||||
|
mStatusBarKeyguardViewManager =
|
||||||
|
new StatusBarKeyguardViewManager(
|
||||||
|
getContext(),
|
||||||
|
mViewMediatorCallback,
|
||||||
|
mLockPatternUtils,
|
||||||
|
mStatusBarStateController,
|
||||||
|
mock(ConfigurationController.class),
|
||||||
|
mKeyguardUpdateMonitor,
|
||||||
|
mDreamOverlayStateController,
|
||||||
|
mock(NavigationModeController.class),
|
||||||
|
mock(DockManager.class),
|
||||||
|
mock(NotificationShadeWindowController.class),
|
||||||
|
mKeyguardStateController,
|
||||||
|
mock(NotificationMediaManager.class),
|
||||||
|
mKeyguardBouncerFactory,
|
||||||
|
mKeyguardMessageAreaFactory,
|
||||||
|
Optional.of(mSysUiUnfoldComponent),
|
||||||
|
() -> mShadeController,
|
||||||
|
mLatencyTracker,
|
||||||
|
mKeyguardSecurityModel,
|
||||||
|
mFeatureFlags,
|
||||||
|
mPrimaryBouncerCallbackInteractor,
|
||||||
|
mPrimaryBouncerInteractor,
|
||||||
|
mBouncerView) {
|
||||||
|
@Override
|
||||||
|
public ViewRootImpl getViewRootImpl() {
|
||||||
|
return mViewRootImpl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// the following call before registering centralSurfaces should NOT throw a NPE:
|
||||||
|
mStatusBarKeyguardViewManager.hideAlternateBouncer(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user