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

Commit 16ebf27f authored by Meng Wang's avatar Meng Wang
Browse files

Don't dial non-emergency CS voice call in airplane mode

Added a new CallStateException error code ERROR_POWER_OFF

Bug: 28709116
Change-Id: Ia63196d5e8c051a91da3e2a7e60ac605dccf8344
parent e871dc6e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public class CallStateException extends Exception
    public static final int ERROR_INVALID = -1;

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

    public
    CallStateException()
+8 −0
Original line number Diff line number Diff line
@@ -1121,6 +1121,14 @@ public class GsmCdmaPhone extends Phone {
                && mSST.mSS.getDataRegState() != ServiceState.STATE_IN_SERVICE && !isEmergency) {
            throw new CallStateException("cannot dial in current state");
        }
        // Check non-emergency voice CS call - shouldn't dial when POWER_OFF
        if (mSST != null && mSST.mSS.getState() == ServiceState.STATE_POWER_OFF /* CS POWER_OFF */
                && !VideoProfile.isVideo(videoState) /* voice call */
                && !isEmergency /* non-emergency call */) {
            throw new CallStateException(
                CallStateException.ERROR_POWER_OFF,
                "cannot dial voice call in airplane mode");
        }
        if (DBG) logd("Trying (non-IMS) CS call");

        if (isPhoneTypeGsm()) {