OSDN Git Service

Move getNetworkCountryIso impl from TM to PIM.
authorJonathan Basseri <misterikkit@google.com>
Wed, 19 Jul 2017 20:44:31 +0000 (13:44 -0700)
committerNathan Harold <nharold@google.com>
Thu, 3 Aug 2017 21:16:02 +0000 (14:16 -0700)
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
Change-Id: I541b445b410329798acdaaaccc50955cd1574ae2
(cherry picked from commit 83c25b8ce17c3ce387d87d5f36182645e686540e)

telephony/java/android/telephony/TelephonyManager.java
telephony/java/com/android/internal/telephony/ITelephony.aidl

index 2e7b19a..1544218 100644 (file)
@@ -1654,8 +1654,7 @@ public class TelephonyManager {
      * @hide
      */
     public String getNetworkCountryIso(int subId) {
-        int phoneId = SubscriptionManager.getPhoneId(subId);
-        return getNetworkCountryIsoForPhone(phoneId);
+        return getNetworkCountryIsoForPhone(getPhoneId(subId));
     }
 
     /**
@@ -1670,7 +1669,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 */
index a0e5b7b..654adb2 100644 (file)
@@ -377,6 +377,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.
      */
     List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);