[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: Ic03abd0d2706b7bb9fdc56be7906411b731b186b
This commit is contained in:
@@ -206,16 +206,23 @@ public class MobileNetworkUtils {
|
|||||||
String currentCountry = tm.getNetworkCountryIso().toLowerCase();
|
String currentCountry = tm.getNetworkCountryIso().toLowerCase();
|
||||||
String supportedCountries =
|
String supportedCountries =
|
||||||
Settings.Global.getString(cr, Settings.Global.EUICC_SUPPORTED_COUNTRIES);
|
Settings.Global.getString(cr, Settings.Global.EUICC_SUPPORTED_COUNTRIES);
|
||||||
|
final String unsupportedCountries =
|
||||||
|
Settings.Global.getString(cr, Settings.Global.EUICC_UNSUPPORTED_COUNTRIES);
|
||||||
|
|
||||||
boolean inEsimSupportedCountries = false;
|
boolean inEsimSupportedCountries = false;
|
||||||
if (TextUtils.isEmpty(currentCountry)) {
|
|
||||||
inEsimSupportedCountries = true;
|
if (TextUtils.isEmpty(supportedCountries)) {
|
||||||
} else if (!TextUtils.isEmpty(supportedCountries)) {
|
// White list is empty, use blacklist.
|
||||||
List<String> supportedCountryList =
|
Log.d(TAG, "Using blacklist unsupportedCountries=" + unsupportedCountries);
|
||||||
Arrays.asList(TextUtils.split(supportedCountries.toLowerCase(), ","));
|
inEsimSupportedCountries = !isEsimUnsupportedCountry(currentCountry,
|
||||||
if (supportedCountryList.contains(currentCountry)) {
|
unsupportedCountries);
|
||||||
inEsimSupportedCountries = true;
|
} else {
|
||||||
}
|
Log.d(TAG, "Using whitelist supportedCountries=" + supportedCountries);
|
||||||
|
inEsimSupportedCountries = isEsimSupportedCountry(currentCountry, supportedCountries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "inEsimSupportedCountries=" + inEsimSupportedCountries);
|
||||||
|
|
||||||
final boolean esimIgnoredDevice =
|
final boolean esimIgnoredDevice =
|
||||||
Arrays.asList(TextUtils.split(SystemProperties.get(KEY_ESIM_CID_IGNORE, ""), ","))
|
Arrays.asList(TextUtils.split(SystemProperties.get(KEY_ESIM_CID_IGNORE, ""), ","))
|
||||||
.contains(SystemProperties.get(KEY_CID, null));
|
.contains(SystemProperties.get(KEY_CID, null));
|
||||||
@@ -591,4 +598,24 @@ public class MobileNetworkUtils {
|
|||||||
}
|
}
|
||||||
return tm.getNetworkOperatorName();
|
return tm.getNetworkOperatorName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isEsimSupportedCountry(String country, String countriesListString) {
|
||||||
|
if (TextUtils.isEmpty(country)) {
|
||||||
|
return true;
|
||||||
|
} else if (TextUtils.isEmpty(countriesListString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final List<String> supportedCountries =
|
||||||
|
Arrays.asList(TextUtils.split(countriesListString.toLowerCase(), ","));
|
||||||
|
return supportedCountries.contains(country);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isEsimUnsupportedCountry(String country, String countriesListString) {
|
||||||
|
if (TextUtils.isEmpty(country) || TextUtils.isEmpty(countriesListString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final List<String> unsupportedCountries =
|
||||||
|
Arrays.asList(TextUtils.split(countriesListString.toLowerCase(), ","));
|
||||||
|
return unsupportedCountries.contains(country);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user