diff --git a/services/core/java/com/android/server/biometrics/sensors/CoexCoordinator.java b/services/core/java/com/android/server/biometrics/sensors/CoexCoordinator.java index f732a147e4b71..b576673111aee 100644 --- a/services/core/java/com/android/server/biometrics/sensors/CoexCoordinator.java +++ b/services/core/java/com/android/server/biometrics/sensors/CoexCoordinator.java @@ -26,7 +26,6 @@ import android.os.Handler; import android.os.Looper; import android.util.Slog; -import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.server.biometrics.sensors.BiometricScheduler.SensorType; import com.android.server.biometrics.sensors.fingerprint.Udfps; @@ -239,6 +238,11 @@ public class CoexCoordinator { removeAndFinishAllFaceFromQueue(); + callback.sendHapticFeedback(); + callback.sendAuthenticationResult(true /* addAuthTokenIfStrong */); + callback.handleLifecycleAfterAuth(); + } else { + // Capacitive fingerprint sensor (or other) callback.sendHapticFeedback(); callback.sendAuthenticationResult(true /* addAuthTokenIfStrong */); callback.handleLifecycleAfterAuth(); diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/CoexCoordinatorTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/CoexCoordinatorTest.java index a169ebd0320f7..f1adcae257a77 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/CoexCoordinatorTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/CoexCoordinatorTest.java @@ -17,6 +17,7 @@ package com.android.server.biometrics.sensors; import static com.android.server.biometrics.sensors.BiometricScheduler.SENSOR_TYPE_FACE; +import static com.android.server.biometrics.sensors.BiometricScheduler.SENSOR_TYPE_FP_OTHER; import static com.android.server.biometrics.sensors.BiometricScheduler.SENSOR_TYPE_UDFPS; import static junit.framework.Assert.assertEquals; @@ -326,6 +327,49 @@ public class CoexCoordinatorTest { verify(mCallback, never()).sendHapticFeedback(); } + @Test + public void testKeyguard_capacitiveAccepted_whenFaceScanning() { + mCoexCoordinator.reset(); + + AuthenticationClient faceClient = mock(AuthenticationClient.class); + when(faceClient.isKeyguard()).thenReturn(true); + when(faceClient.getState()).thenReturn(AuthenticationClient.STATE_STARTED); + + AuthenticationClient fpClient = mock(AuthenticationClient.class); + when(fpClient.getState()).thenReturn(AuthenticationClient.STATE_STARTED); + when(fpClient.isKeyguard()).thenReturn(true); + + mCoexCoordinator.addAuthenticationClient(SENSOR_TYPE_FACE, faceClient); + mCoexCoordinator.addAuthenticationClient(SENSOR_TYPE_FP_OTHER, fpClient); + + mCoexCoordinator.onAuthenticationSucceeded(0 /* currentTimeMillis */, fpClient, mCallback); + verify(mCallback).sendHapticFeedback(); + verify(mCallback).sendAuthenticationResult(eq(true) /* addAuthTokenIfStrong */); + verify(mCallback).handleLifecycleAfterAuth(); + } + + @Test + public void testKeyguard_capacitiveRejected_whenFaceScanning() { + mCoexCoordinator.reset(); + + AuthenticationClient faceClient = mock(AuthenticationClient.class); + when(faceClient.isKeyguard()).thenReturn(true); + when(faceClient.getState()).thenReturn(AuthenticationClient.STATE_STARTED); + + AuthenticationClient fpClient = mock(AuthenticationClient.class); + when(fpClient.getState()).thenReturn(AuthenticationClient.STATE_STARTED); + when(fpClient.isKeyguard()).thenReturn(true); + + mCoexCoordinator.addAuthenticationClient(SENSOR_TYPE_FACE, faceClient); + mCoexCoordinator.addAuthenticationClient(SENSOR_TYPE_FP_OTHER, fpClient); + + mCoexCoordinator.onAuthenticationRejected(0 /* currentTimeMillis */, fpClient, + LockoutTracker.LOCKOUT_NONE, mCallback); + verify(mCallback).sendHapticFeedback(); + verify(mCallback).sendAuthenticationResult(eq(false) /* addAuthTokenIfStrong */); + verify(mCallback).handleLifecycleAfterAuth(); + } + @Test public void testNonKeyguard_rejectAndNotLockedOut() { mCoexCoordinator.reset();