diff options
author | Luis Vidal <lvidal@cyngn.com> | 2016-05-16 16:35:35 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-05-17 14:30:09 -0700 |
commit | d67600a4f39917e47d5009bf4f9f8ce3be362af9 (patch) | |
tree | ae566d2947713ab2a97436ea56dfb2f9e972a7dc /src/com/android/settings/DateTimeSettings.java | |
parent | d6709e61c125cdc636944c16efe3303f9ffbb9e1 (diff) | |
download | packages_apps_Settings-d67600a4f39917e47d5009bf4f9f8ce3be362af9.zip packages_apps_Settings-d67600a4f39917e47d5009bf4f9f8ce3be362af9.tar.gz packages_apps_Settings-d67600a4f39917e47d5009bf4f9f8ce3be362af9.tar.bz2 |
Settings: update time zone strings on date change
If the user changes the date, most obvious case being from 1970, to a
current date, and the user's selected Locale's country time zones have
been changed (according to ICU), we must update the time zone strings in
the system.
Ref: CYNGNOS-453
Signed-off-by: Roman Birg <roman@cyngn.com>
(cherry picked from commit 926c3b0a50e521368628ef0d9975c99fa4cd3480)
Change-Id: I487c54cd4f933286c5004d24a3f8730ee2d4e4f6
Diffstat (limited to 'src/com/android/settings/DateTimeSettings.java')
-rw-r--r-- | src/com/android/settings/DateTimeSettings.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java index 8a9e2ad..34753ef 100644 --- a/src/com/android/settings/DateTimeSettings.java +++ b/src/com/android/settings/DateTimeSettings.java @@ -40,9 +40,12 @@ import android.widget.TimePicker; import com.android.internal.logging.MetricsLogger; import com.android.settingslib.datetime.ZoneGetter; +import libcore.icu.TimeZoneNames; +import java.text.DateFormatSymbols; import java.util.Calendar; import java.util.Date; +import java.util.Locale; public class DateTimeSettings extends SettingsPreferenceFragment implements OnSharedPreferenceChangeListener, @@ -329,6 +332,16 @@ public class DateTimeSettings extends SettingsPreferenceFragment if (when / 1000 < Integer.MAX_VALUE) { ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE)).setTime(when); } + updateLocaleStrings(); + } + + static void updateLocaleStrings() { + // If a device was boot up with date 1970 and then date changes to some later time, + // the wrong string might be cached if the country's zones have changed. + // See external/icu/icu4c/source/data/misc/metaZones.txt for complete mapping + TimeZoneNames.clearLocaleCache(); + Locale locale = Locale.getDefault(); + DateFormatSymbols.getInstance(locale).setZoneStrings(TimeZoneNames.getZoneStrings(locale)); } /* package */ static void setTime(Context context, int hourOfDay, int minute) { |