Merge "Fix ArrayIndexOutOfBoundsException at RadioInfo" into main
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 8b004d9..26db4b3 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -362,6 +362,7 @@
private int mPreferredNetworkTypeResult;
private int mCellInfoRefreshRateIndex;
private int mPhoneId = SubscriptionManager.INVALID_PHONE_INDEX;
+ private static final int DEFAULT_PHONE_ID = 0;
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -584,7 +585,15 @@
mPhone = getPhone(SubscriptionManager.getDefaultSubscriptionId());
}
mSubId = SubscriptionManager.getDefaultSubscriptionId();
- mPhoneId = SubscriptionManager.getPhoneId(mSubId);
+ if (mPhone != null) {
+ mPhoneId = mPhone.getPhoneId();
+ } else {
+ mPhoneId = SubscriptionManager.getPhoneId(mSubId);
+ }
+ if (!SubscriptionManager.isValidPhoneId(mPhoneId)) {
+ mPhoneId = DEFAULT_PHONE_ID;
+ }
+
mTelephonyManager = getSystemService(TelephonyManager.class)
.createForSubscriptionId(mSubId);
mEuiccManager = getSystemService(EuiccManager.class);