From e1ac0c0468d4ff50ac423b26bd09f9f5dee078b5 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 26 Jul 2019 17:54:46 -0700 Subject: [PATCH] Add retry logic for UNABLE_TO_PROCESS Fixes: 137153901 Test: Open camera on lockscreen, turn screen off, turn screen on. Able to authenticate Change-Id: If12203fdd457bec217006024d85322ddb19a9ff3 --- .../android/keyguard/KeyguardUpdateMonitor.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 4e7b157152439..109f270063d6a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -264,11 +264,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { */ private static final int BIOMETRIC_CONTINUE_DELAY_MS = 500; - // If FP daemon dies, keyguard should retry after a short delay + // If the HAL dies or is unable to authenticate, keyguard should retry after a short delay private int mHardwareFingerprintUnavailableRetryCount = 0; private int mHardwareFaceUnavailableRetryCount = 0; - private static final int HW_UNAVAILABLE_TIMEOUT = 3000; // ms - private static final int HW_UNAVAILABLE_RETRY_MAX = 3; + private static final int HAL_ERROR_RETRY_TIMEOUT = 500; // ms + private static final int HAL_ERROR_RETRY_MAX = 10; private final Handler mHandler = new Handler(Looper.getMainLooper()) { @Override @@ -671,10 +671,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } if (msgId == FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE) { - if (mHardwareFingerprintUnavailableRetryCount < HW_UNAVAILABLE_RETRY_MAX) { + if (mHardwareFingerprintUnavailableRetryCount < HAL_ERROR_RETRY_MAX) { mHardwareFingerprintUnavailableRetryCount++; mHandler.removeCallbacks(mRetryFingerprintAuthentication); - mHandler.postDelayed(mRetryFingerprintAuthentication, HW_UNAVAILABLE_TIMEOUT); + mHandler.postDelayed(mRetryFingerprintAuthentication, HAL_ERROR_RETRY_TIMEOUT); } } @@ -830,11 +830,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { setFaceRunningState(BIOMETRIC_STATE_STOPPED); } - if (msgId == FaceManager.FACE_ERROR_HW_UNAVAILABLE) { - if (mHardwareFaceUnavailableRetryCount < HW_UNAVAILABLE_RETRY_MAX) { + if (msgId == FaceManager.FACE_ERROR_HW_UNAVAILABLE + || msgId == FaceManager.FACE_ERROR_UNABLE_TO_PROCESS) { + if (mHardwareFaceUnavailableRetryCount < HAL_ERROR_RETRY_MAX) { mHardwareFaceUnavailableRetryCount++; mHandler.removeCallbacks(mRetryFaceAuthentication); - mHandler.postDelayed(mRetryFaceAuthentication, HW_UNAVAILABLE_TIMEOUT); + mHandler.postDelayed(mRetryFaceAuthentication, HAL_ERROR_RETRY_TIMEOUT); } }