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

Commit 1237b674 authored by Jordan Liu's avatar Jordan Liu
Browse files

Merge isInEcm for GsmCdmaPhone and ImsPhone

Merge mIsPhoneInEcmState and remove override in ImsPhone.

Fix: 30368080
Test: runtest --path GsmCdmaPhoneTest.java
      runtest --path ImsPhoneTest.java
Change-Id: Iefcc7a2774605636beeafa466ae55f7a50699423
parent be6ba3c6
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -124,9 +124,6 @@ public class GsmCdmaPhone extends Phone {
    // mEriFileLoadedRegistrants are informed after the ERI text has been loaded
    private final RegistrantList mEriFileLoadedRegistrants = new RegistrantList();
    // mEcmExitRespRegistrant is informed after the phone has been exited
    //the emergency callback mode
    //keep track of if phone is in emergency callback mode
    private boolean mIsPhoneInEcmState;
    private Registrant mEcmExitRespRegistrant;
    private String mEsn;
    private String mMeid;
@@ -281,8 +278,7 @@ public class GsmCdmaPhone extends Phone {
        } else {
            mCdmaSubscriptionSource = CdmaSubscriptionSourceManager.SUBSCRIPTION_SOURCE_UNKNOWN;
            // This is needed to handle phone process crashes
            String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
            mIsPhoneInEcmState = inEcm.equals("true");
            mIsPhoneInEcmState = getInEcmMode();
            if (mIsPhoneInEcmState) {
                // Send a message which will invoke handleExitEmergencyCallbackMode
                mCi.exitEmergencyCallbackMode(
+13 −1
Original line number Diff line number Diff line
@@ -227,6 +227,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private int mCallRingDelay;
    private boolean mIsVoiceCapable = true;

    // Keep track of whether or not the phone is in Emergency Callback Mode for Phone and
    // subclasses
    protected boolean mIsPhoneInEcmState = false;

    // Variable to cache the video capability. When RAT changes, we lose this info and are unable
    // to recover from the state. We cache it and notify listeners when they register.
    protected boolean mIsVideoCapable = false;
@@ -2040,13 +2044,21 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return false;
    }

    // This property is used to handle phone process crashes, and is the same for CDMA and IMS
    // phones
    protected static boolean getInEcmMode() {
        return SystemProperties.getBoolean(TelephonyProperties.PROPERTY_INECM_MODE, false);
    }

    /**
     * @return {@code true} if we are in emergency call back mode. This is a period where the phone
     * should be using as little power as possible and be ready to receive an incoming call from the
     * emergency operator.
     *
     * This method is overridden for GSM phones to return false always
     */
    public boolean isInEcm() {
        return false;
        return mIsPhoneInEcmState;
    }

    private static int getVideoState(Call call) {
+1 −8
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ public class ImsPhone extends ImsPhoneBase {
    private String mLastDialString;

    private WakeLock mWakeLock;
    private boolean mIsPhoneInEcmState;

    // mEcmExitRespRegistrant is informed after the phone has been exited the emergency
    // callback mode keep track of if phone is in emergency callback mode
@@ -201,8 +200,7 @@ public class ImsPhone extends ImsPhoneBase {

        // This is needed to handle phone process crashes
        // Same property is used for both CDMA & IMS phone.
        mIsPhoneInEcmState = SystemProperties.getBoolean(
                TelephonyProperties.PROPERTY_INECM_MODE, false);
        mIsPhoneInEcmState = getInEcmMode();

        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
@@ -1255,11 +1253,6 @@ public class ImsPhone extends ImsPhoneBase {
        return mCT.isInEmergencyCall();
    }

    @Override
    public boolean isInEcm() {
        return mIsPhoneInEcmState;
    }

    private void sendEmergencyCallbackModeChange() {
        // Send an Intent
        Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);