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

Commit 29a1acb5 authored by Jayachandran Chinnakkannu's avatar Jayachandran Chinnakkannu Committed by Gerrit Code Review
Browse files

Merge "Check for service state before dialing normal voice call in the CS pipe"

parents e93090dc 86f275d9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ public class CallStateException extends Exception
    /** The error code is not valid (Not received a disconnect cause) */
    public static final int ERROR_INVALID = -1;

    public static final int ERROR_DISCONNECTED = 1;
    public static final int ERROR_OUT_OF_SERVICE = 1;
    public static final int ERROR_POWER_OFF = 2;

    public
+12 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.UssdResponse;

import android.telephony.cdma.CdmaCellLocation;
import android.text.TextUtils;
import android.util.Log;
@@ -1129,6 +1128,18 @@ public class GsmCdmaPhone extends Phone {
                CallStateException.ERROR_POWER_OFF,
                "cannot dial voice call in airplane mode");
        }
        // Check for service before placing non emergency CS voice call.
        // Allow dial only if either CS is camped on any RAT (or) PS is in LTE service.
        if (mSST != null
                && mSST.mSS.getState() == ServiceState.STATE_OUT_OF_SERVICE /* CS out of service */
                && !(mSST.mSS.getDataRegState() == ServiceState.STATE_IN_SERVICE
                    && ServiceState.isLte(mSST.mSS.getRilDataRadioTechnology())) /* PS not in LTE */
                && !VideoProfile.isVideo(videoState) /* voice call */
                && !isEmergency /* non-emergency call */) {
            throw new CallStateException(
                CallStateException.ERROR_OUT_OF_SERVICE,
                "cannot dial voice call in out of service");
        }
        if (DBG) logd("Trying (non-IMS) CS call");

        if (isPhoneTypeGsm()) {
+1 −2
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.ims.ImsManager;
import com.android.internal.R;
import com.android.internal.telephony.dataconnection.DcTracker;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
import com.android.internal.telephony.ims.ImsResolver;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccFileHandler;
@@ -3384,7 +3383,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                            ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY));
            if (wfcWiFiOnly) {
                throw new CallStateException(
                        CallStateException.ERROR_DISCONNECTED,
                        CallStateException.ERROR_OUT_OF_SERVICE,
                        "WFC Wi-Fi Only Mode: IMS not registered");
            }
        }
+5 −3
Original line number Diff line number Diff line
@@ -15,10 +15,12 @@
 */
package com.android.internal.telephony;

import static org.junit.Assert.assertEquals;

import android.test.suitebuilder.annotation.SmallTest;

import org.junit.After;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class CallStateExceptionTest {
    private CallStateException mCallStateException;
@@ -39,9 +41,9 @@ public class CallStateExceptionTest {
    @Test
    @SmallTest
    public void testCallStateExceptionWithErrCode() {
        mCallStateException = new CallStateException(mCallStateException.ERROR_DISCONNECTED,
        mCallStateException = new CallStateException(mCallStateException.ERROR_OUT_OF_SERVICE,
                                                     "sanity test with err code");
        assertEquals("sanity test with err code", mCallStateException.getMessage());
        assertEquals(mCallStateException.ERROR_DISCONNECTED, mCallStateException.getError());
        assertEquals(mCallStateException.ERROR_OUT_OF_SERVICE, mCallStateException.getError());
    }
}