Merge "Fix content description for notification icons" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
eefff3742d
@@ -3301,7 +3301,10 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String loadHeaderAppName() {
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public String loadHeaderAppName() {
|
||||||
CharSequence name = null;
|
CharSequence name = null;
|
||||||
final PackageManager pm = mContext.getPackageManager();
|
final PackageManager pm = mContext.getPackageManager();
|
||||||
if (mN.extras.containsKey(EXTRA_SUBSTITUTE_APP_NAME)) {
|
if (mN.extras.containsKey(EXTRA_SUBSTITUTE_APP_NAME)) {
|
||||||
|
|||||||
@@ -1657,6 +1657,9 @@
|
|||||||
<!-- Accessibility label for window when QS editing is happening [CHAR LIMIT=NONE] -->
|
<!-- Accessibility label for window when QS editing is happening [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_desc_quick_settings_edit">Quick settings editor.</string>
|
<string name="accessibility_desc_quick_settings_edit">Quick settings editor.</string>
|
||||||
|
|
||||||
|
<!-- Accessibility label for the notification icons in the collapsed status bar. Not shown on screen [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_desc_notification_icon"><xliff:g name="app_name" example="Gmail">%1$s</xliff:g> notification: <xliff:g name="notification_text" example="5 new messages">%2$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- Multi-Window strings -->
|
<!-- Multi-Window strings -->
|
||||||
<!-- Text that gets shown on top of current activity to inform the user that the system force-resized the current activity and that things might crash/not work properly [CHAR LIMIT=NONE] -->
|
<!-- Text that gets shown on top of current activity to inform the user that the system force-resized the current activity and that things might crash/not work properly [CHAR LIMIT=NONE] -->
|
||||||
<string name="dock_forced_resizable">App may not work with split-screen.</string>
|
<string name="dock_forced_resizable">App may not work with split-screen.</string>
|
||||||
|
|||||||
@@ -2114,7 +2114,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
smallIcon,
|
smallIcon,
|
||||||
n.iconLevel,
|
n.iconLevel,
|
||||||
n.number,
|
n.number,
|
||||||
n.tickerText);
|
StatusBarIconView.contentDescForNotification(mContext, n));
|
||||||
if (!iconView.set(ic)) {
|
if (!iconView.set(ic)) {
|
||||||
handleNotificationError(sbn, "Couldn't create icon: " + ic);
|
handleNotificationError(sbn, "Couldn't create icon: " + ic);
|
||||||
return null;
|
return null;
|
||||||
@@ -2283,7 +2283,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
n.getSmallIcon(),
|
n.getSmallIcon(),
|
||||||
n.iconLevel,
|
n.iconLevel,
|
||||||
n.number,
|
n.number,
|
||||||
n.tickerText);
|
StatusBarIconView.contentDescForNotification(mContext, n));
|
||||||
entry.icon.setNotification(n);
|
entry.icon.setNotification(n);
|
||||||
if (!entry.icon.set(ic)) {
|
if (!entry.icon.set(ic)) {
|
||||||
handleNotificationError(notification, "Couldn't update icon: " + ic);
|
handleNotificationError(notification, "Couldn't update icon: " + ic);
|
||||||
@@ -2307,7 +2307,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
n.getSmallIcon(),
|
n.getSmallIcon(),
|
||||||
n.iconLevel,
|
n.iconLevel,
|
||||||
n.number,
|
n.number,
|
||||||
n.tickerText);
|
StatusBarIconView.contentDescForNotification(mContext, n));
|
||||||
entry.icon.setNotification(n);
|
entry.icon.setNotification(n);
|
||||||
entry.icon.set(ic);
|
entry.icon.set(ic);
|
||||||
inflateViews(entry, mStackScroller);
|
inflateViews(entry, mStackScroller);
|
||||||
|
|||||||
@@ -307,9 +307,9 @@ public class StatusBarIconView extends AnimatedImageView {
|
|||||||
|
|
||||||
private void setContentDescription(Notification notification) {
|
private void setContentDescription(Notification notification) {
|
||||||
if (notification != null) {
|
if (notification != null) {
|
||||||
CharSequence tickerText = notification.tickerText;
|
String d = contentDescForNotification(mContext, notification);
|
||||||
if (!TextUtils.isEmpty(tickerText)) {
|
if (!TextUtils.isEmpty(d)) {
|
||||||
setContentDescription(tickerText);
|
setContentDescription(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,4 +322,12 @@ public class StatusBarIconView extends AnimatedImageView {
|
|||||||
public String getSlot() {
|
public String getSlot() {
|
||||||
return mSlot;
|
return mSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String contentDescForNotification(Context c, Notification n) {
|
||||||
|
Notification.Builder builder = Notification.Builder.recoverBuilder(c, n);
|
||||||
|
String appName = builder.loadHeaderAppName();
|
||||||
|
CharSequence ticker = n.tickerText;
|
||||||
|
return c.getString(R.string.accessibility_desc_notification_icon, appName, ticker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user