From d57ed93f922343d5a729edcd003c3c83a9d0cd40 Mon Sep 17 00:00:00 2001 From: markchien Date: Wed, 25 Mar 2020 11:32:07 +0800 Subject: [PATCH 1/4] Ethernet tethering: change char limit to NONE Linguist request for extending character limit. Since other tethering type(e.g. wifi tethering) do not have char limit, unblock linguist by changing ethernet ethering's char limit to NONE. Bug: 152226430 Bug: 152225048 Test: m Change-Id: If944cdb5bceebd33d3354c2c01c2d7656e4a113a --- res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 0475597c927..0b6894abfbf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3813,9 +3813,9 @@ %1$s will be untethered. - + Ethernet tethering - + Share phone\u2019s internet connection via USB Ethernet From 6758ca661e49125653cc4eed23fc83a3d8555300 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Tue, 31 Mar 2020 16:28:18 -0700 Subject: [PATCH 2/4] Hide unprovisioned MDN (phone number) at select profile dialog Bug: 151773922 Fix: 151773922 Test: Build Change-Id: If84600cc426fefcdd219c4a44a5510b8db5c0a89 Merged-In: If84600cc426fefcdd219c4a44a5510b8db5c0a89 --- src/com/android/settings/sim/SimListDialogFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/sim/SimListDialogFragment.java b/src/com/android/settings/sim/SimListDialogFragment.java index 3b78927de5d..a5d4157818c 100644 --- a/src/com/android/settings/sim/SimListDialogFragment.java +++ b/src/com/android/settings/sim/SimListDialogFragment.java @@ -23,6 +23,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -179,11 +180,16 @@ public class SimListDialogFragment extends SimDialogFragment implements Utils.getColorAttr(mContext, android.R.attr.textColorSecondary)); } else { title.setText(sub.getDisplayName()); - summary.setText(sub.getNumber()); + summary.setText(isMdnProvisioned(sub.getNumber()) ? sub.getNumber() : ""); icon.setImageBitmap(sub.createIconBitmap(mContext)); } return convertView; } + + // An MDN is considered not provisioned if it's empty or all 0's + private boolean isMdnProvisioned(String mdn) { + return !(TextUtils.isEmpty(mdn) || mdn.matches("[\\D0]+")); + } } } From 01871ab4151c5736b202ab74664976b55f77802d Mon Sep 17 00:00:00 2001 From: Howard Chen Date: Thu, 19 Mar 2020 18:55:55 +0800 Subject: [PATCH 3/4] Hide the DSULoader when DSU is running Bug: 151792130 Test: open developer settings and check the DSULoader make -j32 RunSettingsRoboTests Change-Id: I8f82e0f7ddbfd2c50ac6e2a2d3f61f7715ba452c --- res/values/strings.xml | 2 ++ .../development/SelectDSUPreferenceController.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b7899073dec..a6d3ab7604c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -11745,6 +11745,8 @@ Load a Dynamic System Update Image Loading... + + DSU is running Bug report handler diff --git a/src/com/android/settings/development/SelectDSUPreferenceController.java b/src/com/android/settings/development/SelectDSUPreferenceController.java index 72e84472a8f..6498ae752f0 100644 --- a/src/com/android/settings/development/SelectDSUPreferenceController.java +++ b/src/com/android/settings/development/SelectDSUPreferenceController.java @@ -18,6 +18,7 @@ package com.android.settings.development; import android.content.Context; import android.content.Intent; +import android.os.SystemProperties; import androidx.preference.Preference; @@ -37,9 +38,16 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController return DSU_LOADER_KEY; } + private boolean isDSURunning() { + return SystemProperties.getBoolean("ro.gsid.image_running", false); + } + @Override public boolean handlePreferenceTreeClick(Preference preference) { if (DSU_LOADER_KEY.equals(preference.getKey())) { + if (isDSURunning()) { + return true; + } final Intent intent = new Intent(mContext, DSULoader.class); mContext.startActivity(intent); return true; @@ -49,6 +57,7 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController @Override public void updateState(Preference preference) { - preference.setSummary(mContext.getResources().getString(R.string.dsu_loader_description)); + int key = isDSURunning() ? R.string.dsu_is_running : R.string.dsu_loader_description; + preference.setSummary(mContext.getResources().getString(key)); } } From 9266fe32f74b5f996e17d5526c7f12d2f61fc87f Mon Sep 17 00:00:00 2001 From: Howard Chen Date: Fri, 20 Mar 2020 17:07:37 +0800 Subject: [PATCH 4/4] Add security patch level check in DSULoader There's an enforced check enabled in locked devices. It requires the installed DSU to have a security patch level equal or higher than the device. This CL adds the SPL check in the DSULoader. Bug: 151790609 Test: Developer Settings -> DSULoader Change-Id: Ifef4175e846f58d8033cf161d7fec8481dc0532b --- .../settings/development/DSULoader.java | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/development/DSULoader.java b/src/com/android/settings/development/DSULoader.java index 36ce785641f..4727369e5a8 100644 --- a/src/com/android/settings/development/DSULoader.java +++ b/src/com/android/settings/development/DSULoader.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.SystemProperties; +import android.text.TextUtils; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; @@ -40,8 +41,11 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; +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 javax.net.ssl.HttpsURLConnection; @@ -62,6 +66,7 @@ public class DSULoader extends ListActivity { private static final String PROPERTY_KEY_OS = "ro.system.build.version.release"; private static final String PROPERTY_KEY_VNDK = "ro.vndk.version"; private static final String PROPERTY_KEY_LIST = "ro.vendor.dsu.list"; + private static final String PROPERTY_KEY_SPL = "ro.build.version.security_patch"; private static final String DSU_LIST = "https://dl.google.com/developers/android/gsi/gsi-src.json"; @@ -121,7 +126,8 @@ public class DSULoader extends ListActivity { mDsuList = dsuList; } - private void fetch(URL url) throws IOException, JSONException, MalformedURLException { + private void fetch(URL url) + throws IOException, JSONException, MalformedURLException, ParseException { String content = readAll(url); JSONObject jsn = new JSONObject(content); // The include primitive is like below @@ -195,6 +201,8 @@ public class DSULoader extends ListActivity { private static final String OS_VERSION = "os_version"; private static final String VNDK = "vndk"; private static final String PUBKEY = "pubkey"; + private static final String SPL = "spl"; + private static final String SPL_FORMAT = "yyyy-MM-dd"; private static final String TOS = "tos"; String mName = null; @@ -203,10 +211,11 @@ public class DSULoader extends ListActivity { int mOsVersion = -1; int[] mVndk = null; String mPubKey = ""; + Date mSPL = null; URL mTosUrl = null; URL mUri; - DSUPackage(JSONObject jsn) throws JSONException, MalformedURLException { + DSUPackage(JSONObject jsn) throws JSONException, MalformedURLException, ParseException { Slog.i(TAG, "DSUPackage: " + jsn.toString()); mName = jsn.getString(NAME); mDetails = jsn.getString(DETAILS); @@ -228,6 +237,9 @@ public class DSULoader extends ListActivity { if (jsn.has(TOS)) { mTosUrl = new URL(jsn.getString(TOS)); } + if (jsn.has(SPL)) { + mSPL = new SimpleDateFormat(SPL_FORMAT).parse(jsn.getString(SPL)); + } } int dessertNumber(String s, int base) { @@ -265,6 +277,18 @@ public class DSULoader extends ListActivity { return cpu; } + Date getDeviceSPL() { + String spl = SystemProperties.get(PROPERTY_KEY_SPL); + if (TextUtils.isEmpty(spl)) { + return null; + } + try { + return new SimpleDateFormat(SPL_FORMAT).parse(spl); + } catch (ParseException e) { + return null; + } + } + boolean isSupported() { boolean supported = true; String cpu = getDeviceCpu(); @@ -301,6 +325,16 @@ public class DSULoader extends ListActivity { } } } + if (mSPL != null) { + Date spl = getDeviceSPL(); + if (spl == null) { + Slog.i(TAG, "Failed to getDeviceSPL"); + supported = false; + } else if (spl.getTime() > mSPL.getTime()) { + Slog.i(TAG, "Device SPL:" + spl.toString() + " > " + mSPL.toString()); + supported = false; + } + } Slog.i(TAG, mName + " isSupported " + supported); return supported; }