Merge "Replace getPhoneCount with getMaxPhoneCount upon object allocation."
am: c084de230e
Change-Id: I7c5180045b6ae33d0d03b4ed7623487d25cacfec
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index c69f1a4..392ab6e 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -194,7 +194,7 @@
case EVENT_SYSTEM_UNLOCKED:
{
- for (int i = 0; i < TelephonyManager.from(mContext).getPhoneCount(); ++i) {
+ for (int i = 0; i < TelephonyManager.from(mContext).getMaxPhoneCount(); ++i) {
// When user unlock device, we should only try to send broadcast again if we
// have sent it before unlock. This will avoid we try to load carrier config
// when SIM is still loading when unlock happens.
@@ -211,7 +211,7 @@
// Only update if there are cached config removed to avoid updating config for
// unrelated packages.
if (clearCachedConfigForPackage(carrierPackageName)) {
- int numPhones = TelephonyManager.from(mContext).getPhoneCount();
+ int numPhones = TelephonyManager.from(mContext).getMaxPhoneCount();
for (int i = 0; i < numPhones; ++i) {
updateConfigForPhoneId(i);
}
@@ -523,7 +523,7 @@
pkgFilter.addDataScheme("package");
context.registerReceiver(mPackageReceiver, pkgFilter);
- int numPhones = TelephonyManager.from(context).getPhoneCount();
+ int numPhones = TelephonyManager.from(context).getMaxPhoneCount();
mConfigFromDefaultApp = new PersistableBundle[numPhones];
mConfigFromCarrierApp = new PersistableBundle[numPhones];
mOverrideConfigs = new PersistableBundle[numPhones];
diff --git a/src/com/android/services/telephony/RadioOnHelper.java b/src/com/android/services/telephony/RadioOnHelper.java
index 288c72c..85f94ab 100644
--- a/src/com/android/services/telephony/RadioOnHelper.java
+++ b/src/com/android/services/telephony/RadioOnHelper.java
@@ -53,7 +53,7 @@
return;
}
mListeners = new ArrayList<>(2);
- for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
+ for (int i = 0; i < TelephonyManager.getDefault().getMaxPhoneCount(); i++) {
mListeners.add(new RadioOnStateListener());
}
}
@@ -76,7 +76,7 @@
mCallback = callback;
mInProgressListeners.clear();
mIsRadioOnCallingEnabled = false;
- for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
+ for (int i = 0; i < TelephonyManager.getDefault().getMaxPhoneCount(); i++) {
Phone phone = PhoneFactory.getPhone(i);
if (phone == null) {
continue;