From 6442cc90b5a87658c9e78559042a9ad263319049 Mon Sep 17 00:00:00 2001 From: Jonathan Basseri Date: Wed, 19 Jul 2017 13:44:31 -0700 Subject: [PATCH] Move getNetworkCountryIso impl from TM to PIM. This moves the implementation of getNetworkCountryIso from TelephonyManager into PhoneInterfaceManager so that we can perform an additional IWLAN check. Bug: 63050313 Test: no compilation errors Merged-In: I64f31d111213281edeaeda6a09b163b860261b2d Change-Id: I541b445b410329798acdaaaccc50955cd1574ae2 --- .../java/android/telephony/TelephonyManager.java | 12 +++++++++--- .../com/android/internal/telephony/ITelephony.aidl | 7 +++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b5b32e454ab9b..190361bd59cdc 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1642,8 +1642,7 @@ public class TelephonyManager { * @hide */ public String getNetworkCountryIso(int subId) { - int phoneId = SubscriptionManager.getPhoneId(subId); - return getNetworkCountryIsoForPhone(phoneId); + return getNetworkCountryIsoForPhone(getPhoneId(subId)); } /** @@ -1658,7 +1657,14 @@ public class TelephonyManager { */ /** {@hide} */ public String getNetworkCountryIsoForPhone(int phoneId) { - return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); + try { + ITelephony telephony = getITelephony(); + if (telephony == null) + return ""; + return telephony.getNetworkCountryIsoForPhone(phoneId); + } catch (RemoteException ex) { + return ""; + } } /** Network type is unknown */ diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index a0e5b7b0a1d6b..654adb280310e 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -376,6 +376,13 @@ interface ITelephony { Bundle getCellLocation(String callingPkg); + /** + * Returns the ISO country code equivalent of the current registered + * operator's MCC (Mobile Country Code). + * @see android.telephony.TelephonyManager#getNetworkCountryIso + */ + String getNetworkCountryIsoForPhone(int phoneId); + /** * Returns the neighboring cell information of the device. */