A11y: Better label status bar icons
Some apps put just their app name as
the title. For those we should probably
show the text instead.
Fixes: 30739573
Test: receive notification that has the same title as app name, observe that the content description shows the title
Change-Id: I2e066507beee50c669ce34c6de33876a2474fca6
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index ec15d10..263df79 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -459,9 +459,13 @@
}
CharSequence title = n.extras.getCharSequence(Notification.EXTRA_TITLE);
+ CharSequence text = n.extras.getCharSequence(Notification.EXTRA_TEXT);
CharSequence ticker = n.tickerText;
- CharSequence desc = !TextUtils.isEmpty(title) ? title
+ // Some apps just put the app name into the title
+ CharSequence titleOrText = TextUtils.equals(title, appName) ? text : title;
+
+ CharSequence desc = !TextUtils.isEmpty(titleOrText) ? titleOrText
: !TextUtils.isEmpty(ticker) ? ticker : "";
return c.getString(R.string.accessibility_desc_notification_icon, appName, desc);