From a2618627f06f7730670060c455ed3904280bc78b Mon Sep 17 00:00:00 2001 From: chen xu Date: Sun, 2 Dec 2018 14:14:15 -0800 Subject: [PATCH] support per carrier based iso country code. 1. apply carrierid-to-countrycode as an override table on top of mcc-to-countrycode table which is coarse and inaccurate especailly for dual ISMI SIM 2. persist country iso to simInfo db and notify change through public API onSubscriptionChangedListener Bug: 64775297 Bug: 110559381 Test: Build Change-Id: I3ec2d90d9ce8dfba1418358de62eb4d099234757 --- .../telephony/CarrierConfigManager.java | 42 ++++++++++++------- .../telephony/SubscriptionManager.java | 7 ++++ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 45303e0e16c73..a0064e2501361 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1154,20 +1154,33 @@ public class CarrierConfigManager { */ public static final String KEY_CARRIER_NAME_STRING = "carrier_name_string"; - /** - * The Component Name of a carrier-provided CallScreeningService implementation. Telecom will - * bind to {@link android.telecom.CallScreeningService} for ALL incoming calls and provide - * the carrier - * CallScreeningService with the opportunity to allow or block calls. - *

- * The String includes the package name/the class name. - * Example: - * com.android.carrier/com.android.carrier.callscreeningserviceimpl - *

- * Using {@link ComponentName#flattenToString()} to convert a ComponentName object to String. - * Using {@link ComponentName#unflattenFromString(String)} to convert a String object to a - * ComponentName. - */ + /** + * String to override sim country iso. + * Sim country iso is based on sim MCC which is coarse and doesn't work with dual IMSI SIM where + * a SIM can have multiple MCC from different countries. + * Instead, each sim carrier should have a single country code, apply per carrier based iso + * code as an override. The overridden value can be read from + * {@link TelephonyManager#getSimCountryIso()} and {@link SubscriptionInfo#getCountryIso()} + * + * @hide + */ + public static final String KEY_SIM_COUNTRY_ISO_OVERRIDE_STRING = + "sim_country_iso_override_string"; + + /** + * The Component Name of a carrier-provided CallScreeningService implementation. Telecom will + * bind to {@link android.telecom.CallScreeningService} for ALL incoming calls and provide + * the carrier + * CallScreeningService with the opportunity to allow or block calls. + *

+ * The String includes the package name/the class name. + * Example: + * com.android.carrier/com.android.carrier.callscreeningserviceimpl + *

+ * Using {@link ComponentName#flattenToString()} to convert a ComponentName object to String. + * Using {@link ComponentName#unflattenFromString(String)} to convert a String object to a + * ComponentName. + */ public static final String KEY_CARRIER_CALL_SCREENING_APP_STRING = "call_screening_app"; /** @@ -2495,6 +2508,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CONFIG_WIFI_DISABLE_IN_ECBM, false); sDefaults.putBoolean(KEY_CARRIER_NAME_OVERRIDE_BOOL, false); sDefaults.putString(KEY_CARRIER_NAME_STRING, ""); + sDefaults.putString(KEY_SIM_COUNTRY_ISO_OVERRIDE_STRING, ""); sDefaults.putString(KEY_CARRIER_CALL_SCREENING_APP_STRING, ""); sDefaults.putBoolean(KEY_CDMA_HOME_REGISTERED_PLMN_NAME_OVERRIDE_BOOL, false); sDefaults.putString(KEY_CDMA_HOME_REGISTERED_PLMN_NAME_STRING, ""); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 6fbc25d0de8a4..ff20fd23b0c1d 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -406,6 +406,13 @@ public class SubscriptionManager { */ public static final String MNC = "mnc"; + /** + * TelephonyProvider column name for the iso country code associated with a SIM. + *

Type: TEXT (String)

+ * @hide + */ + public static final String ISO_COUNTRY_CODE = "iso_country_code"; + /** * TelephonyProvider column name for the sim provisioning status associated with a SIM. *

Type: INTEGER (int)