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

Commit 1cef2289 authored by Guo-Bin Zhang's avatar Guo-Bin Zhang Committed by Wink Saville
Browse files

Disable data call in emergency call

Same change as 79ef673d rebased
parent 6f89172b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -749,6 +749,9 @@ public class CDMAPhone extends PhoneBase {
            Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS);
            ActivityManagerNative.broadcastStickyIntent(intent, null);
            return false;
        } else if ((mCT.state == Phone.State.OFFHOOK) && mCT.isInEmergencyCall()) {
            // Do not allow data call to be enabled when emergency call is going on
            return false;
        } else {
            return mDataConnection.setDataEnabled(true);
        }
+29 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public final class CdmaCallTracker extends CallTracker {
    CdmaConnection pendingMO;
    boolean hangupPendingMO;
    boolean pendingCallInEcm=false;
    boolean mIsInEmergencyCall = false;
    CDMAPhone phone;

    boolean desiredMute = false;    // false = mute off
@@ -219,6 +220,9 @@ public final class CdmaCallTracker extends CallTracker {
            // Always unmute when initiating a new call
            setMute(false);

            // Check data call
            disableDataCallInEmergencyCall(dialString);

            // In Ecm mode, if another emergency call is dialed, Ecm mode will not exit.
            if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) {
                cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
@@ -245,6 +249,9 @@ public final class CdmaCallTracker extends CallTracker {
    private Connection
    dialThreeWay (String dialString) {
        if (!foregroundCall.isIdle()) {
            // Check data call
            disableDataCallInEmergencyCall(dialString);

            // Attach the new connection to foregroundCall
            pendingMO = new CdmaConnection(phone.getContext(),
                                dialString, this, foregroundCall);
@@ -556,6 +563,8 @@ public final class CdmaCallTracker extends CallTracker {
                // Re-start Ecm timer when the connected emergency call ends
                if (mIsEcmTimerCanceled) {
                    handleEcmTimer(phone.RESTART_ECM_TIMER);
                } else {
                    mIsInEmergencyCall = false;
                }

                // Dropped connections are removed from the CallTracker
@@ -1010,6 +1019,26 @@ public final class CdmaCallTracker extends CallTracker {
        }
    }

    /**
     * Disable data call when emergency call is connected
     */
    private void disableDataCallInEmergencyCall(String dialString) {
        if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
            phone.disableDataConnectivity();
            mIsInEmergencyCall = true;
        }
    }

    /**
     * Check if current call is in emergency call
     *
     * @return true if it is in emergency call
     *         false if it is not in emergency call
     */
    boolean isInEmergencyCall() {
        return mIsInEmergencyCall;
    }

    protected void log(String msg) {
        Log.d(LOG_TAG, "[CdmaCallTracker] " + msg);
    }