summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joshua McCloskey <joshmccloskey@google.com> 2023-03-13 22:22:02 +0000
committer Joshua Mccloskey <joshmccloskey@google.com> 2023-04-11 23:14:50 +0000
commit9f26c90ffbdb62cfc930540e478ecabee2f8b070 (patch)
tree82102b900f820e4f1608b7b350ff57efe0d05cc8
parent09664e3921e1a6b33081d8250bb64fcda07713f1 (diff)
Finish FaceAuthClient onLockout
Test: atest FaceAuthenticationClientTest Bug: 250071647 Change-Id: Icb845b11e592fd548679f27fd6ca567590578eb6
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClient.java14
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClientTest.java24
3 files changed, 29 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClient.java
index 7ae31b2a114d..50d375c56f4a 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClient.java
@@ -212,6 +212,8 @@ class FaceAuthenticationClient extends AuthenticationClient<AidlSession, FaceAut
// 1) Authenticated == true
// 2) Error occurred
// 3) Authenticated == false
+ // 4) onLockout
+ // 5) onLockoutTimed
mCallback.onClientFinished(this, true /* success */);
}
@@ -304,11 +306,7 @@ class FaceAuthenticationClient extends AuthenticationClient<AidlSession, FaceAut
PerformanceTracker.getInstanceForSensorId(getSensorId())
.incrementTimedLockoutForUser(getTargetUserId());
- try {
- getListener().onError(getSensorId(), getCookie(), error, 0 /* vendorCode */);
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- }
+ onError(error, 0 /* vendorCode */);
}
@Override
@@ -323,10 +321,6 @@ class FaceAuthenticationClient extends AuthenticationClient<AidlSession, FaceAut
PerformanceTracker.getInstanceForSensorId(getSensorId())
.incrementPermanentLockoutForUser(getTargetUserId());
- try {
- getListener().onError(getSensorId(), getCookie(), error, 0 /* vendorCode */);
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- }
+ onError(error, 0 /* vendorCode */);
}
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
index 1a53fec82d98..c5037b7012f2 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
@@ -465,7 +465,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
BaseClientMonitor clientMonitor,
boolean success) {
mAuthSessionCoordinator.authEndedFor(userId, Utils.getCurrentStrength(sensorId),
- sensorId, requestId, success);
+ sensorId, requestId, client.wasAuthSuccessful());
}
});
});
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClientTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClientTest.java
index 7468901a16af..d5d06d3b4eb8 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClientTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/face/aidl/FaceAuthenticationClientTest.java
@@ -16,6 +16,8 @@
package com.android.server.biometrics.sensors.face.aidl;
+import static android.hardware.biometrics.BiometricFaceConstants.FACE_ERROR_LOCKOUT;
+import static android.hardware.biometrics.BiometricFaceConstants.FACE_ERROR_LOCKOUT_PERMANENT;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -148,6 +150,28 @@ public class FaceAuthenticationClientTest {
}
@Test
+ public void testLockoutEndsOperation() throws RemoteException {
+ final FaceAuthenticationClient client = createClient(2);
+ client.start(mCallback);
+ client.onLockoutPermanent();
+
+ verify(mClientMonitorCallbackConverter).onError(anyInt(), anyInt(),
+ eq(FACE_ERROR_LOCKOUT_PERMANENT), anyInt());
+ verify(mCallback).onClientFinished(client, false);
+ }
+
+ @Test
+ public void testTemporaryLockoutEndsOperation() throws RemoteException {
+ final FaceAuthenticationClient client = createClient(2);
+ client.start(mCallback);
+ client.onLockoutTimed(1000);
+
+ verify(mClientMonitorCallbackConverter).onError(anyInt(), anyInt(),
+ eq(FACE_ERROR_LOCKOUT), anyInt());
+ verify(mCallback).onClientFinished(client, false);
+ }
+
+ @Test
public void notifyHalWhenContextChanges() throws RemoteException {
final FaceAuthenticationClient client = createClient();
client.start(mCallback);