Prevent null references when updating state

Certain external calls (such as GlobalActionsComponent) will make calls
to updateState which may happen without central surfaces being
registered to this component. This can be prevented by checking for
registration prior to update.

This is more of a short term patch. In the long term, the
StatusBarKeyguardViewManager is planned to be refactored/removed so
additional effort or refactoring now seems unessesary.

Bug: 249086825
Test: manual
Change-Id: Ica4043470e13a239f0792a10e807dd1a899f5f85
(cherry picked from commit cf7db5579b)
This commit is contained in:
Alex Stetson
2022-09-27 10:55:53 -07:00
committed by Alessandro Recchi
parent f71a0036c0
commit 0e59150349

View File

@@ -225,6 +225,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
protected CentralSurfaces mCentralSurfaces;
private NotificationPanelViewController mNotificationPanelViewController;
private BiometricUnlockController mBiometricUnlockController;
private boolean mCentralSurfacesRegistered;
private View mNotificationContainer;
@@ -356,6 +357,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mNotificationContainer = notificationContainer;
mKeyguardMessageAreaController = mKeyguardMessageAreaFactory.create(
centralSurfaces.getKeyguardMessageArea());
mCentralSurfacesRegistered = true;
registerListeners();
}
@@ -1175,6 +1177,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
};
protected void updateStates() {
if (!mCentralSurfacesRegistered) {
return;
}
boolean showing = mKeyguardStateController.isShowing();
boolean occluded = mKeyguardStateController.isOccluded();
boolean bouncerShowing = bouncerIsShowing();