Merge "Start fingerprint after face fails quickly" into main
This commit is contained in:
commit
34eec51385
@ -100,7 +100,6 @@ import javax.inject.Inject;
|
|||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope;
|
import kotlinx.coroutines.CoroutineScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1099,6 +1098,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,
|
|||||||
// TODO(b/141025588): Create separate methods for handling hard and soft errors.
|
// TODO(b/141025588): Create separate methods for handling hard and soft errors.
|
||||||
final boolean isSoftError = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
|
final boolean isSoftError = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
|
||||||
|| error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT
|
|| error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT
|
||||||
|
|| error == BiometricConstants.BIOMETRIC_ERROR_RE_ENROLL
|
||||||
|| isCameraPrivacyEnabled);
|
|| isCameraPrivacyEnabled);
|
||||||
if (mCurrentDialog != null) {
|
if (mCurrentDialog != null) {
|
||||||
if (mCurrentDialog.isAllowDeviceCredentials() && isLockout) {
|
if (mCurrentDialog.isAllowDeviceCredentials() && isLockout) {
|
||||||
|
@ -474,6 +474,22 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
mContext.getString(R.string.biometric_not_recognized));
|
mContext.getString(R.string.biometric_not_recognized));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnAuthenticationFailedInvoked_whenBiometricReEnrollRequired() {
|
||||||
|
showDialog(new int[] {1} /* sensorIds */, false /* credentialAllowed */);
|
||||||
|
final int modality = BiometricAuthenticator.TYPE_FACE;
|
||||||
|
mAuthController.onBiometricError(modality,
|
||||||
|
BiometricConstants.BIOMETRIC_ERROR_RE_ENROLL,
|
||||||
|
0 /* vendorCode */);
|
||||||
|
|
||||||
|
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(),
|
||||||
|
mMessageCaptor.capture());
|
||||||
|
|
||||||
|
assertThat(mModalityCaptor.getValue()).isEqualTo(modality);
|
||||||
|
assertThat(mMessageCaptor.getValue()).isEqualTo(mContext.getString(
|
||||||
|
R.string.face_recalibrate_notification_content));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected_withPaused() {
|
public void testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected_withPaused() {
|
||||||
testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected(
|
testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected(
|
||||||
|
@ -576,7 +576,7 @@ public final class AuthSession implements IBinder.DeathRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onDialogAnimatedIn(boolean startFingerprintNow) {
|
void onDialogAnimatedIn(boolean startFingerprintNow) {
|
||||||
if (mState != STATE_AUTH_STARTED) {
|
if (mState != STATE_AUTH_STARTED && mState != STATE_ERROR_PENDING_SYSUI) {
|
||||||
Slog.e(TAG, "onDialogAnimatedIn, unexpected state: " + mState);
|
Slog.e(TAG, "onDialogAnimatedIn, unexpected state: " + mState);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ import static com.android.server.biometrics.BiometricServiceStateProto.STATE_AUT
|
|||||||
import static com.android.server.biometrics.BiometricServiceStateProto.STATE_AUTH_STARTED_UI_SHOWING;
|
import static com.android.server.biometrics.BiometricServiceStateProto.STATE_AUTH_STARTED_UI_SHOWING;
|
||||||
import static com.android.server.biometrics.BiometricServiceStateProto.STATE_ERROR_PENDING_SYSUI;
|
import static com.android.server.biometrics.BiometricServiceStateProto.STATE_ERROR_PENDING_SYSUI;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static junit.framework.Assert.assertFalse;
|
import static junit.framework.Assert.assertFalse;
|
||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
@ -247,6 +249,45 @@ public class AuthSessionTest {
|
|||||||
assertEquals(STATE_ERROR_PENDING_SYSUI, session.getState());
|
assertEquals(STATE_ERROR_PENDING_SYSUI, session.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnErrorReceivedBeforeOnDialogAnimatedIn() throws RemoteException {
|
||||||
|
final int fingerprintId = 0;
|
||||||
|
final int faceId = 1;
|
||||||
|
setupFingerprint(fingerprintId, FingerprintSensorProperties.TYPE_REAR);
|
||||||
|
setupFace(faceId, true /* confirmationAlwaysRequired */,
|
||||||
|
mock(IBiometricAuthenticator.class));
|
||||||
|
final AuthSession session = createAuthSession(mSensors,
|
||||||
|
false /* checkDevicePolicyManager */,
|
||||||
|
Authenticators.BIOMETRIC_STRONG,
|
||||||
|
TEST_REQUEST_ID,
|
||||||
|
0 /* operationId */,
|
||||||
|
0 /* userId */);
|
||||||
|
session.goToInitialState();
|
||||||
|
|
||||||
|
for (BiometricSensor sensor : session.mPreAuthInfo.eligibleSensors) {
|
||||||
|
assertThat(sensor.getSensorState()).isEqualTo(BiometricSensor.STATE_WAITING_FOR_COOKIE);
|
||||||
|
session.onCookieReceived(
|
||||||
|
session.mPreAuthInfo.eligibleSensors.get(sensor.id).getCookie());
|
||||||
|
}
|
||||||
|
assertThat(session.allCookiesReceived()).isTrue();
|
||||||
|
assertThat(session.getState()).isEqualTo(STATE_AUTH_STARTED);
|
||||||
|
|
||||||
|
final BiometricSensor faceSensor = session.mPreAuthInfo.eligibleSensors.get(faceId);
|
||||||
|
final BiometricSensor fingerprintSensor = session.mPreAuthInfo.eligibleSensors.get(
|
||||||
|
fingerprintId);
|
||||||
|
final int cookie = faceSensor.getCookie();
|
||||||
|
session.onErrorReceived(0, cookie, BiometricConstants.BIOMETRIC_ERROR_RE_ENROLL, 0);
|
||||||
|
|
||||||
|
assertThat(faceSensor.getSensorState()).isEqualTo(BiometricSensor.STATE_STOPPED);
|
||||||
|
assertThat(session.getState()).isEqualTo(STATE_ERROR_PENDING_SYSUI);
|
||||||
|
|
||||||
|
session.onDialogAnimatedIn(true);
|
||||||
|
|
||||||
|
assertThat(session.getState()).isEqualTo(STATE_AUTH_STARTED_UI_SHOWING);
|
||||||
|
assertThat(fingerprintSensor.getSensorState()).isEqualTo(
|
||||||
|
BiometricSensor.STATE_AUTHENTICATING);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCancelReducesAppetiteForCookies() throws Exception {
|
public void testCancelReducesAppetiteForCookies() throws Exception {
|
||||||
setupFace(0 /* id */, false /* confirmationAlwaysRequired */,
|
setupFace(0 /* id */, false /* confirmationAlwaysRequired */,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user