Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 356e5b58 authored by Christopher Tate's avatar Christopher Tate Committed by Android Git Automerger
Browse files

am ffe701dc: Present the security patch date in a human-friendly format

* commit 'ffe701dc':
  Present the security patch date in a human-friendly format
parents c877856a ffe701dc
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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));