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

Commit 3f2e12c8 authored by Shuo Qian's avatar Shuo Qian Committed by android-build-merger
Browse files

Merge "Populate 'hasKnownUserIntentEmergency' in RIL framework"

am: 534f9a52

Change-Id: Idc6c6d20f7bf01ce56f6b3f9cc6c5077da5ea75f
parents 6dc337fb 534f9a52
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -827,7 +827,7 @@ public interface CommandsInterface {
     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
     */
    void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo,
              int clirMode, Message result);
              boolean hasKnownUserIntentEmergency, int clirMode, Message result);

    /**
     *  returned message
@@ -841,7 +841,7 @@ public interface CommandsInterface {
     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
     */
    void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo,
              int clirMode, UUSInfo uusInfo, Message result);
              boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo, Message result);

    /**
     *  returned message
+35 −1
Original line number Diff line number Diff line
@@ -237,6 +237,12 @@ public abstract class Connection {
     */
    private EmergencyNumber mEmergencyNumberInfo;

    /**
     * Whether the call is from emergency dialer, only valid if {@link #isEmergencyCall} returns
     * {@code true}.
     */
    private boolean mHasKnownUserIntentEmergency;

    /**
     * When {@code true}, the network has indicated that this is an emergency call.
     */
@@ -464,7 +470,21 @@ public abstract class Connection {
    }

    /**
     * Set the emergency numbe information if it is an emergency call.
     * Checks if we have known the user's intent for the call is emergency.
     *
     * This is only used to specify when the dialed number is ambiguous, identified as both
     * emergency number and any other non-emergency number; e.g. in some situation, 611 could
     * be both an emergency number in a country and a non-emergency number of a carrier's
     * customer service hotline.
     *
     * @return whether the call is from emergency dialer
     */
    public boolean hasKnownUserIntentEmergency() {
        return mHasKnownUserIntentEmergency;
    }

    /**
     * Set the emergency number information if it is an emergency call.
     *
     * @hide
     */
@@ -485,6 +505,20 @@ public abstract class Connection {
        }
    }

    /**
     * Set if we have known the user's intent for the call is emergency.
     *
     * This is only used to specify when the dialed number is ambiguous, identified as both
     * emergency number and any other non-emergency number; e.g. in some situation, 611 could
     * be both an emergency number in a country and a non-emergency number of a carrier's
     * customer service hotline.
     *
     * @hide
     */
    public void setHasKnownUserIntentEmergency(boolean hasKnownUserIntentEmergency) {
        mHasKnownUserIntentEmergency = hasKnownUserIntentEmergency;
    }

    /**
     * If this Connection is connected, then it is associated with
     * a Call.
+37 −15
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.SystemProperties;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.CellLocation;
import android.telephony.DisconnectCause;
@@ -268,7 +269,7 @@ public class GsmCdmaCallTracker extends CallTracker {
    /**
     * clirMode is one of the CLIR_ constants
     */
    public synchronized Connection dial(String dialString, int clirMode, UUSInfo uusInfo,
    public synchronized Connection dialGsm(String dialString, int clirMode, UUSInfo uusInfo,
                                        Bundle intentExtras)
            throws CallStateException {
        // note that this triggers call state changed notif
@@ -314,6 +315,12 @@ public class GsmCdmaCallTracker extends CallTracker {

        mPendingMO = new GsmCdmaConnection(mPhone, checkForTestEmergencyNumber(dialString),
                this, mForegroundCall, isEmergencyCall);
        if (intentExtras != null) {
            Rlog.d(LOG_TAG, "dialGsm - emergency dialer: " + intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
            mPendingMO.setHasKnownUserIntentEmergency(intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
        }
        mHangupPendingMO = false;
        mMetrics.writeRilDial(mPhone.getPhoneId(), mPendingMO, clirMode, uusInfo);

@@ -331,8 +338,8 @@ public class GsmCdmaCallTracker extends CallTracker {
            setMute(false);

            mCi.dial(mPendingMO.getAddress(), mPendingMO.isEmergencyCall(),
                    mPendingMO.getEmergencyNumberInfo(), clirMode, uusInfo,
                    obtainCompleteMessage());
                    mPendingMO.getEmergencyNumberInfo(), mPendingMO.hasKnownUserIntentEmergency(),
                    clirMode, uusInfo, obtainCompleteMessage());
        }

        if (mNumberConverted) {
@@ -383,7 +390,8 @@ public class GsmCdmaCallTracker extends CallTracker {
    /**
     * clirMode is one of the CLIR_ constants
     */
    private Connection dial(String dialString, int clirMode) throws CallStateException {
    private Connection dialCdma(String dialString, int clirMode, Bundle intentExtras)
            throws CallStateException {
        // note that this triggers call state changed notif
        clearDisconnected();

@@ -423,11 +431,17 @@ 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);
            return dialThreeWay(dialString, intentExtras);
        }

        mPendingMO = new GsmCdmaConnection(mPhone, checkForTestEmergencyNumber(dialString),
                this, mForegroundCall, isEmergencyCall);
        if (intentExtras != null) {
            Rlog.d(LOG_TAG, "dialGsm - emergency dialer: " + intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
            mPendingMO.setHasKnownUserIntentEmergency(intentExtras.getBoolean(
                    TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
        }
        mHangupPendingMO = false;

        if ( mPendingMO.getAddress() == null || mPendingMO.getAddress().length() == 0
@@ -448,8 +462,9 @@ public class GsmCdmaCallTracker extends CallTracker {
            // In Ecm mode, if another emergency call is dialed, Ecm mode will not exit.
            if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) {
                mCi.dial(mPendingMO.getAddress(), mPendingMO.isEmergencyCall(),
                        mPendingMO.getEmergencyNumberInfo(), clirMode,
                        obtainCompleteMessage());
                        mPendingMO.getEmergencyNumberInfo(),
                        mPendingMO.hasKnownUserIntentEmergency(),
                        clirMode, obtainCompleteMessage());
            } else {
                mPhone.exitEmergencyCallbackMode();
                mPhone.setOnEcbModeExitResponse(this,EVENT_EXIT_ECM_RESPONSE_CDMA, null);
@@ -470,7 +485,7 @@ public class GsmCdmaCallTracker extends CallTracker {
    }

    //CDMA
    private Connection dialThreeWay(String dialString) {
    private Connection dialThreeWay(String dialString, Bundle intentExtras) {
        if (!mForegroundCall.isIdle()) {
            // Check data call and possibly set mIsInEmergencyCall
            disableDataCallInEmergencyCall(dialString);
@@ -479,6 +494,12 @@ public class GsmCdmaCallTracker extends CallTracker {
            mPendingMO = new GsmCdmaConnection(mPhone,
                    checkForTestEmergencyNumber(dialString), this, mForegroundCall,
                    mIsInEmergencyCall);
            if (intentExtras != null) {
                Rlog.d(LOG_TAG, "dialThreeWay - emergency dialer " + intentExtras.getBoolean(
                        TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
                mPendingMO.setHasKnownUserIntentEmergency(intentExtras.getBoolean(
                        TelecomManager.EXTRA_IS_USER_INTENT_EMERGENCY_CALL));
            }
            // Some networks need an empty flash before sending the normal one
            CarrierConfigManager configManager = (CarrierConfigManager)
                    mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -501,24 +522,24 @@ public class GsmCdmaCallTracker extends CallTracker {
        return null;
    }

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

    //GSM
    public Connection dial(String dialString, UUSInfo uusInfo, Bundle intentExtras)
    public Connection dialGsm(String dialString, UUSInfo uusInfo, Bundle intentExtras)
            throws CallStateException {
        return dial(dialString, CommandsInterface.CLIR_DEFAULT, uusInfo, intentExtras);
        return dialGsm(dialString, CommandsInterface.CLIR_DEFAULT, uusInfo, intentExtras);
    }

    //GSM
    private Connection dial(String dialString, int clirMode, Bundle intentExtras)
    private Connection dialGsm(String dialString, int clirMode, Bundle intentExtras)
            throws CallStateException {
        return dial(dialString, clirMode, null, intentExtras);
        return dialGsm(dialString, clirMode, null, intentExtras);
    }

    public void acceptCall() throws CallStateException {
@@ -1543,6 +1564,7 @@ public class GsmCdmaCallTracker extends CallTracker {
                    if (mPendingCallInEcm) {
                        mCi.dial(mPendingMO.getAddress(), mPendingMO.isEmergencyCall(),
                                mPendingMO.getEmergencyNumberInfo(),
                                mPendingMO.hasKnownUserIntentEmergency(),
                                mPendingCallClirMode, obtainCompleteMessage());
                        mPendingCallInEcm = false;
                    }
+3 −3
Original line number Diff line number Diff line
@@ -1296,9 +1296,9 @@ public class GsmCdmaPhone extends Phone {
            if (DBG) logd("dialInternal: dialing w/ mmi '" + mmi + "'...");

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

+10 −7
Original line number Diff line number Diff line
@@ -865,8 +865,9 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo,
                     int clirMode, Message result) {
        dial(address, isEmergencyCall, emergencyNumberInfo, clirMode, null, result);
                     boolean hasKnownUserIntentEmergency, int clirMode, Message result) {
        dial(address, isEmergencyCall, emergencyNumberInfo, hasKnownUserIntentEmergency,
                clirMode, null, result);
    }

    @Override
@@ -903,10 +904,12 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo,
                     int clirMode, UUSInfo uusInfo, Message result) {
                     boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo,
                     Message result) {
        if (isEmergencyCall && mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)
                && emergencyNumberInfo != null) {
            emergencyDial(address, emergencyNumberInfo, clirMode, uusInfo, result);
            emergencyDial(address, emergencyNumberInfo, hasKnownUserIntentEmergency, clirMode,
                    uusInfo, result);
            return;
        }

@@ -940,7 +943,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    private void emergencyDial(String address, EmergencyNumber emergencyNumberInfo,
                               int clirMode, UUSInfo uusInfo, Message result) {
                               boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo,
                               Message result) {
        IRadio radioProxy = getRadioProxy(result);
        // IRadio V1.4
        android.hardware.radio.V1_4.IRadio radioProxy14 =
@@ -965,12 +969,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                // TODO: populate fromEmergencyDialer correctly
                radioProxy14.emergencyDial(rr.mSerial, dialInfo,
                        emergencyNumberInfo.getEmergencyServiceCategoryBitmaskInternalDial(),
                        (ArrayList) emergencyNumberInfo.getEmergencyUrns(),
                        emergencyNumberInfo.getEmergencyCallRouting(),
                        false,
                        hasKnownUserIntentEmergency,
                        emergencyNumberInfo.getEmergencyNumberSourceBitmask()
                                == EmergencyNumber.EMERGENCY_NUMBER_SOURCE_TEST);
            } catch (RemoteException | RuntimeException e) {
Loading