Remove notification content from icon a11y The content can be read when the full cards are visible Test: StatusBarIconViewTest Test: enable talkback, highlight icons Flag: EXEMPT bug fix Bug: 338024220 (cherry picked from commit e55a350cb80404544d2b227b4de0058505788c3c) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9d00ab315dd7d661e71b5fcc51152ced2b2ae28a) Merged-In: I3d3b7329c187808a28663aab16838a93a288b051 Change-Id: I3d3b7329c187808a28663aab16838a93a288b051
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationContentDescriptionTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationContentDescriptionTest.kt index 12473cb..896f940 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationContentDescriptionTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationContentDescriptionTest.kt
@@ -34,31 +34,9 @@ private val TICKER = "this is a ticker" @Test - fun notificationWithAllDifferentFields_descriptionIsTitle() { + fun notificationWithAllDifferentFields_descriptionIsAppName() { val n = createNotification(TITLE, TEXT, TICKER) val description = contentDescForNotification(context, n) - assertThat(description).isEqualTo(createDescriptionText(n, TITLE)) - } - - @Test - fun notificationWithAllDifferentFields_titleMatchesAppName_descriptionIsText() { - val n = createNotification(getTestAppName(), TEXT, TICKER) - val description = contentDescForNotification(context, n) - assertThat(description).isEqualTo(createDescriptionText(n, TEXT)) - } - - @Test - fun notificationWithAllDifferentFields_titleMatchesAppNameNoText_descriptionIsTicker() { - val n = createNotification(getTestAppName(), null, TICKER) - val description = contentDescForNotification(context, n) - assertThat(description).isEqualTo(createDescriptionText(n, TICKER)) - } - - @Test - fun notificationWithAllDifferentFields_titleMatchesAppNameNoTextNoTicker_descriptionEmpty() { - val appName = getTestAppName() - val n = createNotification(appName, null, null) - val description = contentDescForNotification(context, n) assertThat(description).isEqualTo(createDescriptionText(n, "")) }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationContentDescription.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationContentDescription.kt index bdd9fd0..6b6920a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationContentDescription.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationContentDescription.kt
@@ -28,14 +28,5 @@ @MainThread fun contentDescForNotification(c: Context, n: Notification): CharSequence { val appName = n.loadHeaderAppName(c) ?: "" - val title = n.extras?.getCharSequence(Notification.EXTRA_TITLE) - val text = n.extras?.getCharSequence(Notification.EXTRA_TEXT) - val ticker = n.tickerText - - // Some apps just put the app name into the title - val titleOrText = if (TextUtils.equals(title, appName)) text else title - val desc = - if (!TextUtils.isEmpty(titleOrText)) titleOrText - else if (!TextUtils.isEmpty(ticker)) ticker else "" - return c.getString(R.string.accessibility_desc_notification_icon, appName, desc) + return c.getString(R.string.accessibility_desc_notification_icon, appName, "") }