[Settings] Change API for backup calling supporting status

Change API for detecting backup calling supporting status.

Bug: 182326102
Test: local
Change-Id: I4bda5f518e042ba23f48cddd3b4c8baebc5e2330
This commit is contained in:
Bonian Chen
2021-06-02 22:06:42 +08:00
parent bbab97c955
commit 6546d68217

View File

@@ -31,6 +31,7 @@ import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.network.ims.WifiCallingQueryImsState;
import java.util.List;
import java.util.Objects;
@@ -147,16 +148,20 @@ public class BackupCallingPreferenceController extends TelephonyTogglePreference
}
private boolean hasBackupCallingFeature(int subscriptionId) {
PersistableBundle carrierConfig = getCarrierConfigForSubId(subscriptionId);
Boolean featureEnableStatus = null;
if (carrierConfig != null) {
featureEnableStatus = carrierConfig.getBoolean(
CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, false);
return isCrossSimEnabledByPlatform(mContext, subscriptionId);
}
// TODO: remove log after fixing b/182326102
Log.d(LOG_TAG, "config " + CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL
+ "=" + featureEnableStatus + " for subId=" + subscriptionId);
return (featureEnableStatus != null) && featureEnableStatus.booleanValue();
protected boolean isCrossSimEnabledByPlatform(Context context, int subscriptionId) {
// TODO : Change into API which created for accessing
// com.android.ims.ImsManager#isCrossSimEnabledByPlatform()
if ((new WifiCallingQueryImsState(context, subscriptionId)).isWifiCallingSupported()) {
PersistableBundle bundle = getCarrierConfigForSubId(subscriptionId);
return (bundle != null) && bundle.getBoolean(
CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL,
false /*default*/);
}
Log.d(LOG_TAG, "Not supported by framework. subId = " + subscriptionId);
return false;
}
private ImsMmTelManager getImsMmTelManager(int subId) {