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

Commit 4aa218e7 authored by Hyunho Shin's avatar Hyunho Shin Committed by Hyunho
Browse files

Revert "Implement the domain selection of supplementary services over Ut"

This reverts commit b45853e3.

Reason for revert: UT domain selection should go back to legacy.

Change-Id: I47aea220aaec0ccfe8c29fa9effd8ea31fa7e304
parent dafe17e6
Loading
Loading
Loading
Loading
+43 −146
Original line number Diff line number Diff line
@@ -29,9 +29,6 @@ import static com.android.internal.telephony.CommandsInterface.CF_REASON_NOT_REA
import static com.android.internal.telephony.CommandsInterface.CF_REASON_NO_REPLY;
import static com.android.internal.telephony.CommandsInterface.CF_REASON_UNCONDITIONAL;
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE;
import static com.android.internal.telephony.SsDomainController.SS_CLIP;
import static com.android.internal.telephony.SsDomainController.SS_CLIR;
import static com.android.internal.telephony.SsDomainController.SS_CW;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -266,8 +263,6 @@ public class GsmCdmaPhone extends Phone {
    private boolean mResetModemOnRadioTechnologyChange = false;
    private boolean mSsOverCdmaSupported = false;

    private SsDomainController mSsDomainController;

    private int mRilVersion;
    private boolean mBroadcastEmergencyCallStateChanges = false;
    private @ServiceState.RegState int mTelecomVoiceServiceStateOverride =
@@ -386,8 +381,6 @@ public class GsmCdmaPhone extends Phone {
        subMan.addOnSubscriptionsChangedListener(
                new HandlerExecutor(this), mSubscriptionsChangedListener);

        mSsDomainController = new SsDomainController(this);

        logd("GsmCdmaPhone: constructor: sub = " + mPhoneId);
    }

@@ -1375,10 +1368,9 @@ public class GsmCdmaPhone extends Phone {
                stripSeparators(dialString));
        boolean isMmiCode = (dialPart.startsWith("*") || dialPart.startsWith("#"))
                && dialPart.endsWith("#");
        SsDomainController.SuppServiceRoutingInfo ssInfo =
                ImsPhoneMmiCode.getSuppServiceRoutingInfo(dialPart, this);
        boolean isPotentialUssdCode = isMmiCode && (ssInfo == null);
        boolean useImsForUt = ssInfo != null && ssInfo.useSsOverUt();
        boolean isSuppServiceCode = ImsPhoneMmiCode.isSuppServiceCodes(dialPart, this);
        boolean isPotentialUssdCode = isMmiCode && !isSuppServiceCode;
        boolean useImsForUt = imsPhone != null && imsPhone.isUtEnabled();
        boolean useImsForCall = useImsForCall(dialArgs)
                && (isWpsCall ? allowWpsOverIms : true);

@@ -1389,8 +1381,7 @@ public class GsmCdmaPhone extends Phone {
                    + ", useImsForEmergency=" + useImsForEmergency
                    + ", useImsForUt=" + useImsForUt
                    + ", isUt=" + isMmiCode
                    + ", isSuppServiceCode=" + (ssInfo != null)
                    + ", useSsOverUt=" + (ssInfo != null && ssInfo.useSsOverUt())
                    + ", isSuppServiceCode=" + isSuppServiceCode
                    + ", isPotentialUssdCode=" + isPotentialUssdCode
                    + ", isWpsCall=" + isWpsCall
                    + ", allowWpsOverIms=" + allowWpsOverIms
@@ -1446,10 +1437,6 @@ public class GsmCdmaPhone extends Phone {
            }
        }

        if (ssInfo != null && !ssInfo.supportsCsfb()) {
            throw new CallStateException("not support csfb for supplementary services");
        }

        if (mSST != null && mSST.mSS.getState() == ServiceState.STATE_OUT_OF_SERVICE
                && mSST.mSS.getDataRegistrationState() != ServiceState.STATE_IN_SERVICE
                && !isEmergency) {
@@ -2245,36 +2232,12 @@ public class GsmCdmaPhone extends Phone {
        mSsOverCdmaSupported = b.getBoolean(CarrierConfigManager.KEY_SUPPORT_SS_OVER_CDMA_BOOL);
    }

    private void updateSsOverUtConfig(PersistableBundle b) {
        mSsDomainController.updateSsOverUtConfig(b);
    }

    @Override
    public SsDomainController getSsDomainController() {
        return mSsDomainController;
    }

    /** Checks the static configuration for the given Call Barring service. */
    public boolean useCbOverUt(String facility) {
        return mSsDomainController.useCbOverUt(facility);
    }

    /** Checks the static configuration for the given Call Forwarding service. */
    public boolean useCfOverUt(int reason) {
        return mSsDomainController.useCfOverUt(reason);
    }

    /** Checks the static configuration for the given supplementary service. */
    public boolean useSsOverUt(String service) {
        return mSsDomainController.useSsOverUt(service);
    }

    @Override
    public boolean useSsOverUt(Message onComplete) {
    public boolean useSsOverIms(Message onComplete) {
        boolean isUtEnabled = isUtEnabled();

        Rlog.d(LOG_TAG, "useSsOverUt: isUtEnabled()= " + isUtEnabled
                + " isCsRetry(onComplete))= " + isCsRetry(onComplete));
        Rlog.d(LOG_TAG, "useSsOverIms: isUtEnabled()= " + isUtEnabled +
                " isCsRetry(onComplete))= " + isCsRetry(onComplete));

        if (isUtEnabled && !isCsRetry(onComplete)) {
            return true;
@@ -2282,24 +2245,6 @@ public class GsmCdmaPhone extends Phone {
        return false;
    }

    /**
     * Returns whether CSFB is supported for supplementary services.
     */
    public boolean supportCsfbForSs() {
        return mSsDomainController.supportCsfb();
    }

    /**
     * Sends response indicating no nework is available for supplementary services.
     */
    private void responseInvalidState(Message onComplete) {
        if (onComplete == null) return;
        AsyncResult.forMessage(onComplete, null,
                new CommandException(CommandException.Error.INVALID_STATE,
                        "No network available for supplementary services"));
        onComplete.sendToTarget();
    }

    @Override
    public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
        getCallForwardingOption(commandInterfaceCFReason,
@@ -2319,16 +2264,10 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useCfOverUt(commandInterfaceCFReason)) {
            if (useSsOverUt(onComplete)) {
                imsPhone.getCallForwardingOption(commandInterfaceCFReason,
                        serviceClass, onComplete);
                return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
        if (useSsOverIms(onComplete)) {
            imsPhone.getCallForwardingOption(commandInterfaceCFReason, serviceClass, onComplete);
            return;
        }
        }

        if (isPhoneTypeGsm()) {
            if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) {
@@ -2384,15 +2323,10 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useCfOverUt(commandInterfaceCFReason)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.setCallForwardingOption(commandInterfaceCFAction, commandInterfaceCFReason,
                    dialingNumber, serviceClass, timerSeconds, onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2451,14 +2385,9 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useCbOverUt(facility)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.getCallBarring(facility, password, onComplete, serviceClass);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2483,14 +2412,9 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useCbOverUt(facility)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.setCallBarring(facility, lockState, password, onComplete, serviceClass);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2540,14 +2464,10 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useSsOverUt(SS_CLIR)) {
            if (useSsOverUt(onComplete)) {

        if (useSsOverIms(onComplete)) {
            imsPhone.getOutgoingCallerIdDisplay(onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2572,14 +2492,9 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useSsOverUt(SS_CLIR)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode, onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2607,14 +2522,9 @@ public class GsmCdmaPhone extends Phone {
        }

        Phone imsPhone = mImsPhone;
        if (useSsOverUt(SS_CLIP)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.queryCLIP(onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2640,14 +2550,9 @@ public class GsmCdmaPhone extends Phone {
        if (mCallWaitingController.getCallWaiting(onComplete)) return;

        Phone imsPhone = mImsPhone;
        if (useSsOverUt(SS_CW)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.getCallWaiting(onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2698,14 +2603,9 @@ public class GsmCdmaPhone extends Phone {
        if (mCallWaitingController.setCallWaiting(enable, serviceClass, onComplete)) return;

        Phone imsPhone = mImsPhone;
        if (useSsOverUt(SS_CW)) {
            if (useSsOverUt(onComplete)) {
        if (useSsOverIms(onComplete)) {
            imsPhone.setCallWaiting(enable, onComplete);
            return;
            } else if (!supportCsfbForSs()) {
                responseInvalidState(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -3185,7 +3085,6 @@ public class GsmCdmaPhone extends Phone {
                updateVoNrSettings(b);
                updateSsOverCdmaSupported(b);
                loadAllowedNetworksFromSubscriptionDatabase();
                updateSsOverUtConfig(b);
                // Obtain new radio capabilities from the modem, since some are SIM-dependent
                mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));
                break;
@@ -4391,14 +4290,6 @@ public class GsmCdmaPhone extends Phone {
                        + ServiceState.rilServiceStateToString(mTelecomVoiceServiceStateOverride)
                        + ")");
        pw.flush();

        try {
            mSsDomainController.dump(pw);
        } catch (Exception e) {
            e.printStackTrace();
        }
        pw.flush();

        try {
            mCallWaitingController.dump(pw);
        } catch (Exception e) {
@@ -4701,7 +4592,13 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public boolean isUtEnabled() {
        return mSsDomainController.isUtEnabled();
        Phone imsPhone = mImsPhone;
        if (imsPhone != null) {
            return imsPhone.isUtEnabled();
        } else {
            logd("isUtEnabled: called for GsmCdma");
            return false;
        }
    }

    public String getDtmfToneDelayKey() {
+1 −11
Original line number Diff line number Diff line
@@ -4770,17 +4770,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return null;
    }

    /**
     * Returns the instance of SsDomainController
     */
    public SsDomainController getSsDomainController() {
        return null;
    }

    /**
     * Returns whether it will be served with Ut or not.
     */
    public boolean useSsOverUt(Message onComplete) {
    public boolean useSsOverIms(Message onComplete) {
        return false;
    }

+0 −590

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −15
Original line number Diff line number Diff line
@@ -1049,9 +1049,6 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                throw new RuntimeException ("Invalid or Unsupported MMI Code");
            } else if (mSc != null && mSc.equals(SC_CLIP)) {
                Rlog.d(LOG_TAG, "processCode: is CLIP");
                if (!mPhone.supportCsfbForSs()) {
                    throw new RuntimeException("No network to support supplementary services");
                }
                if (isInterrogate()) {
                    mPhone.mCi.queryCLIP(
                            obtainMessage(EVENT_QUERY_COMPLETE, this));
@@ -1060,9 +1057,6 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                }
            } else if (mSc != null && mSc.equals(SC_CLIR)) {
                Rlog.d(LOG_TAG, "processCode: is CLIR");
                if (!mPhone.supportCsfbForSs()) {
                    throw new RuntimeException("No network to support supplementary services");
                }
                if (isActivate() && !mPhone.isClirActivationAndDeactivationPrevented()) {
                    mPhone.mCi.setCLIR(CommandsInterface.CLIR_INVOCATION,
                        obtainMessage(EVENT_SET_COMPLETE, this));
@@ -1077,9 +1071,6 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                }
            } else if (isServiceCodeCallForwarding(mSc)) {
                Rlog.d(LOG_TAG, "processCode: is CF");
                if (!mPhone.supportCsfbForSs()) {
                    throw new RuntimeException("No network to support supplementary services");
                }

                String dialingNumber = mSia;
                int serviceClass = siToServiceClass(mSib);
@@ -1127,9 +1118,6 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                                    isEnableDesired, this));
                }
            } else if (isServiceCodeCallBarring(mSc)) {
                if (!mPhone.supportCsfbForSs()) {
                    throw new RuntimeException("No network to support supplementary services");
                }
                // sia = password
                // sib = basic service group

@@ -1177,9 +1165,6 @@ public final class GsmMmiCode extends Handler implements MmiCode {
                }

            } else if (mSc != null && mSc.equals(SC_WAIT)) {
                if (!mPhone.supportCsfbForSs()) {
                    throw new RuntimeException("No network to support supplementary services");
                }
                // sia = basic service group
                int serviceClass = siToServiceClass(mSia);

+28 −46
Original line number Diff line number Diff line
@@ -32,14 +32,10 @@ import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_PAC
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_PAD;
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_SMS;
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE;
import static com.android.internal.telephony.SsDomainController.SS_CLIP;
import static com.android.internal.telephony.SsDomainController.SS_CLIR;
import static com.android.internal.telephony.SsDomainController.SS_COLP;
import static com.android.internal.telephony.SsDomainController.SS_COLR;
import static com.android.internal.telephony.SsDomainController.SS_CW;

import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.Resources;
import android.os.AsyncResult;
import android.os.Build;
import android.os.Handler;
@@ -67,7 +63,6 @@ import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.SsDomainController;
import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.telephony.Rlog;
@@ -493,12 +488,17 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {

    static boolean
    isServiceCodeCallBarring(String sc) {
        return sc != null
                && (sc.equals(SC_BAOC)
                || sc.equals(SC_BAOIC) || sc.equals(SC_BAOICxH)
                || sc.equals(SC_BAIC) || sc.equals(SC_BAICr)
                || sc.equals(SC_BA_ALL) || sc.equals(SC_BA_MO)
                || sc.equals(SC_BA_MT));
        Resources resource = Resources.getSystem();
        if (sc != null) {
            String[] barringMMI = resource.getStringArray(
                com.android.internal.R.array.config_callBarringMMI_for_ims);
            if (barringMMI != null) {
                for (String match : barringMMI) {
                    if (sc.equals(match)) return true;
                }
            }
        }
        return false;
    }

    static boolean isPinPukCommand(String sc) {
@@ -510,11 +510,9 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
     * Whether the dial string is supplementary service code.
     *
     * @param dialString The dial string.
     * @return an instance of SsDomainController.SuppServiceRoutingInfo if the dial string
     * is supplementary service code, and null otherwise.
     * @return true if the dial string is supplementary service code, and {@code false} otherwise.
     */
    public static SsDomainController.SuppServiceRoutingInfo getSuppServiceRoutingInfo(
            String dialString, Phone phone) {
    public static boolean isSuppServiceCodes(String dialString, Phone phone) {
        if (phone != null && phone.getServiceState().getVoiceRoaming()
                && phone.getDefaultPhone().supportsConversionOfCdmaCallerIdMmiCodesWhileRoaming()) {
            /* The CDMA MMI coded dialString will be converted to a 3GPP MMI Coded dialString
@@ -523,54 +521,38 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
            dialString = convertCdmaMmiCodesTo3gppMmiCodes(dialString);
        }

        if (phone == null) return null;
        return getSuppServiceRoutingInfo(dialString, phone.getSsDomainController());
    }

    /**
     * Whether the dial string is supplementary service code.
     */
    @VisibleForTesting
    public static SsDomainController.SuppServiceRoutingInfo getSuppServiceRoutingInfo(
            String dialString, SsDomainController controller) {
        Matcher m = sPatternSuppService.matcher(dialString);
        if (m.matches()) {
            String sc = makeEmptyNull(m.group(MATCH_GROUP_SERVICE_CODE));
            if (isServiceCodeCallForwarding(sc)) {
                return controller.getSuppServiceRoutingInfoForCf(scToCallForwardReason(sc));
                return true;
            } else if (isServiceCodeCallBarring(sc)) {
                return controller.getSuppServiceRoutingInfoForCb(scToBarringFacility(sc));
                return true;
            } else if (sc != null && sc.equals(SC_CFUT)) {
                // for backward compatibility, not specified by CarrierConfig
                return SsDomainController.SS_ROUTING_OVER_UT;
                return true;
            } else if (sc != null && sc.equals(SC_CLIP)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_CLIP);
                return true;
            } else if (sc != null && sc.equals(SC_CLIR)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_CLIR);
                return true;
            } else if (sc != null && sc.equals(SC_COLP)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_COLP);
                return true;
            } else if (sc != null && sc.equals(SC_COLR)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_COLR);
                return true;
            } else if (sc != null && sc.equals(SC_CNAP)) {
                // for backward compatibility, not specified by CarrierConfig
                return SsDomainController.SS_ROUTING_OVER_UT;
                return true;
            } else if (sc != null && sc.equals(SC_BS_MT)) {
                return controller.getSuppServiceRoutingInfoForCb(
                        SsDomainController.CB_FACILITY_BIL);
                return true;
            } else if (sc != null && sc.equals(SC_BAICa)) {
                return controller.getSuppServiceRoutingInfoForCb(
                        SsDomainController.CB_FACILITY_ACR);
                return true;
            } else if (sc != null && sc.equals(SC_PWD)) {
                // for backward compatibility, not specified by CarrierConfig
                return SsDomainController.SS_ROUTING_OVER_UT;
                return true;
            } else if (sc != null && sc.equals(SC_WAIT)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_CW);
                return true;
            } else if (isPinPukCommand(sc)) {
                // for backward compatibility, not specified by CarrierConfig
                return SsDomainController.SS_ROUTING_OVER_UT;
                return true;
            }
        }
        return null;
        return false;
    }

    static String
Loading