Replace timeout errors with Face not recognized. am: 3e869b8f69
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23987985 Change-Id: I985028df566a9b5f9276f16ff3992379b6e0c2c2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1086,7 +1086,8 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,
|
||||
if (DEBUG) Log.d(TAG, "onBiometricError, lockout");
|
||||
mCurrentDialog.animateToCredentialUI(true /* isError */);
|
||||
} else if (isSoftError) {
|
||||
final String errorMessage = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED)
|
||||
final String errorMessage = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
|
||||
|| error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT)
|
||||
? getNotRecognizedString(modality)
|
||||
: getErrorString(modality, error, vendorCode);
|
||||
if (DEBUG) Log.d(TAG, "onBiometricError, soft error: " + errorMessage);
|
||||
|
||||
@@ -191,6 +191,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mFaceAuthenticatorsRegisteredCaptor;
|
||||
@Captor
|
||||
private ArgumentCaptor<BiometricStateListener> mBiometricStateCaptor;
|
||||
@Captor
|
||||
private ArgumentCaptor<Integer> mModalityCaptor;
|
||||
@Captor
|
||||
private ArgumentCaptor<String> mMessageCaptor;
|
||||
@Mock
|
||||
private Resources mResources;
|
||||
|
||||
@@ -478,17 +482,26 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
||||
0 /* vendorCode */);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(),
|
||||
assertEquals(mModalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(mMessageCaptor.getValue(),
|
||||
mContext.getString(R.string.biometric_not_recognized));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnAuthenticationFailedInvoked_whenFaceAuthRejected() throws RemoteException {
|
||||
public void testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected_withPaused() {
|
||||
testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected(
|
||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected_withTimeout() {
|
||||
testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected(
|
||||
BiometricConstants.BIOMETRIC_ERROR_TIMEOUT);
|
||||
}
|
||||
|
||||
private void testOnAuthenticationFailedInvoked_coex_whenFaceAuthRejected(int error) {
|
||||
final int modality = BiometricAuthenticator.TYPE_FACE;
|
||||
final int userId = 0;
|
||||
|
||||
@@ -496,16 +509,12 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
|
||||
showDialog(new int[] {1} /* sensorIds */, false /* credentialAllowed */);
|
||||
|
||||
mAuthController.onBiometricError(modality,
|
||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
||||
0 /* vendorCode */);
|
||||
mAuthController.onBiometricError(modality, error, 0 /* vendorCode */);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(),
|
||||
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||
mContext.getString(R.string.biometric_face_not_recognized));
|
||||
}
|
||||
|
||||
@@ -522,12 +531,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
||||
0 /* vendorCode */);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(),
|
||||
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||
mContext.getString(R.string.fingerprint_error_not_match));
|
||||
}
|
||||
|
||||
@@ -539,13 +546,11 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
final int vendorCode = 0;
|
||||
mAuthController.onBiometricError(modality, error, vendorCode);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(),
|
||||
FaceManager.getErrorString(mContext, error, vendorCode));
|
||||
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||
mContext.getString(R.string.biometric_not_recognized));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -555,12 +560,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
final String helpMessage = "help";
|
||||
mAuthController.onBiometricHelp(modality, helpMessage);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onHelp(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onHelp(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(), helpMessage);
|
||||
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||
assertThat(mMessageCaptor.getValue()).isEqualTo(helpMessage);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -571,12 +574,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
final int vendorCode = 0;
|
||||
mAuthController.onBiometricError(modality, error, vendorCode);
|
||||
|
||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mDialog1).onError(modalityCaptor.capture(), messageCaptor.capture());
|
||||
verify(mDialog1).onError(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||
|
||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
||||
assertEquals(messageCaptor.getValue(),
|
||||
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||
FaceManager.getErrorString(mContext, error, vendorCode));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user