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

Commit 1a21ef3f authored by Beverly's avatar Beverly
Browse files

Lock screen a11y updates

When a11y features are enabled, inform the user
when the state of the lock screen changes.

Remove the window accessibility title on the udfps icon so that it won't
announce its window each time the udfps area receives focus. (ie:
previously was announcing "fingerprint sensor, SystemUI")

Add a label to the wallet affordance on the lock screen.

Test: manual
Fixes: 187139663
Fixes: 187190642
Fixes: 187082618
Fixes: 187080405
Change-Id: I4269b1943ec4d2e82eac9525947bb1903886f4f8
parent 3d46ae52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@
        android:background="@drawable/wallet_lockscreen_bg"
        android:layout_marginEnd="@dimen/keyguard_affordance_horizontal_offset"
        android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset"
        android:contentDescription="@string/accessibility_wallet_button"
        android:visibility="gone" />

    <FrameLayout
+5 −1
Original line number Diff line number Diff line
@@ -336,6 +336,8 @@
    <string name="accessibility_phone_button">Phone</string>
    <!-- Content description of the phone button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_voice_assist_button">Voice Assist</string>
    <!-- Content description of the wallet button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wallet_button">Wallet</string>
    <!-- Content description of the unlock button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_unlock_button">Unlock</string>
    <!-- Content description of the lock icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
@@ -2965,7 +2967,9 @@
    <!-- Accessibility action for tapping on an affordance on an unlocked lock screen (ie: "Double
     tap to enter device") [CHAR LIMIT=NONE] -->
    <string name="accessibility_enter_hint">enter device</string>
    <!-- Message shown to suggest authentication using [CHAR LIMIT=60]-->
    <!-- Message shown to suggest authentication using fingerprint [CHAR LIMIT=60]-->
    <string name="keyguard_try_fingerprint">Use fingerprint to open</string>
    <!-- Accessibility announcement to inform user to unlock using the fingerprint sensor [CHAR LIMIT=NONE] -->
    <string name="accessibility_fingerprint_bouncer">Authentication required. Touch the fingerprint sensor to authenticate.</string>

</resources>
+17 −14
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.util.ViewController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Objects;

import javax.inject.Inject;

@@ -75,6 +76,9 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
    @NonNull private final Drawable mButton;
    @NonNull private final Drawable mUnlockIcon;
    @NonNull private final Drawable mLockIcon;
    @NonNull private final CharSequence mDisabledLabel;
    @NonNull private final CharSequence mUnlockedLabel;
    @NonNull private final CharSequence mLockedLabel;

    private boolean mIsDozing;
    private boolean mIsBouncerShowing;
@@ -121,6 +125,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
                com.android.internal.R.drawable.ic_lock, context.getTheme()),
                context.getResources().getDimensionPixelSize(
                        com.android.systemui.R.dimen.udfps_unlock_icon_inset));
        mDisabledLabel = context.getResources().getString(
                R.string.accessibility_udfps_disabled_button);
        mUnlockedLabel = context.getResources().getString(R.string.accessibility_unlock_button);
        mLockedLabel = context.getResources().getString(R.string.accessibility_lock_icon);
        dumpManager.registerDumpable("LockIconViewController", this);
    }

@@ -225,25 +233,27 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
            && mFaceAuthEnrolled;

        updateClickListener();
        final CharSequence prevContentDescription = mView.getContentDescription();
        if (mShowButton) {
            mView.setImageDrawable(mButton);
            mView.setVisibility(View.VISIBLE);
            mView.setContentDescription(getResources().getString(
                    R.string.accessibility_udfps_disabled_button));
            mView.setContentDescription(mDisabledLabel);
        } else if (mShowUnlockIcon) {
            mView.setImageDrawable(mUnlockIcon);
            mView.setVisibility(View.VISIBLE);
            mView.setContentDescription(getResources().getString(
                    R.string.accessibility_unlock_button));
            mView.setContentDescription(mUnlockedLabel);
        } else if (mShowLockIcon) {
            mView.setImageDrawable(mLockIcon);
            mView.setVisibility(View.VISIBLE);
            mView.setContentDescription(getResources().getString(
                    R.string.accessibility_lock_icon));
            mView.setContentDescription(mLockedLabel);
        } else {
            mView.setVisibility(View.INVISIBLE);
            mView.setContentDescription(null);
        }
        if (!Objects.equals(prevContentDescription, mView.getContentDescription())
                && mView.getContentDescription() != null) {
            mView.announceForAccessibility(mView.getContentDescription());
        }
    }

    private final View.AccessibilityDelegate mAccessibilityDelegate =
@@ -258,20 +268,12 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
                        getResources().getString(R.string.accessibility_enter_hint));
        public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfo info) {
            super.onInitializeAccessibilityNodeInfo(v, info);
            removeAllActions(info);
            if (mShowButton || mShowLockIcon) {
                info.addAction(mAccessibilityAuthenticateHint);
            } else if (mShowUnlockIcon) {
                info.addAction(mAccessibilityEnterHint);
            }
        }

        private void removeAllActions(AccessibilityNodeInfo info) {
            info.removeAction(mAccessibilityAuthenticateHint);
            info.removeAction(mAccessibilityEnterHint);
            info.removeAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK);
            mView.setLongClickable(false);
        }
    };

    private boolean isLockScreen() {
@@ -286,6 +288,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
            mView.setOnClickListener(v -> onAffordanceClick());
            if (mAccessibilityManager.isTouchExplorationEnabled()) {
                mView.setOnLongClickListener(null);
                mView.setLongClickable(false);
            } else {
                mView.setOnLongClickListener(v -> onAffordanceClick());
            }
+3 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
        switch (event.getActionMasked()) {
            case MotionEvent.ACTION_OUTSIDE:
                udfpsView.onTouchOutsideView();
                break;
                return true;
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_HOVER_ENTER:
                // To simplify the lifecycle of the velocity tracker, make sure it's never null
@@ -588,6 +588,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
            default:
                // Do nothing to stay in portrait mode.
        }
        // avoid announcing window title
        mCoreLayoutParams.accessibilityTitle = " ";
        return mCoreLayoutParams;
    }

+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;

import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -165,6 +166,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        updatePauseAuth();
        if (mShowingUdfpsBouncer) {
            mView.animateUdfpsBouncer();
            mView.announceForAccessibility(mView.getContext().getString(
                    R.string.accessibility_fingerprint_bouncer));
        } else {
            mView.animateAwayUdfpsBouncer(() -> mKeyguardViewManager.cancelPostAuthActions());
        }
Loading