[Ongoing Call Chip] Improve accessibility.
Test: atest and manual
Bug: 183229367
Change-Id: I043f7259989c5431eeedc84488ae27fb08bc79c4
diff --git a/packages/SystemUI/res/layout/ongoing_call_chip.xml b/packages/SystemUI/res/layout/ongoing_call_chip.xml
index a146547..90214b7 100644
--- a/packages/SystemUI/res/layout/ongoing_call_chip.xml
+++ b/packages/SystemUI/res/layout/ongoing_call_chip.xml
@@ -23,6 +23,7 @@
android:background="@drawable/ongoing_call_chip_bg"
android:paddingStart="@dimen/ongoing_call_chip_side_padding"
android:paddingEnd="@dimen/ongoing_call_chip_side_padding"
+ android:contentDescription="@string/ongoing_phone_call_content_description"
>
<ImageView
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 30add20..19ab681 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2968,4 +2968,6 @@
<!-- Message shown to suggest authentication using [CHAR LIMIT=60]-->
<string name="keyguard_try_fingerprint">Use fingerprint to open</string>
+ <!-- Content description for a chip in the status bar showing that the user is currently on a phone call. [CHAR LIMIT=NONE] -->
+ <string name="ongoing_phone_call_content_description">Ongoing phone call</string>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometer.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometer.kt
index 1fe77fd..6e27cae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometer.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometer.kt
@@ -56,6 +56,7 @@
// call starts.
minimumTextWidth = 0
shouldHideText = false
+ visibility = VISIBLE
super.setBase(base)
}
@@ -76,6 +77,9 @@
if (desiredTextWidth > enforcedTextWidth) {
shouldHideText = true
+ // Changing visibility ensures that the content description is not read aloud when the
+ // time isn't displayed.
+ visibility = GONE
setMeasuredDimension(0, 0)
} else {
// It's possible that the current text could fit in a smaller width, but we don't want