Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfe6dcf3 authored by Bingyu Zhang's avatar Bingyu Zhang
Browse files

Accessibility change when Trusted Face icon shows.

When unlocking device, if Trusted Face is on, "Scanning face" should be
automatically announced.
Also change the contentDescription for face icon, then when clicking the face icon,
instead of "unlock button", "Scanning face" will be talked back.

Test: manual
Bug:74328543
Change-Id: I94f9faa45bf5f6f7ceaf7df5acab0a970f651395
parent db7bb0bc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -240,6 +240,8 @@
    <string name="accessibility_waiting_for_fingerprint">Waiting for fingerprint</string>
    <!-- Accessibility action of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_unlock_without_fingerprint">Unlock without using your fingerprint</string>
    <!-- Content description of the Trusted Face icon for accessibility. [CHAR LIMIT=NONE] -->
    <string name="accessibility_scanning_face">Scanning face</string>
    <!-- Click action label for accessibility for the smart reply buttons (not shown on-screen).". [CHAR LIMIT=NONE] -->
    <string name="accessibility_send_smart_reply">Send</string>
    <!-- Click action label for accessibility for the unlock button. [CHAR LIMIT=NONE] -->
+12 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    private final UnlockMethodCache mUnlockMethodCache;
    private AccessibilityController mAccessibilityController;
    private boolean mHasFingerPrintIcon;
    private boolean mHasFaceUnlockIcon;
    private int mDensity;

    private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
@@ -130,6 +131,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        }
        int state = getState();
        boolean anyFingerprintIcon = state == STATE_FINGERPRINT || state == STATE_FINGERPRINT_ERROR;
        mHasFaceUnlockIcon = state == STATE_FACE_UNLOCK;
        boolean useAdditionalPadding = anyFingerprintIcon;
        boolean trustHidden = anyFingerprintIcon;
        if (state != mLastState || mDeviceInteractive != mLastDeviceInteractive
@@ -179,6 +181,11 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            setRestingAlpha(
                    anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT);
            setImageDrawable(icon, false);
            if (mHasFaceUnlockIcon) {
                announceForAccessibility(getContext().getString(
                    R.string.accessibility_scanning_face));
            }

            mHasFingerPrintIcon = anyFingerprintIcon;
            if (animation != null && isAnim) {
                animation.forceAnimationOnUI();
@@ -228,6 +235,11 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            info.addAction(unlock);
            info.setHintText(getContext().getString(
                    R.string.accessibility_waiting_for_fingerprint));
        } else if (mHasFaceUnlockIcon){
            //Avoid 'button' to be spoken for scanning face
            info.setClassName(LockIcon.class.getName());
            info.setContentDescription(getContext().getString(
                R.string.accessibility_scanning_face));
        }
    }