From 4c4001c4773012268dd026aea5d34fe5479e5fa2 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 25 Aug 2017 14:23:36 -0700 Subject: [PATCH] Fix fingerprint error messages on Keyguard / AOD 1) "Too many attempts" message should be shown when AOD -> Keyguard 2) onFingerprintError() errors should not be cleared by previous onFingerprintHelp() messages (MSG_CLEAR_FP_MSG), otherwise the error won't be displayed for the full 5000ms 3) "Too many attempts" message should be shown when user is locked out on AOD 4) FINGERPRINT_ERROR_LOCKOUT_PERMANENT error should show whenever AOD or keyguard is entered (same as regular lockout message behavior) Fixes: 65055500 Test: Manual test of above situations Change-Id: I8793f61ea80a3aa920838790ae2af68fc29c1981 --- .../KeyguardIndicationController.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 74737c4c29481..569e58d78fae0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -184,8 +184,15 @@ public class KeyguardIndicationController { mVisible = visible; mIndicationArea.setVisibility(visible ? View.VISIBLE : View.GONE); if (visible) { - hideTransientIndication(); + // If this is called after an error message was already shown, we should not clear it. + // Otherwise the error message won't be shown + if (!mHandler.hasMessages(MSG_HIDE_TRANSIENT)) { + hideTransientIndication(); + } updateIndication(); + } else if (!visible) { + // If we unlock and return to keyguard quickly, previous error should not be shown + hideTransientIndication(); } } @@ -389,7 +396,6 @@ public class KeyguardIndicationController { hideTransientIndication(); } else if (msg.what == MSG_CLEAR_FP_MSG) { mLockIcon.setTransientFpError(false); - hideTransientIndication(); } } }; @@ -443,10 +449,10 @@ public class KeyguardIndicationController { int errorColor = Utils.getColorError(mContext); if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(helpString, errorColor); - } else if (updateMonitor.isDeviceInteractive() - || mDozing && updateMonitor.isScreenOn()) { + } else if (updateMonitor.isScreenOn()) { mLockIcon.setTransientFpError(true); showTransientIndication(helpString, errorColor); + hideTransientIndicationDelayed(TRANSIENT_FP_ERROR_TIMEOUT); mHandler.removeMessages(MSG_CLEAR_FP_MSG); mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_FP_MSG), TRANSIENT_FP_ERROR_TIMEOUT); @@ -459,7 +465,8 @@ public class KeyguardIndicationController { @Override public void onFingerprintError(int msgId, String errString) { KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); - if (!updateMonitor.isUnlockingWithFingerprintAllowed() + if ((!updateMonitor.isUnlockingWithFingerprintAllowed() + && msgId != FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) || msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { return; } @@ -472,7 +479,7 @@ public class KeyguardIndicationController { if (mLastSuccessiveErrorMessage != msgId) { mStatusBarKeyguardViewManager.showBouncerMessage(errString, errorColor); } - } else if (updateMonitor.isDeviceInteractive()) { + } else if (updateMonitor.isScreenOn()) { showTransientIndication(errString, errorColor); // We want to keep this message around in case the screen was off hideTransientIndicationDelayed(HIDE_DELAY_MS);