Merge "Modify Settings to use new SIM call manager API" into qt-dev
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index ffb7292..e6fa00a 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -398,7 +398,8 @@
prefSet.removePreference(mEnableVideoCalling);
}
- final PhoneAccountHandle simCallManager = mTelecomManager.getSimCallManager();
+ final PhoneAccountHandle simCallManager = mTelecomManager.getSimCallManagerForSubscription(
+ mPhone.getSubId());
if (simCallManager != null) {
Intent intent = PhoneAccountSettingsFragment.buildPhoneAccountConfigureIntent(
this, simCallManager);
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index c123e66..e67758d 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -149,12 +149,17 @@
/**
- * Returns true if Wifi calling is enabled for at least one phone.
+ * Returns true if Wifi calling is enabled for at least one subscription.
*/
public static boolean isWifiCallingEnabled(Context context) {
- int phoneCount = TelephonyManager.from(context).getPhoneCount();
- for (int i = 0; i < phoneCount; i++) {
- if (isWifiCallingEnabled(context, i)) {
+ SubscriptionManager subManager = context.getSystemService(SubscriptionManager.class);
+ if (subManager == null) {
+ Log.e(MobileNetworkFragment.LOG_TAG,
+ "isWifiCallingEnabled: couldn't get system service.");
+ return false;
+ }
+ for (int subId : subManager.getActiveSubscriptionIdList()) {
+ if (isWifiCallingEnabled(context, subId)) {
return true;
}
}
@@ -162,11 +167,12 @@
}
/**
- * Returns true if Wifi calling is enabled for the specific phone with id {@code phoneId}.
+ * Returns true if Wifi calling is enabled for the specific subscription with id {@code subId}.
*/
- public static boolean isWifiCallingEnabled(Context context, int phoneId) {
+ public static boolean isWifiCallingEnabled(Context context, int subId) {
final PhoneAccountHandle simCallManager =
- TelecomManager.from(context).getSimCallManager();
+ TelecomManager.from(context).getSimCallManagerForSubscription(subId);
+ final int phoneId = SubscriptionManager.getSlotIndex(subId);
boolean isWifiCallingEnabled;
if (simCallManager != null) {
@@ -1890,14 +1896,14 @@
}
// Removes the preference if the wifi calling is disabled.
- if (!isWifiCallingEnabled(getContext(), SubscriptionManager.getPhoneId(mSubId))) {
+ if (!isWifiCallingEnabled(getContext(), mSubId)) {
mCallingCategory.removePreference(mWiFiCallingPref);
return;
}
// See what Telecom thinks the SIM call manager is.
final PhoneAccountHandle simCallManager =
- TelecomManager.from(getContext()).getSimCallManager();
+ TelecomManager.from(getContext()).getSimCallManagerForSubscription(mSubId);
// Check which SIM call manager is for the current sub ID.
PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);