Switch over to getting 12-/24-hour time formats from CLDR via icu4c.
I removed the duplication in DateTimeView rather than fix that copy
of the code.
Bug: 7924970
Change-Id: I60c205d06ad3b50fd2f5d5fc432e4eb186f9c0e7
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 ffc18c7..6476153 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -42,6 +42,8 @@
import java.util.Calendar;
import java.util.TimeZone;
+import libcore.icu.LocaleData;
+
import com.android.internal.R;
/**
@@ -129,20 +131,14 @@
private final CharSequence getSmallTime() {
Context context = getContext();
- boolean b24 = DateFormat.is24HourFormat(context);
- int res;
-
- if (b24) {
- res = R.string.twenty_four_hour_time_format;
- } else {
- res = R.string.twelve_hour_time_format;
- }
+ boolean is24 = DateFormat.is24HourFormat(context);
+ LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
final char MAGIC1 = '\uEF00';
final char MAGIC2 = '\uEF01';
SimpleDateFormat sdf;
- String format = context.getString(res);
+ String format = is24 ? d.timeFormat24 : d.timeFormat12;
if (!format.equals(mClockFormatString)) {
/*
* Search for an unquoted "a" in the format string, so we can