From 7bb0c30688004c16a37ae3c1baf2aeedc54f05d7 Mon Sep 17 00:00:00 2001 From: jasonwshsu Date: Tue, 17 Dec 2024 20:51:55 +0800 Subject: [PATCH] Update contentDescription to announce 'than' rather than '>' Root Cause: Talkback announce '>' (greater than), which is not user expected. Solution: Update contentDescription with string contain 'than' Bug: 378804585 Test: Enable screen reader to check Flag: EXEMPT bugfix Change-Id: Ibc7a2f7c7d1100dd25ddf29c2fffb22ac5ad52c6 --- res/values/strings.xml | 2 ++ .../HearingDeviceFooterPreferenceController.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index 8e5e04fb36c..13b7d05e81e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5672,6 +5672,8 @@ About hearing devices To find other hearing devices that aren’t supported by ASHA or LE Audio, tap Pair new device > See more devices + + To find other hearing devices that aren’t supported by ASHA or LE Audio, tap Pair new device then See more devices Pair hearing device diff --git a/src/com/android/settings/accessibility/HearingDeviceFooterPreferenceController.java b/src/com/android/settings/accessibility/HearingDeviceFooterPreferenceController.java index cd92448392a..2f532e9a06c 100644 --- a/src/com/android/settings/accessibility/HearingDeviceFooterPreferenceController.java +++ b/src/com/android/settings/accessibility/HearingDeviceFooterPreferenceController.java @@ -18,6 +18,9 @@ package com.android.settings.accessibility; import android.content.Context; +import androidx.annotation.NonNull; +import androidx.preference.PreferenceScreen; + import com.android.settings.R; /** Preference controller for footer in hearing device page. */ @@ -32,4 +35,17 @@ public class HearingDeviceFooterPreferenceController extends protected String getIntroductionTitle() { return mContext.getString(R.string.accessibility_hearing_device_about_title); } + + @Override + public void displayPreference(@NonNull PreferenceScreen screen) { + super.displayPreference(screen); + + final AccessibilityFooterPreference footerPreference = + screen.findPreference(getPreferenceKey()); + // Need to update contentDescription string to announce "than" rather than ">" + final String summaryTts = mContext.getString( + R.string.accessibility_hearing_device_footer_summary_tts); + final String contentDescription = getIntroductionTitle() + "\n\n" + summaryTts; + footerPreference.setContentDescription(contentDescription); + } }