diff options
| author | 2022-11-03 12:33:43 +0000 | |
|---|---|---|
| committer | 2022-11-03 14:53:33 +0000 | |
| commit | cf5cc604c24e0e78e7624a7f11f83c36df2ac59b (patch) | |
| tree | ee06f7b696961563b72384ba6a3d1bdf03fe9f10 | |
| parent | dd84f60d961a3e546acaeeee2a85d2c3186edb99 (diff) | |
Move face auth timeout error handling into a separate method.
Bug: 247688462
Test: atest KeyguardIndicationController
Change-Id: I213895addb4f800141c8db267d8faf0171c9c67e
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 50528bdac992..5d8232e24fe8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -51,7 +51,6 @@ import android.content.pm.UserInfo; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Color; -import android.hardware.biometrics.BiometricFaceConstants; import android.hardware.biometrics.BiometricSourceType; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; @@ -1064,9 +1063,7 @@ public class KeyguardIndicationController { && msgId != BIOMETRIC_HELP_FACE_NOT_RECOGNIZED; final boolean faceAuthFailed = biometricSourceType == FACE && msgId == BIOMETRIC_HELP_FACE_NOT_RECOGNIZED; // ran through matcher & failed - final boolean isUnlockWithFingerprintPossible = - mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( - getCurrentUser()); + final boolean isUnlockWithFingerprintPossible = canUnlockWithFingerprint(); final boolean isCoExFaceAcquisitionMessage = faceAuthSoftError && isUnlockWithFingerprintPossible; if (isCoExFaceAcquisitionMessage && !mCoExFaceAcquisitionMsgIdsToShow.contains(msgId)) { @@ -1119,44 +1116,14 @@ public class KeyguardIndicationController { } private void onFaceAuthError(int msgId, String errString) { - CharSequence deferredFaceMessage = null; - if (msgId == BiometricFaceConstants.FACE_ERROR_TIMEOUT) { - deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage(); - debugLog("showDeferredFaceMessage msgId=" + deferredFaceMessage); - } + CharSequence deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage(); mFaceAcquiredMessageDeferral.reset(); if (shouldSuppressFaceError(msgId, mKeyguardUpdateMonitor)) { debugLog("suppressingFaceError msgId=" + msgId + " errString= " + errString); - } else if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { - // Co-ex: show deferred message OR nothing - if (mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( - KeyguardUpdateMonitor.getCurrentUser())) { - // if we're on the lock screen (bouncer isn't showing), show the deferred msg - if (deferredFaceMessage != null - && !mStatusBarKeyguardViewManager.isBouncerShowing()) { - showBiometricMessage( - deferredFaceMessage, - mContext.getString(R.string.keyguard_suggest_fingerprint) - ); - return; - } - - // otherwise, don't show any message - debugLog("skip showing FACE_ERROR_TIMEOUT due to co-ex logic"); - return; - } - - // Face-only: The face timeout message is not very actionable, let's ask the user to - // manually retry. - if (deferredFaceMessage != null) { - showBiometricMessage( - deferredFaceMessage, - mContext.getString(R.string.keyguard_unlock) - ); - } else { - // suggest swiping up to unlock (try face auth again or swipe up to bouncer) - showActionToUnlock(); - } + return; + } + if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { + handleFaceAuthTimeoutError(deferredFaceMessage); } else { handleGenericBiometricError(errString); } @@ -1267,6 +1234,40 @@ public class KeyguardIndicationController { } } + private void handleFaceAuthTimeoutError(@Nullable CharSequence deferredFaceMessage) { + debugLog("showDeferredFaceMessage msgId=" + deferredFaceMessage); + if (canUnlockWithFingerprint()) { + // Co-ex: show deferred message OR nothing + // if we're on the lock screen (bouncer isn't showing), show the deferred msg + if (deferredFaceMessage != null + && !mStatusBarKeyguardViewManager.isBouncerShowing()) { + showBiometricMessage( + deferredFaceMessage, + mContext.getString(R.string.keyguard_suggest_fingerprint) + ); + } else { + // otherwise, don't show any message + debugLog("skip showing FACE_ERROR_TIMEOUT due to co-ex logic"); + } + } else if (deferredFaceMessage != null) { + // Face-only: The face timeout message is not very actionable, let's ask the + // user to manually retry. + showBiometricMessage( + deferredFaceMessage, + mContext.getString(R.string.keyguard_unlock) + ); + } else { + // Face-only + // suggest swiping up to unlock (try face auth again or swipe up to bouncer) + showActionToUnlock(); + } + } + + private boolean canUnlockWithFingerprint() { + return mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( + KeyguardUpdateMonitor.getCurrentUser()); + } + private void debugLog(String logMsg) { if (DEBUG) { Log.d(TAG, logMsg); |