From 97dad931dfd8da926624814b55409c168dfedc69 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 10 Dec 2019 11:10:34 -0800 Subject: [PATCH] [DO NOT MERGE] Add country blacklist support Adding a country blacklist, except for pixel2(walleye, taimen) will still uses whitelist Bug: 144702079 Test: manually tested Change-Id: I21c146556e5406ecf5c72f74767ea8d5fc643aec --- core/java/android/provider/Settings.java | 26 +++++++++++++++++-- .../android/providers/settings/global.proto | 1 + .../settings/SettingsProtoDumpUtil.java | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 495b37cb5944d..eb6a5394bfef0 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -9900,13 +9900,34 @@ public final class Settings { * List of ISO country codes in which eUICC UI is shown. Country codes should be separated * by comma. * - *

Used to hide eUICC UI from users who are currently in countries no carriers support - * eUICC. + * Note: if {@link #EUICC_SUPPORTED_COUNTRIES} is empty, then {@link + * #EUICC_UNSUPPORTED_COUNTRIES} is used. + * + *

Used to hide eUICC UI from users who are currently in countries where no carriers + * support eUICC. + * * @hide */ //TODO(b/77914569) Changes this to System Api. public static final String EUICC_SUPPORTED_COUNTRIES = "euicc_supported_countries"; + /** + * List of ISO country codes in which eUICC UI is not shown. Country codes should be + * separated by comma. + * + * Note: if {@link #EUICC_SUPPORTED_COUNTRIES} is empty, then {@link + * #EUICC_UNSUPPORTED_COUNTRIES} is used. + * + *

Used to hide eUICC UI from users who are currently in countries where no carriers + * support eUICC. + * + * @hide + */ + //TODO(b/77914569) Changes this to System Api. + public static final String EUICC_UNSUPPORTED_COUNTRIES = "euicc_unsupported_countries"; + private static final Validator EUICC_UNSUPPORTED_COUNTRIES_VALIDATOR = + new SettingsValidators.ComponentNameListValidator(","); + /** * Whether any activity can be resized. When this is true, any * activity, regardless of manifest values, can be resized for multi-window. @@ -13969,6 +13990,7 @@ public final class Settings { VALIDATORS.put(DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, DYNAMIC_POWER_SAVINGS_VALIDATOR); VALIDATORS.put(BLUETOOTH_ON, BLUETOOTH_ON_VALIDATOR); + VALIDATORS.put(EUICC_UNSUPPORTED_COUNTRIES, EUICC_UNSUPPORTED_COUNTRIES_VALIDATOR); VALIDATORS.put(PRIVATE_DNS_MODE, PRIVATE_DNS_MODE_VALIDATOR); VALIDATORS.put(PRIVATE_DNS_SPECIFIER, PRIVATE_DNS_SPECIFIER_VALIDATOR); VALIDATORS.put(SOFT_AP_TIMEOUT_ENABLED, SOFT_AP_TIMEOUT_ENABLED_VALIDATOR); diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto index ca7131477cdc9..3d99b726e6fe0 100644 --- a/core/proto/android/providers/settings/global.proto +++ b/core/proto/android/providers/settings/global.proto @@ -385,6 +385,7 @@ message GlobalSettingsProto { optional SettingProto provisioned = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto factory_reset_timeout_millis = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto unsupported_countries = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Euicc euicc = 52; diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 894ba9cd2f061..21129f9278735 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -641,6 +641,9 @@ class SettingsProtoDumpUtil { dumpSetting(s, p, Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS, GlobalSettingsProto.Euicc.FACTORY_RESET_TIMEOUT_MILLIS); + dumpSetting(s, p, + Settings.Global.EUICC_UNSUPPORTED_COUNTRIES, + GlobalSettingsProto.Euicc.UNSUPPORTED_COUNTRIES); p.end(euiccToken); dumpSetting(s, p,