From 7f0c95995472e4f7e7b64382e263bdd0d2a8f51b Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Tue, 16 Aug 2022 13:06:29 +0000 Subject: [PATCH] [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 --- .../taptotransfer/common/MediaTttChipControllerCommon.kt | 2 +- .../taptotransfer/receiver/MediaTttChipControllerReceiver.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt index 2278938c398ef..3a0ac1b7d9b0f 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt @@ -226,7 +226,7 @@ abstract class MediaTttChipControllerCommon( appIconView.contentDescription = appNameOverride ?: iconInfo.iconName appIconView.setImageDrawable(appIconDrawableOverride ?: iconInfo.icon) - return appIconView.contentDescription.toString() + return appIconView.contentDescription } /** diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt index 196ea222e50d5..00a22f20e94d4 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt @@ -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)) }