From 159c6f48c1c608b321db0f49fda2c561744a2044 Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Fri, 24 Apr 2020 11:30:50 -0400 Subject: [PATCH] Use Lazy BioUnlockController in DozeServiceHost. Use Lazy BiometricUnlockController in DozeServiceHost instead of assigning its result to a member field after initialization. It appears as though, in some cases, the DozeServiceHost gets used before it is initialized, meaning that the BiometricUnlockController member field would be null. Fixes: 152187753 Test: atest SystemUITests Change-Id: Ic1a31ded99b1cd07e25f9da530bcf155722bbe6a --- .../systemui/statusbar/phone/DozeServiceHost.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java index abae4d8eb96ed..9bf14e43da037 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java @@ -77,7 +77,6 @@ public final class DozeServiceHost implements DozeHost { private final BatteryController mBatteryController; private final ScrimController mScrimController; private final Lazy mBiometricUnlockControllerLazy; - private BiometricUnlockController mBiometricUnlockController; private final KeyguardViewMediator mKeyguardViewMediator; private final Lazy mAssistManagerLazy; private final DozeScrimController mDozeScrimController; @@ -148,9 +147,9 @@ public final class DozeServiceHost implements DozeHost { mNotificationPanel = notificationPanel; mNotificationShadeWindowViewController = notificationShadeWindowViewController; mAmbientIndicationContainer = ambientIndicationContainer; - mBiometricUnlockController = mBiometricUnlockControllerLazy.get(); } + @Override public String toString() { return "PSB.DozeServiceHost[mCallbacks=" + mCallbacks.size() + "]"; @@ -206,11 +205,11 @@ public final class DozeServiceHost implements DozeHost { boolean dozing = mDozingRequested && mStatusBarStateController.getState() == StatusBarState.KEYGUARD - || mBiometricUnlockController.getMode() + || mBiometricUnlockControllerLazy.get().getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; // When in wake-and-unlock we may not have received a change to StatusBarState // but we still should not be dozing, manually set to false. - if (mBiometricUnlockController.getMode() + if (mBiometricUnlockControllerLazy.get().getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK) { dozing = false; } @@ -311,7 +310,7 @@ public final class DozeServiceHost implements DozeHost { @Override public boolean isPulsingBlocked() { - return mBiometricUnlockController.getMode() + return mBiometricUnlockControllerLazy.get().getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK; } @@ -323,7 +322,7 @@ public final class DozeServiceHost implements DozeHost { @Override public boolean isBlockingDoze() { - if (mBiometricUnlockController.hasPendingAuthentication()) { + if (mBiometricUnlockControllerLazy.get().hasPendingAuthentication()) { Log.i(StatusBar.TAG, "Blocking AOD because fingerprint has authenticated"); return true; }