From d197486f26c223566c75fb2df93c152b1fc3172b Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 3 May 2016 18:35:18 -0700 Subject: [PATCH] Send FINGERPRINT_ERROR_LOCKOUT on some devices For devices that don't support hardware lockout, send FINGERPRINT_ERROR_LOCKOUT after the last unsuccessful authentication attempt. Fixes bug 28346640 Change-Id: Iae3eb8e422f09100a0229c350df9983af5fd8762 --- .../server/fingerprint/AuthenticationClient.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java index 10284bb18c75e..c04b9a1bed0fb 100644 --- a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java +++ b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java @@ -74,12 +74,23 @@ public abstract class AuthenticationClient extends ClientMonitor { } else { result = true; // client not listening } - if (fingerId == 0) { + if (!authenticated) { if (receiver != null) { FingerprintUtils.vibrateFingerprintError(getContext()); } // allow system-defined limit of number of attempts before giving up - result |= handleFailedAttempt(); + boolean inLockoutMode = handleFailedAttempt(); + // send lockout event in case driver doesn't enforce it. + if (inLockoutMode) { + try { + Slog.w(TAG, "Forcing lockout (fp driver code should do this!)"); + receiver.onError(getHalDeviceId(), + FingerprintManager.FINGERPRINT_ERROR_LOCKOUT); + } catch (RemoteException e) { + Slog.w(TAG, "Failed to notify lockout:", e); + } + } + result |= inLockoutMode; } else { if (receiver != null) { FingerprintUtils.vibrateFingerprintSuccess(getContext());