Update BP "Not recognized" message with UX/UI spec
Change the string on the biometric prompt when fingerprint/face failed
according to biometric enrollment status
Fixes: 286993443
Fixes: 286967857
Test: Manual (see bug)
Test: atest AuthControllerTest atest BiometricsServiceTest
Change-Id: Ieaecf678d9498b065972340900ddb5afba97ac1e
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index b516e59d..04fef58 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1787,6 +1787,8 @@
<string name="biometric_error_hw_unavailable">Biometric hardware unavailable</string>
<!-- Message shown when biometric authentication was canceled by the user [CHAR LIMIT=50] -->
<string name="biometric_error_user_canceled">Authentication canceled</string>
+ <!-- Message shown by the biometric dialog when biometric is not recognized -->
+ <string name="biometric_not_recognized">Not recognized</string>
<!-- Message shown by the biometric dialog when face is not recognized [CHAR LIMIT=50] -->
<string name="biometric_face_not_recognized">Face not recognized</string>
<!-- Message shown when biometric authentication has been canceled [CHAR LIMIT=50] -->
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index 73a4803..eab82a1 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -1057,8 +1057,16 @@
}
private String getNotRecognizedString(@Modality int modality) {
- return mContext.getString(modality == TYPE_FACE
- ? R.string.biometric_face_not_recognized : R.string.fingerprint_error_not_match);
+ final int messageRes;
+ final int userId = mCurrentDialogArgs.argi1;
+ if (isFaceAuthEnrolled(userId) && isFingerprintEnrolled(userId)) {
+ messageRes = modality == TYPE_FACE
+ ? R.string.biometric_face_not_recognized
+ : R.string.fingerprint_error_not_match;
+ } else {
+ messageRes = R.string.biometric_not_recognized;
+ }
+ return mContext.getString(messageRes);
}
private String getErrorString(@Modality int modality, int error, int vendorCode) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
index 9d47839..b4a4a11 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
@@ -488,7 +488,7 @@
assertEquals(modalityCaptor.getValue().intValue(), modality);
assertEquals(messageCaptor.getValue(),
- mContext.getString(R.string.fingerprint_error_not_match));
+ mContext.getString(R.string.biometric_not_recognized));
}
@Test
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
index 3ae1fcf..d601ecb 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
@@ -181,6 +181,10 @@
when(mResources.getString(R.string.biometric_error_hw_unavailable))
.thenReturn(ERROR_HW_UNAVAILABLE);
+ when(mResources.getString(R.string.biometric_not_recognized))
+ .thenReturn(ERROR_NOT_RECOGNIZED);
+ when(mResources.getString(R.string.biometric_face_not_recognized))
+ .thenReturn(ERROR_NOT_RECOGNIZED);
when(mResources.getString(R.string.fingerprint_error_not_match))
.thenReturn(ERROR_NOT_RECOGNIZED);
when(mResources.getString(R.string.biometric_error_user_canceled))