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

Commit ec15d7bd authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Update ECBM system property early to reduce race condition window.

Update property before broadcasting ECBM intent.

Bug: 30237792
Change-Id: I787fd55cc9406d7f48b24797e29eb11413d6c0c0
parent db5b6a50
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -2679,10 +2679,10 @@ public class GsmCdmaPhone extends Phone {
        }
        // if phone is not in Ecm mode, and it's changed to Ecm mode
        if (mIsPhoneInEcmState == false) {
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
            mIsPhoneInEcmState = true;
            // notify change
            sendEmergencyCallbackModeChange();
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");

            // Post this runnable so we will automatically exit
            // if no one invokes exitEmergencyCallbackMode() directly.
@@ -2709,15 +2709,16 @@ public class GsmCdmaPhone extends Phone {
        }
        // if exiting ecm success
        if (ar.exception == null) {
            if (mIsPhoneInEcmState) {
                setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
                mIsPhoneInEcmState = false;
            }

            // release wakeLock
            if (mWakeLock.isHeld()) {
                mWakeLock.release();
            }

            if (mIsPhoneInEcmState) {
                mIsPhoneInEcmState = false;
                setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
            }
            // send an Intent
            sendEmergencyCallbackModeChange();
            // Re-initiate data connection
+7 −5
Original line number Diff line number Diff line
@@ -1305,10 +1305,10 @@ public class ImsPhone extends ImsPhoneBase {
        }
        // if phone is not in Ecm mode, and it's changed to Ecm mode
        if (mIsPhoneInEcmState == false) {
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
            mIsPhoneInEcmState = true;
            // notify change
            sendEmergencyCallbackModeChange();
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");

            // Post this runnable so we will automatically exit
            // if no one invokes exitEmergencyCallbackMode() directly.
@@ -1325,6 +1325,12 @@ public class ImsPhone extends ImsPhoneBase {
            Rlog.d(LOG_TAG, "handleExitEmergencyCallbackMode: mIsPhoneInEcmState = "
                    + mIsPhoneInEcmState);
        }

        if (mIsPhoneInEcmState) {
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
            mIsPhoneInEcmState = false;
        }

        // Remove pending exit Ecm runnable, if any
        removeCallbacks(mExitEcmRunnable);

@@ -1337,10 +1343,6 @@ public class ImsPhone extends ImsPhoneBase {
            mWakeLock.release();
        }

        if (mIsPhoneInEcmState) {
            mIsPhoneInEcmState = false;
            setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
        }
        // send an Intent
        sendEmergencyCallbackModeChange();
    }