Mark title & subtitle focusable, set selected unless a11y active
Marking title and subtitle important for accessibility to meet a11y
requirements. Title and subtitle are also set as selected to enable marquee, unless talkback is on, to avoid announcing "selected" (b/210363098 for context)
Test: Manually verified title & subtitle are focusable, not preceded by “Selected” in talkback
Fixes: 289000676
Change-Id: Ie070229e3798e9a3f91130cf83507b9efbfce6c0
diff --git a/packages/SystemUI/res/layout/biometric_prompt_layout.xml b/packages/SystemUI/res/layout/biometric_prompt_layout.xml
index ecb0bfa..bea0e13 100644
--- a/packages/SystemUI/res/layout/biometric_prompt_layout.xml
+++ b/packages/SystemUI/res/layout/biometric_prompt_layout.xml
@@ -28,7 +28,6 @@
android:singleLine="true"
android:marqueeRepeatLimit="1"
android:ellipsize="marquee"
- android:importantForAccessibility="no"
style="@style/TextAppearance.AuthCredential.Title"/>
<TextView
@@ -39,7 +38,6 @@
android:singleLine="true"
android:marqueeRepeatLimit="1"
android:ellipsize="marquee"
- android:importantForAccessibility="no"
style="@style/TextAppearance.AuthCredential.Subtitle"/>
<TextView
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
index 4e26601..91f6b693 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
@@ -92,9 +92,11 @@
val subtitleView = view.findViewById<TextView>(R.id.subtitle)
val descriptionView = view.findViewById<TextView>(R.id.description)
- // set selected for marquee
- titleView.isSelected = true
- subtitleView.isSelected = true
+ // set selected to enable marquee unless a screen reader is enabled
+ titleView.isSelected =
+ !accessibilityManager.isEnabled || !accessibilityManager.isTouchExplorationEnabled
+ subtitleView.isSelected =
+ !accessibilityManager.isEnabled || !accessibilityManager.isTouchExplorationEnabled
descriptionView.movementMethod = ScrollingMovementMethod()
val iconViewOverlay = view.findViewById<LottieAnimationView>(R.id.biometric_icon_overlay)