diff options
author | Christopher Tate <ctate@google.com> | 2015-08-20 16:38:37 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2015-08-20 17:16:08 -0700 |
commit | ffe701dc0e52ee95bf6c54291ed1b574d389019c (patch) | |
tree | 71dbd5925ae35d93fc96a6ae1e08be0fb474c7bf /src/com/android/settings/DeviceInfoSettings.java | |
parent | 19551115dbb3d848be084462342d41addeb1caf6 (diff) | |
download | packages_apps_Settings-ffe701dc0e52ee95bf6c54291ed1b574d389019c.zip packages_apps_Settings-ffe701dc0e52ee95bf6c54291ed1b574d389019c.tar.gz packages_apps_Settings-ffe701dc0e52ee95bf6c54291ed1b574d389019c.tar.bz2 |
Present the security patch date in a human-friendly format
For example, for an ISO date of 2015-08-01, this now displays
"August 1, 2015" in enUS, and "1 August 2015" in enUK, and
"2015年8月1日" in jpJP.
Bug 23358065
Change-Id: Iaa920ec88d765a222f0b589123665b689bf41978
Diffstat (limited to 'src/com/android/settings/DeviceInfoSettings.java')
-rw-r--r-- | src/com/android/settings/DeviceInfoSettings.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java index 9ead7c6..1f0cad1 100644 --- a/src/com/android/settings/DeviceInfoSettings.java +++ b/src/com/android/settings/DeviceInfoSettings.java @@ -37,8 +37,10 @@ import android.provider.SearchIndexableResource; import android.provider.Settings; import android.telephony.CarrierConfigManager; import android.text.TextUtils; +import android.text.format.DateFormat; import android.util.Log; import android.widget.Toast; + import com.android.internal.logging.MetricsLogger; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Index; @@ -47,9 +49,13 @@ import com.android.settings.search.Indexable; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -102,6 +108,14 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In findPreference(KEY_FIRMWARE_VERSION).setEnabled(true); String patch = Build.VERSION.SECURITY_PATCH; if (!"".equals(patch)) { + try { + SimpleDateFormat template = new SimpleDateFormat("yyyy-MM-dd"); + Date patchDate = template.parse(patch); + String format = DateFormat.getBestDateTimePattern(Locale.getDefault(), "dMMMMyyyy"); + patch = DateFormat.format(format, patchDate).toString(); + } catch (ParseException e) { + // broken parse; fall through and use the raw string + } setStringSummary(KEY_SECURITY_PATCH, patch); } else { getPreferenceScreen().removePreference(findPreference(KEY_SECURITY_PATCH)); |