From 3615be74c1a499c558e09a45dd7409e9f1027be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dcaro=20Hoff?= Date: Sun, 4 Jun 2017 12:17:51 -0300 Subject: [PATCH] [DO NOT MERGE] fingerprint: handle PerformanceStats NULL pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcc100a has added support for this feature, but the NULL checks weren't complete, only "handleAcquired" was checking if PerformanceStats was supported before calling the API. Extend the NULL checks to "handleAuthenticated" and "handleFailedAttempt" calls as well. Change-Id: I3cc9b35ea6b81dc0c503b9feab940873b344323e Signed-off-by: Ícaro Hoff --- .../biometrics/BiometricServiceBase.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java index ff8c628e785b3..7cdd3b3a42fe6 100644 --- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java +++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java @@ -284,10 +284,12 @@ public abstract class BiometricServiceBase extends SystemService @Override public int handleFailedAttempt() { final int lockoutMode = getLockoutMode(); - if (lockoutMode == AuthenticationClient.LOCKOUT_PERMANENT) { - mPerformanceStats.permanentLockout++; - } else if (lockoutMode == AuthenticationClient.LOCKOUT_TIMED) { - mPerformanceStats.lockout++; + if (mPerformanceStats != null) { + if (lockoutMode == AuthenticationClient.LOCKOUT_PERMANENT) { + mPerformanceStats.permanentLockout++; + } else if (lockoutMode == AuthenticationClient.LOCKOUT_TIMED) { + mPerformanceStats.lockout++; + } } // Failing multiple times will continue to push out the lockout time @@ -730,10 +732,12 @@ public abstract class BiometricServiceBase extends SystemService if (client != null && client.onAuthenticated(identifier, authenticated, token)) { removeClient(client); } - if (authenticated) { - mPerformanceStats.accept++; - } else { - mPerformanceStats.reject++; + if (mPerformanceStats != null) { + if (authenticated) { + mPerformanceStats.accept++; + } else { + mPerformanceStats.reject++; + } } }