Announce Tuscany help/errors even when text suppressed
When a11y features are enabled, give users extra feedback on how to use face auth. Test: KeyguardIndicationControllerTest Fixes: 195614836 Change-Id: Ie30f690a6da83ec6bd4b37721f8d46d44d8742dd
This commit is contained in:
@@ -821,7 +821,7 @@ public class KeyguardIndicationController {
|
||||
}
|
||||
}
|
||||
|
||||
private void showTryFingerprintMsg() {
|
||||
private void showTryFingerprintMsg(String a11yString) {
|
||||
if (mKeyguardUpdateMonitor.isUdfpsAvailable()) {
|
||||
// if udfps available, there will always be a tappable affordance to unlock
|
||||
// For example, the lock icon
|
||||
@@ -833,6 +833,11 @@ public class KeyguardIndicationController {
|
||||
} else {
|
||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
||||
}
|
||||
|
||||
// Although we suppress face auth errors visually, we still announce them for a11y
|
||||
if (!TextUtils.isEmpty(a11yString)) {
|
||||
mLockScreenIndicationView.announceForAccessibility(a11yString);
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
@@ -913,7 +918,7 @@ public class KeyguardIndicationController {
|
||||
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
|
||||
if (biometricSourceType == BiometricSourceType.FACE
|
||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()) {
|
||||
showTryFingerprintMsg();
|
||||
showTryFingerprintMsg(helpString);
|
||||
return;
|
||||
}
|
||||
showTransientIndication(helpString, false /* isError */, showActionToUnlock);
|
||||
@@ -933,7 +938,7 @@ public class KeyguardIndicationController {
|
||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()
|
||||
&& !mStatusBarKeyguardViewManager.isBouncerShowing()
|
||||
&& mKeyguardUpdateMonitor.isScreenOn()) {
|
||||
showTryFingerprintMsg();
|
||||
showTryFingerprintMsg(errString);
|
||||
return;
|
||||
}
|
||||
if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
||||
@@ -942,7 +947,7 @@ public class KeyguardIndicationController {
|
||||
if (!mStatusBarKeyguardViewManager.isBouncerShowing()
|
||||
&& mKeyguardUpdateMonitor.isUdfpsEnrolled()
|
||||
&& mKeyguardUpdateMonitor.isFingerprintDetectionRunning()) {
|
||||
showTryFingerprintMsg();
|
||||
showTryFingerprintMsg(errString);
|
||||
} else if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
||||
mStatusBarKeyguardViewManager.showBouncerMessage(
|
||||
mContext.getResources().getString(R.string.keyguard_unlock_press),
|
||||
|
||||
@@ -111,6 +111,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
private static final ComponentName DEVICE_OWNER_COMPONENT = new ComponentName("com.android.foo",
|
||||
"bar");
|
||||
|
||||
private String mKeyguardTryFingerprintMsg;
|
||||
private String mDisclosureWithOrganization;
|
||||
private String mDisclosureGeneric;
|
||||
private String mFinancedDisclosureWithOrganization;
|
||||
@@ -182,6 +183,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
mContext.addMockSystemService(UserManager.class, mUserManager);
|
||||
mContext.addMockSystemService(Context.TRUST_SERVICE, mock(TrustManager.class));
|
||||
mContext.addMockSystemService(Context.FINGERPRINT_SERVICE, mock(FingerprintManager.class));
|
||||
mKeyguardTryFingerprintMsg = mContext.getString(R.string.keyguard_try_fingerprint);
|
||||
mDisclosureWithOrganization = mContext.getString(R.string.do_disclosure_with_name,
|
||||
ORGANIZATION_NAME);
|
||||
mDisclosureGeneric = mContext.getString(R.string.do_disclosure_generic);
|
||||
@@ -677,6 +679,34 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
verifyTransientMessage(message);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void faceAuthMessageSuppressed() {
|
||||
createController();
|
||||
String faceHelpMsg = "Face auth help message";
|
||||
|
||||
// GIVEN state of showing message when keyguard screen is on
|
||||
when(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
|
||||
when(mKeyguardUpdateMonitor.isScreenOn()).thenReturn(true);
|
||||
|
||||
// GIVEN fingerprint is also running (not udfps)
|
||||
when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true);
|
||||
when(mKeyguardUpdateMonitor.isUdfpsAvailable()).thenReturn(false);
|
||||
|
||||
mController.setVisible(true);
|
||||
|
||||
// WHEN a face help message comes in
|
||||
mController.getKeyguardCallback().onBiometricHelp(
|
||||
KeyguardUpdateMonitor.BIOMETRIC_HELP_FACE_NOT_RECOGNIZED, faceHelpMsg,
|
||||
BiometricSourceType.FACE);
|
||||
|
||||
// THEN "try fingerprint" message appears (and not the face help message)
|
||||
verifyTransientMessage(mKeyguardTryFingerprintMsg);
|
||||
|
||||
// THEN the face help message is still announced for a11y
|
||||
verify(mIndicationAreaBottom).announceForAccessibility(eq(faceHelpMsg));
|
||||
}
|
||||
|
||||
private void sendUpdateDisclosureBroadcast() {
|
||||
mBroadcastReceiver.onReceive(mContext, new Intent());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user