[a11y] Getting accessibility focus at pop up icon

When pop up icon is shown on the TTT receiver, the talkback says the name of the app playing.

Bug: 229561308
Test: Checked that Talkback says the icon name whenever we execute an adb command that pops up the icon.
Change-Id: I369999143488d5486c4e2c508ac182b870468765
This commit is contained in:
Michael Mikhail
2022-08-16 13:06:29 +00:00
parent d935aba99b
commit 7f0c959954
2 changed files with 5 additions and 2 deletions

View File

@@ -226,7 +226,7 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>(
appIconView.contentDescription = appNameOverride ?: iconInfo.iconName
appIconView.setImageDrawable(appIconDrawableOverride ?: iconInfo.icon)
return appIconView.contentDescription.toString()
return appIconView.contentDescription
}
/**

View File

@@ -141,12 +141,13 @@ class MediaTttChipControllerReceiver @Inject constructor(
override fun updateChipView(newChipInfo: ChipReceiverInfo, currentChipView: ViewGroup) {
super.updateChipView(newChipInfo, currentChipView)
setIcon(
val iconName = setIcon(
currentChipView,
newChipInfo.routeInfo.clientPackageName,
newChipInfo.appIconDrawableOverride,
newChipInfo.appNameOverride
)
currentChipView.contentDescription = iconName
}
override fun animateChipIn(chipView: ViewGroup) {
@@ -159,6 +160,8 @@ class MediaTttChipControllerReceiver @Inject constructor(
.alpha(1f)
.setDuration(5.frames)
.start()
// Using withEndAction{} doesn't apply a11y focus when screen is unlocked.
appIconView.postOnAnimation { chipView.requestAccessibilityFocus() }
startRipple(chipView.requireViewById(R.id.ripple))
}