10/n: Always send feedback if capacitive (or unknown) sensor
Adds unit tests for capacitive accept/reject while face is scanning Bug: 193089985 Test: atest CoexCoordinatorTest Change-Id: Ia584231babf8bd201396068a9e8d783542c92db6
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user