Fix the bug TM#getNetworkCountryISO returns null in SUW.
TM#getNetworkCountryISO() will pass INVALID_PHONE_INDEX if no default
SIM is ever set, and ends up having a null phone object. Then an
empty string is returned instead of proper value from LocaleTracker#
getCurrentCountry.
Bug: 111387352
Test: TelephonyManagerTestApp. With no SIM, call TM#getNetworkCountryISO
and see the result.
Change-Id: I2bf04620d58a9610b1b2ea53be193061350d0137
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 5e1fe22..a327d88 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1716,6 +1716,10 @@
// registered cell info, so return a NULL country instead.
final long identity = Binder.clearCallingIdentity();
try {
+ if (phoneId == SubscriptionManager.INVALID_PHONE_INDEX) {
+ // Get default phone in this case.
+ phoneId = SubscriptionManager.DEFAULT_PHONE_INDEX;
+ }
final int subId = mSubscriptionController.getSubIdUsingPhoneId(phoneId);
// Todo: fix this when we can get the actual cellular network info when the device
// is on IWLAN.