A11y: Fix battery icon and clock descriptions
Now announces charging state on the battery icon
and AM/PM on the clock.
Change-Id: Ib8d249e60b555834e5e224287ea332178ce7c165
Fixes: 27552350
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index 3293964..66152fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -61,6 +61,7 @@
private Calendar mCalendar;
private String mClockFormatString;
private SimpleDateFormat mClockFormat;
+ private SimpleDateFormat mContentDescriptionFormat;
private Locale mLocale;
private static final int AM_PM_STYLE_NORMAL = 0;
@@ -158,6 +159,7 @@
if (mDemoMode) return;
mCalendar.setTimeInMillis(System.currentTimeMillis());
setText(getSmallTime());
+ setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime()));
}
@Override
@@ -207,6 +209,7 @@
? is24 ? d.timeFormat_Hms : d.timeFormat_hms
: is24 ? d.timeFormat_Hm : d.timeFormat_hm;
if (!format.equals(mClockFormatString)) {
+ mContentDescriptionFormat = new SimpleDateFormat(format);
/*
* Search for an unquoted "a" in the format string, so we can
* add dummy characters around it to let us find it again after
@@ -295,6 +298,7 @@
mCalendar.set(Calendar.MINUTE, mm);
}
setText(getSmallTime());
+ setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime()));
}
}