diff options
| author | 2018-04-13 14:05:32 -0700 | |
|---|---|---|
| committer | 2018-04-22 14:19:59 -0700 | |
| commit | d33f8a1e91fc207c01f8a05c42f06c85758faddb (patch) | |
| tree | 33e2b61f9ae54d4a7725b4c93f7a1b0724e2ed32 | |
| parent | 03cdc95f1cc040a0f148fc398b953e6ab25f7c8f (diff) | |
Set country code even when device is not registered on network
Extends the functionality of getNetworkCountryIso to support
no SIM/no service case. When no SIM/no service, it returns
the country code of nearby network (unregistered but cell info
is available to the device).
Test: Manual
Bug: 64335394
Merged-In: Ia32cbc9df9b9adf5d7c24c8b90be20063a94a514
Change-Id: Ia32cbc9df9b9adf5d7c24c8b90be20063a94a514
(cherry picked from commit ac36896f1aa90ef21cd23bd213674a01f68f48d3)
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 9de18ff2a4c2..f846762fabd7 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1810,24 +1810,23 @@ public class TelephonyManager { } /** - * Returns the ISO country code equivalent of the current registered - * operator's MCC (Mobile Country Code). + * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current + * registered operator, or nearby cell information if not registered. + * . * <p> - * Availability: Only when user is registered to a network. Result may be - * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if - * on a CDMA network). + * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine + * if on a CDMA network). */ public String getNetworkCountryIso() { return getNetworkCountryIsoForPhone(getPhoneId()); } /** - * Returns the ISO country code equivalent of the current registered - * operator's MCC (Mobile Country Code) of a subscription. + * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current + * registered operator, or nearby cell information if not registered. * <p> - * Availability: Only when user is registered to a network. Result may be - * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if - * on a CDMA network). + * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine + * if on a CDMA network). * * @param subId for which Network CountryIso is returned * @hide @@ -7028,31 +7027,6 @@ public class TelephonyManager { } /** - * Set the ISO country code equivalent of the current registered - * operator's MCC (Mobile Country Code). - * @param iso the ISO country code equivalent of the current registered - * @hide - */ - public void setNetworkCountryIso(String iso) { - int phoneId = getPhoneId(); - setNetworkCountryIsoForPhone(phoneId, iso); - } - - /** - * Set the ISO country code equivalent of the current registered - * operator's MCC (Mobile Country Code). - * @param phoneId which phone you want to set - * @param iso the ISO country code equivalent of the current registered - * @hide - */ - public void setNetworkCountryIsoForPhone(int phoneId, String iso) { - if (SubscriptionManager.isValidPhoneId(phoneId)) { - setTelephonyProperty(phoneId, - TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso); - } - } - - /** * Set the network type currently in use on the device for data transmission. * * If this object has been created with {@link #createForSubscriptionId}, applies to the |