summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2021-05-11 11:35:19 -0400
committerBeverly <beverlyt@google.com>2021-05-11 14:34:27 -0400
commit1a21ef3fe1b80958430e0e2473142a48a6c5a7a9 (patch)
tree72ad6412888a45d42cead52e1f70db7d872975cf /packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
parent3d46ae52dccb4c519fb3ab733d6b82b5c83b67de (diff)
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
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/LockIconViewController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/LockIconViewController.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
index b5f2ab213559..b367bdf08886 100644
--- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
@@ -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());
}