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

Commit 17c973f4 authored by Brad Ebinger's avatar Brad Ebinger Committed by Automerger Merge Worker
Browse files

Merge "re-arrange dial interface to support emergency silent redial" am: d77c2b83

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1261522

Change-Id: I4c61be14c93772fcc7f4ebb0b2852b6b867e0b03
parents 6c76032c d77c2b83
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -593,6 +593,20 @@ public abstract class Connection {
        }
    }

    /**
     * Set the non-detectable emergency number information.
     */
    public void setNonDetectableEmergencyCallInfo(int eccCategory) {
        if (!mIsEmergencyCall) {
            mIsEmergencyCall = true;
            mEmergencyNumberInfo = new EmergencyNumber(mAddress, ""/*countryIso*/,
                                    ""/*mnc*/, eccCategory,
                                    new ArrayList<String>(),
                                    EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING,
                                    EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN);
        }
    }

    /**
     * Set if we have known the user's intent for the call is emergency.
     *
+45 −20
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.util.EventLog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.PhoneInternalInterface.DialArgs;
import com.android.telephony.Rlog;

import java.io.FileDescriptor;
@@ -275,16 +276,17 @@ public class GsmCdmaCallTracker extends CallTracker {
    /**
     * clirMode is one of the CLIR_ constants
     */
    public synchronized Connection dialGsm(String dialString, int clirMode, UUSInfo uusInfo,
                                        Bundle intentExtras)
    public synchronized Connection dialGsm(String dialString, DialArgs dialArgs)
            throws CallStateException {
        int clirMode = dialArgs.clirMode;
        UUSInfo uusInfo = dialArgs.uusInfo;
        Bundle intentExtras = dialArgs.intentExtras;
        boolean isEmergencyCall = dialArgs.isEmergency;

        // note that this triggers call state changed notif
        clearDisconnected();

        // Check for issues which would preclude dialing and throw a CallStateException.
        TelephonyManager tm =
                (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE);
        boolean isEmergencyCall = tm.isEmergencyNumber(dialString);
        checkForDialIssues(isEmergencyCall);

        String origNumber = dialString;
@@ -322,7 +324,8 @@ public class GsmCdmaCallTracker extends CallTracker {
        }

        mPendingMO = new GsmCdmaConnection(mPhone, dialString, this, mForegroundCall,
                isEmergencyCall);
                dialArgs);

        if (intentExtras != null) {
            Rlog.d(LOG_TAG, "dialGsm - emergency dialer: " + intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
@@ -396,18 +399,20 @@ public class GsmCdmaCallTracker extends CallTracker {
    /**
     * clirMode is one of the CLIR_ constants
     */
    private Connection dialCdma(String dialString, int clirMode, Bundle intentExtras)
    private Connection dialCdma(String dialString, DialArgs dialArgs)
            throws CallStateException {
        int clirMode = dialArgs.clirMode;
        Bundle intentExtras = dialArgs.intentExtras;
        boolean isEmergencyCall = dialArgs.isEmergency;

        // note that this triggers call state changed notif
        clearDisconnected();

        TelephonyManager tm =
                (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE);
        boolean isEmergencyCall = tm.isEmergencyNumber(dialString);

        // Check for issues which would preclude dialing and throw a CallStateException.
        checkForDialIssues(isEmergencyCall);

        TelephonyManager tm =
                (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE);
        String origNumber = dialString;
        String operatorIsoContry = tm.getNetworkCountryIso(mPhone.getPhoneId());
        String simIsoContry = tm.getSimCountryIsoForPhone(mPhone.getPhoneId());
@@ -436,11 +441,12 @@ public class GsmCdmaCallTracker extends CallTracker {
        // That call must be idle, so place anything that's
        // there on hold
        if (mForegroundCall.getState() == GsmCdmaCall.State.ACTIVE) {
            return dialThreeWay(dialString, intentExtras);
            return dialThreeWay(dialString, dialArgs);
        }

        mPendingMO = new GsmCdmaConnection(mPhone, dialString, this, mForegroundCall,
                isEmergencyCall);
                dialArgs);

        if (intentExtras != null) {
            Rlog.d(LOG_TAG, "dialGsm - emergency dialer: " + intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
@@ -490,14 +496,16 @@ public class GsmCdmaCallTracker extends CallTracker {
    }

    //CDMA
    private Connection dialThreeWay(String dialString, Bundle intentExtras) {
    private Connection dialThreeWay(String dialString, DialArgs dialArgs) {
        Bundle intentExtras = dialArgs.intentExtras;

        if (!mForegroundCall.isIdle()) {
            // Check data call and possibly set mIsInEmergencyCall
            disableDataCallInEmergencyCall(dialString);

            // Attach the new connection to foregroundCall
            mPendingMO = new GsmCdmaConnection(mPhone, dialString, this, mForegroundCall,
                    mIsInEmergencyCall);
                    dialArgs);
            if (intentExtras != null) {
                Rlog.d(LOG_TAG, "dialThreeWay - emergency dialer " + intentExtras.getBoolean(
                        TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
@@ -526,24 +534,41 @@ public class GsmCdmaCallTracker extends CallTracker {
        return null;
    }

    public Connection dial(String dialString, Bundle intentExtras) throws CallStateException {
    public Connection dial(String dialString, DialArgs dialArgs) throws CallStateException {
        if (isPhoneTypeGsm()) {
            return dialGsm(dialString, CommandsInterface.CLIR_DEFAULT, intentExtras);
            return dialGsm(dialString, dialArgs);
        } else {
            return dialCdma(dialString, CommandsInterface.CLIR_DEFAULT, intentExtras);
            return dialCdma(dialString, dialArgs);
        }
    }

    //GSM
    public Connection dialGsm(String dialString, UUSInfo uusInfo, Bundle intentExtras)
            throws CallStateException {
        return dialGsm(dialString, CommandsInterface.CLIR_DEFAULT, uusInfo, intentExtras);
        return dialGsm(dialString, new DialArgs.Builder<>()
                        .setUusInfo(uusInfo)
                        .setClirMode(CommandsInterface.CLIR_DEFAULT)
                        .setIntentExtras(intentExtras)
                        .build());
    }

    //GSM
    private Connection dialGsm(String dialString, int clirMode, Bundle intentExtras)
            throws CallStateException {
        return dialGsm(dialString, clirMode, null, intentExtras);
        return dialGsm(dialString, new DialArgs.Builder<>()
                        .setClirMode(clirMode)
                        .setIntentExtras(intentExtras)
                        .build());
    }

    //GSM
    public Connection dialGsm(String dialString, int clirMode, UUSInfo uusInfo, Bundle intentExtras)
             throws CallStateException {
        return dialGsm(dialString, new DialArgs.Builder<>()
                        .setClirMode(clirMode)
                        .setUusInfo(uusInfo)
                        .setIntentExtras(intentExtras)
                        .build());
    }

    public void acceptCall() throws CallStateException {
+11 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.PersistableBundle;
import android.os.PowerManager;
import android.os.Registrant;
import android.os.SystemClock;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.CarrierConfigManager;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
@@ -38,6 +39,7 @@ import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.PhoneInternalInterface.DialArgs;
import com.android.telephony.Rlog;

/**
@@ -158,7 +160,7 @@ public class GsmCdmaConnection extends Connection {

    /** This is an MO call, created when dialing */
    public GsmCdmaConnection (GsmCdmaPhone phone, String dialString, GsmCdmaCallTracker ct,
                              GsmCdmaCall parent, boolean isEmergencyCall) {
                              GsmCdmaCall parent, DialArgs dialArgs) {
        super(phone.getPhoneType());
        createWakeLock(phone.getContext());
        acquireWakeLock();
@@ -177,8 +179,15 @@ public class GsmCdmaConnection extends Connection {
        }

        mAddress = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
        if (isEmergencyCall) {
        if (dialArgs.isEmergency) {
            setEmergencyCallInfo(mOwner);

            // There was no emergency number info found for this call, however it is
            // still marked as an emergency number. This may happen if it was a redialed
            // non-detectable emergency call from IMS.
            if (getEmergencyNumberInfo() == null) {
                setNonDetectableEmergencyCallInfo(dialArgs.eccCategory);
            }
        }

        mPostDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
+10 −10
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ import com.android.internal.telephony.dataconnection.TransportManager;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
import com.android.internal.telephony.imsphone.ImsPhoneMmiCode;
import com.android.internal.telephony.metrics.VoiceCallSessionStats;
@@ -1328,8 +1329,12 @@ public class GsmCdmaPhone extends Phone {
        }
        TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
        boolean isEmergency = tm.isEmergencyNumber(dialString);
        ImsPhone.ImsDialArgs.Builder imsDialArgsBuilder;
        imsDialArgsBuilder = ImsPhone.ImsDialArgs.Builder.from(dialArgs)
                                                 .setIsEmergency(isEmergency);
        mDialArgs = dialArgs = imsDialArgsBuilder.build();

        Phone imsPhone = mImsPhone;
        mDialArgs = dialArgs;

        CarrierConfigManager configManager =
                (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -1442,14 +1447,9 @@ public class GsmCdmaPhone extends Phone {
            mIsTestingEmergencyCallbackMode = true;
            mCi.testingEmergencyCall();
        }
        if (isPhoneTypeGsm()) {
            return dialInternal(dialString, new DialArgs.Builder<>()
                    .setIntentExtras(dialArgs.intentExtras)
                    .build());
        } else {

        return dialInternal(dialString, dialArgs);
    }
    }

    /**
     * @return {@code true} if the user should be informed of an attempt to dial an international
@@ -1514,7 +1514,7 @@ public class GsmCdmaPhone extends Phone {
            if (DBG) logd("dialInternal: dialing w/ mmi '" + mmi + "'...");

            if (mmi == null) {
                return mCT.dialGsm(newDialString, dialArgs.uusInfo, dialArgs.intentExtras);
                return mCT.dialGsm(newDialString, dialArgs);
            } else if (mmi.isTemporaryModeCLIR()) {
                return mCT.dialGsm(mmi.mDialingNumber, mmi.getCLIRMode(), dialArgs.uusInfo,
                        dialArgs.intentExtras);
@@ -1525,7 +1525,7 @@ public class GsmCdmaPhone extends Phone {
                return null;
            }
        } else {
            return mCT.dial(newDialString, dialArgs.intentExtras);
            return mCT.dial(newDialString, dialArgs);
        }
    }

+5 −2
Original line number Diff line number Diff line
@@ -712,10 +712,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                Rlog.d(LOG_TAG, "Event EVENT_INITIATE_SILENT_REDIAL Received");
                ar = (AsyncResult) msg.obj;
                if ((ar.exception == null) && (ar.result != null)) {
                    String dialString = (String) ar.result;
                    SilentRedialParam result = (SilentRedialParam) ar.result;
                    String dialString = result.dialString;
                    int causeCode = result.causeCode;
                    DialArgs dialArgs = result.dialArgs;
                    if (TextUtils.isEmpty(dialString)) return;
                    try {
                        Connection cn = dialInternal(dialString, new DialArgs.Builder().build());
                        Connection cn = dialInternal(dialString, dialArgs);
                        Rlog.d(LOG_TAG, "Notify redial connection changed cn: " + cn);
                        if (mImsPhone != null) {
                            // Don't care it is null or not.
Loading