diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 200c478a569a0..977adde635aa6 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2362,6 +2362,8 @@
Playing on %1$s
Something went wrong. Try again.
+
+ Loading
Inactive, check app
diff --git a/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt b/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
index 52980c3c1f9bd..b2220620eda09 100644
--- a/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
@@ -173,9 +173,16 @@ open class ChipbarCoordinator @Inject constructor(
} else {
""
}
+ val endItemDesc =
+ if (newInfo.endItem is ChipbarEndItem.Loading) {
+ ". ${context.resources.getString(R.string.media_transfer_loading)}."
+ } else {
+ ""
+ }
val chipInnerView = currentView.getInnerView()
- chipInnerView.contentDescription = "$loadedIconDesc${newInfo.text.loadText(context)}"
+ chipInnerView.contentDescription =
+ "$loadedIconDesc${newInfo.text.loadText(context)}$endItemDesc"
chipInnerView.accessibilityLiveRegion = ACCESSIBILITY_LIVE_REGION_ASSERTIVE
maybeGetAccessibilityFocus(newInfo, currentView)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinatorTest.kt
index d3411c2b44169..90178c6a00966 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinatorTest.kt
@@ -124,7 +124,7 @@ class ChipbarCoordinatorTest : SysuiTestCase() {
)
)
- val contentDescView = getChipbarView().requireViewById(R.id.chipbar_inner)
+ val contentDescView = getChipbarView().getInnerView()
assertThat(contentDescView.contentDescription.toString()).contains("loadedCD")
assertThat(contentDescView.contentDescription.toString()).contains("text")
}
@@ -139,10 +139,42 @@ class ChipbarCoordinatorTest : SysuiTestCase() {
)
)
- val contentDescView = getChipbarView().requireViewById(R.id.chipbar_inner)
+ val contentDescView = getChipbarView().getInnerView()
assertThat(contentDescView.contentDescription.toString()).isEqualTo("text")
}
+ @Test
+ fun displayView_contentDescription_endIsLoading() {
+ underTest.displayView(
+ createChipbarInfo(
+ Icon.Resource(R.drawable.ic_cake, ContentDescription.Loaded("loadedCD")),
+ Text.Loaded("text"),
+ endItem = ChipbarEndItem.Loading,
+ )
+ )
+
+ val contentDescView = getChipbarView().getInnerView()
+ val loadingDesc = context.resources.getString(R.string.media_transfer_loading)
+ assertThat(contentDescView.contentDescription.toString()).contains("text")
+ assertThat(contentDescView.contentDescription.toString()).contains(loadingDesc)
+ }
+
+ @Test
+ fun displayView_contentDescription_endNotLoading() {
+ underTest.displayView(
+ createChipbarInfo(
+ Icon.Resource(R.drawable.ic_cake, ContentDescription.Loaded("loadedCD")),
+ Text.Loaded("text"),
+ endItem = ChipbarEndItem.Error,
+ )
+ )
+
+ val contentDescView = getChipbarView().getInnerView()
+ val loadingDesc = context.resources.getString(R.string.media_transfer_loading)
+ assertThat(contentDescView.contentDescription.toString()).contains("text")
+ assertThat(contentDescView.contentDescription.toString()).doesNotContain(loadingDesc)
+ }
+
@Test
fun displayView_loadedIcon_correctlyRendered() {
val drawable = context.getDrawable(R.drawable.ic_celebration)!!
@@ -417,6 +449,8 @@ class ChipbarCoordinatorTest : SysuiTestCase() {
)
}
+ private fun ViewGroup.getInnerView() = this.requireViewById(R.id.chipbar_inner)
+
private fun ViewGroup.getStartIconView() = this.requireViewById(R.id.start_icon)
private fun ViewGroup.getChipText(): String =