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");
|
if (DEBUG) Log.d(TAG, "onBiometricError, lockout");
|
||||||
mCurrentDialog.animateToCredentialUI(true /* isError */);
|
mCurrentDialog.animateToCredentialUI(true /* isError */);
|
||||||
} else if (isSoftError) {
|
} 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)
|
? getNotRecognizedString(modality)
|
||||||
: getErrorString(modality, error, vendorCode);
|
: getErrorString(modality, error, vendorCode);
|
||||||
if (DEBUG) Log.d(TAG, "onBiometricError, soft error: " + errorMessage);
|
if (DEBUG) Log.d(TAG, "onBiometricError, soft error: " + errorMessage);
|
||||||
|
|||||||
@@ -191,6 +191,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mFaceAuthenticatorsRegisteredCaptor;
|
private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mFaceAuthenticatorsRegisteredCaptor;
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<BiometricStateListener> mBiometricStateCaptor;
|
private ArgumentCaptor<BiometricStateListener> mBiometricStateCaptor;
|
||||||
|
@Captor
|
||||||
|
private ArgumentCaptor<Integer> mModalityCaptor;
|
||||||
|
@Captor
|
||||||
|
private ArgumentCaptor<String> mMessageCaptor;
|
||||||
@Mock
|
@Mock
|
||||||
private Resources mResources;
|
private Resources mResources;
|
||||||
|
|
||||||
@@ -478,17 +482,26 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
||||||
0 /* vendorCode */);
|
0 /* vendorCode */);
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertEquals(mModalityCaptor.getValue().intValue(), modality);
|
||||||
assertEquals(messageCaptor.getValue(),
|
assertEquals(mMessageCaptor.getValue(),
|
||||||
mContext.getString(R.string.biometric_not_recognized));
|
mContext.getString(R.string.biometric_not_recognized));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 modality = BiometricAuthenticator.TYPE_FACE;
|
||||||
final int userId = 0;
|
final int userId = 0;
|
||||||
|
|
||||||
@@ -496,16 +509,12 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
showDialog(new int[] {1} /* sensorIds */, false /* credentialAllowed */);
|
showDialog(new int[] {1} /* sensorIds */, false /* credentialAllowed */);
|
||||||
|
|
||||||
mAuthController.onBiometricError(modality,
|
mAuthController.onBiometricError(modality, error, 0 /* vendorCode */);
|
||||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
|
||||||
0 /* vendorCode */);
|
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||||
assertEquals(messageCaptor.getValue(),
|
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||||
mContext.getString(R.string.biometric_face_not_recognized));
|
mContext.getString(R.string.biometric_face_not_recognized));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,12 +531,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
BiometricConstants.BIOMETRIC_PAUSED_REJECTED,
|
||||||
0 /* vendorCode */);
|
0 /* vendorCode */);
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||||
assertEquals(messageCaptor.getValue(),
|
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||||
mContext.getString(R.string.fingerprint_error_not_match));
|
mContext.getString(R.string.fingerprint_error_not_match));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,13 +546,11 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
final int vendorCode = 0;
|
final int vendorCode = 0;
|
||||||
mAuthController.onBiometricError(modality, error, vendorCode);
|
mAuthController.onBiometricError(modality, error, vendorCode);
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onAuthenticationFailed(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onAuthenticationFailed(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||||
assertEquals(messageCaptor.getValue(),
|
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||||
FaceManager.getErrorString(mContext, error, vendorCode));
|
mContext.getString(R.string.biometric_not_recognized));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -555,12 +560,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
final String helpMessage = "help";
|
final String helpMessage = "help";
|
||||||
mAuthController.onBiometricHelp(modality, helpMessage);
|
mAuthController.onBiometricHelp(modality, helpMessage);
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onHelp(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onHelp(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||||
assertEquals(messageCaptor.getValue(), helpMessage);
|
assertThat(mMessageCaptor.getValue()).isEqualTo(helpMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -571,12 +574,10 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
final int vendorCode = 0;
|
final int vendorCode = 0;
|
||||||
mAuthController.onBiometricError(modality, error, vendorCode);
|
mAuthController.onBiometricError(modality, error, vendorCode);
|
||||||
|
|
||||||
ArgumentCaptor<Integer> modalityCaptor = ArgumentCaptor.forClass(Integer.class);
|
verify(mDialog1).onError(mModalityCaptor.capture(), mMessageCaptor.capture());
|
||||||
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
|
|
||||||
verify(mDialog1).onError(modalityCaptor.capture(), messageCaptor.capture());
|
|
||||||
|
|
||||||
assertEquals(modalityCaptor.getValue().intValue(), modality);
|
assertThat(mModalityCaptor.getValue().intValue()).isEqualTo(modality);
|
||||||
assertEquals(messageCaptor.getValue(),
|
assertThat(mMessageCaptor.getValue()).isEqualTo(
|
||||||
FaceManager.getErrorString(mContext, error, vendorCode));
|
FaceManager.getErrorString(mContext, error, vendorCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user