Add content description in the tutorial dialog
Add content description in the message of tutorial dialog in
accessibility button mode. It prevents Talkback speaking out "%s",
which is not the content we want.
Bug: 135497450
Test: test with TalkBack
Change-Id: If7ce8a957cbb44a12124bc3436d8e32ef0f0da83
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b215ef5..ea0f8bc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4856,7 +4856,7 @@
<!-- Title for the Accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_gesture_settings">Use new accessibility gesture</string>
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button<xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g>on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
+ <string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_tutorial_dialog_message_gesture_without_talkback">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
<!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java b/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
index e7b2b82..153fa19 100644
--- a/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
+++ b/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
@@ -179,10 +179,12 @@
final int indexIconStart = messageString.indexOf("%s");
final int indexIconEnd = indexIconStart + 2;
final Drawable icon = context.getDrawable(R.drawable.ic_accessibility_new);
+ final ImageSpan imageSpan = new ImageSpan(icon);
+ imageSpan.setContentDescription("");
icon.setTint(getThemeAttrColor(context, android.R.attr.textColorPrimary));
icon.setBounds(0, 0, lineHeight, lineHeight);
spannableMessage.setSpan(
- new ImageSpan(icon), indexIconStart, indexIconEnd,
+ imageSpan, indexIconStart, indexIconEnd,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableMessage;