[DO NOT MERGE] fingerprint: handle PerformanceStats NULL pointers

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 <icarohoff@gmail.com>
This commit is contained in:
Ícaro Hoff
2017-06-04 12:17:51 -03:00
committed by Kevin Chyn
parent f29902285a
commit 3615be74c1

View File

@@ -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++;
}
}
}