Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb4e0bd0 authored by Zoey Chen's avatar Zoey Chen
Browse files

[Settings] Should not show WFC UI in the SIM page if the SIM does not

support WFC

Bug: 270792637
Test: manual
Change-Id: Ic67bd2e766d66c91fc4b0fcf5a5355debd805ac6
parent ce77de42
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -949,7 +949,12 @@ public class MobileNetworkUtils {
        boolean isWifiCallingEnabled;
        if (phoneAccountHandle != null) {
            final Intent intent = buildPhoneAccountConfigureIntent(context, phoneAccountHandle);
            isWifiCallingEnabled = intent != null;
            if (intent == null) {
                Log.d(TAG, "Can not get phoneAccount configure intent.");
                isWifiCallingEnabled = false;
            } else {
                isWifiCallingEnabled = true;
            }
        } else {
            if (queryImsState == null) {
                queryImsState = new WifiCallingQueryImsState(context, subId);
@@ -959,7 +964,6 @@ public class MobileNetworkUtils {
        return isWifiCallingEnabled;
    }


    /**
     * Returns preferred status of Calls & SMS separately when Provider Model is enabled.
     */
+2 −18
Original line number Diff line number Diff line
@@ -314,29 +314,13 @@ public class NetworkProviderWifiCallingGroup extends
    @VisibleForTesting
    protected boolean shouldShowWifiCallingForSub(int subId) {
        if (SubscriptionManager.isValidSubscriptionId(subId)
                && MobileNetworkUtils.isWifiCallingEnabled(
                mContext, subId, queryImsState(subId),
                getPhoneAccountHandleForSubscriptionId(subId))
                && isWifiCallingAvailableForCarrier(subId)) {
                && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId),
                null)) {
            return true;
        }
        return false;
    }

    private boolean isWifiCallingAvailableForCarrier(int subId) {
        boolean isWifiCallingAvailableForCarrier = false;
        if (mCarrierConfigManager != null) {
            final PersistableBundle carrierConfig =
                    mCarrierConfigManager.getConfigForSubId(subId);
            if (carrierConfig != null) {
                isWifiCallingAvailableForCarrier = carrierConfig.getBoolean(
                        CarrierConfigManager.KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL);
            }
        }
        Log.d(TAG, "isWifiCallingAvailableForCarrier:" + isWifiCallingAvailableForCarrier);
        return isWifiCallingAvailableForCarrier;
    }

    @Override
    public String getPreferenceKey() {
        return KEY_PREFERENCE_WIFICALLING_GROUP;
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.provider.Settings;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
+2 −1
Original line number Diff line number Diff line
@@ -257,7 +257,8 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
        for (SubscriptionInfo subInfo : subInfoList) {
            int subId = subInfo.getSubscriptionId();
            try {
                if (queryImsState(subId).isWifiCallingProvisioned()) {
                if (MobileNetworkUtils.isWifiCallingEnabled(getContext(), subId,
                        queryImsState(subId), null)) {
                    selectedList.add(subInfo);
                }
            } catch (Exception exception) {}