[Ongoing Call Chip] Improve accessibility.

Test: atest and manual
Bug: 183229367
Change-Id: I043f7259989c5431eeedc84488ae27fb08bc79c4
This commit is contained in:
Caitlin Cassidy
2021-05-11 14:54:59 +00:00
parent 39e1ba5a27
commit 47e53c9ba5
3 changed files with 7 additions and 0 deletions

View File

@@ -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

View File

@@ -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>

View File

@@ -56,6 +56,7 @@ class OngoingCallChronometer @JvmOverloads constructor(
// call starts.
minimumTextWidth = 0
shouldHideText = false
visibility = VISIBLE
super.setBase(base)
}
@@ -76,6 +77,9 @@ class OngoingCallChronometer @JvmOverloads constructor(
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