10/n: Always send feedback if capacitive (or unknown) sensor am: 7f2031b6f5 am: e7091599e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15377751

Change-Id: I8f5d2dd56611f29692ac2faa7602ee4d35cbba64
This commit is contained in:
Kevin Chyn
2021-07-27 01:52:45 +00:00
committed by Automerger Merge Worker
2 changed files with 49 additions and 1 deletions

View File

@@ -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();

View File

@@ -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();