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

Commit 73e1b75d authored by Jordan Liu's avatar Jordan Liu Committed by Gerrit Code Review
Browse files

Merge "Merge isInEcm for GsmCdmaPhone and ImsPhone"

parents bd9734a4 1237b674
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -124,9 +124,6 @@ public class GsmCdmaPhone extends Phone {
    // mEriFileLoadedRegistrants are informed after the ERI text has been loaded
    // mEriFileLoadedRegistrants are informed after the ERI text has been loaded
    private final RegistrantList mEriFileLoadedRegistrants = new RegistrantList();
    private final RegistrantList mEriFileLoadedRegistrants = new RegistrantList();
    // mEcmExitRespRegistrant is informed after the phone has been exited
    // 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 Registrant mEcmExitRespRegistrant;
    private String mEsn;
    private String mEsn;
    private String mMeid;
    private String mMeid;
@@ -281,8 +278,7 @@ public class GsmCdmaPhone extends Phone {
        } else {
        } else {
            mCdmaSubscriptionSource = CdmaSubscriptionSourceManager.SUBSCRIPTION_SOURCE_UNKNOWN;
            mCdmaSubscriptionSource = CdmaSubscriptionSourceManager.SUBSCRIPTION_SOURCE_UNKNOWN;
            // This is needed to handle phone process crashes
            // This is needed to handle phone process crashes
            String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
            mIsPhoneInEcmState = getInEcmMode();
            mIsPhoneInEcmState = inEcm.equals("true");
            if (mIsPhoneInEcmState) {
            if (mIsPhoneInEcmState) {
                // Send a message which will invoke handleExitEmergencyCallbackMode
                // Send a message which will invoke handleExitEmergencyCallbackMode
                mCi.exitEmergencyCallbackMode(
                mCi.exitEmergencyCallbackMode(
+13 −1
Original line number Original line Diff line number Diff line
@@ -227,6 +227,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private int mCallRingDelay;
    private int mCallRingDelay;
    private boolean mIsVoiceCapable = true;
    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
    // 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.
    // to recover from the state. We cache it and notify listeners when they register.
    protected boolean mIsVideoCapable = false;
    protected boolean mIsVideoCapable = false;
@@ -2040,13 +2044,21 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return false;
        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
     * @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
     * should be using as little power as possible and be ready to receive an incoming call from the
     * emergency operator.
     * emergency operator.
     *
     * This method is overridden for GSM phones to return false always
     */
     */
    public boolean isInEcm() {
    public boolean isInEcm() {
        return false;
        return mIsPhoneInEcmState;
    }
    }


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


    private WakeLock mWakeLock;
    private WakeLock mWakeLock;
    private boolean mIsPhoneInEcmState;


    // mEcmExitRespRegistrant is informed after the phone has been exited the emergency
    // mEcmExitRespRegistrant is informed after the phone has been exited the emergency
    // callback mode keep track of if phone is in emergency callback mode
    // 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
        // This is needed to handle phone process crashes
        // Same property is used for both CDMA & IMS phone.
        // Same property is used for both CDMA & IMS phone.
        mIsPhoneInEcmState = SystemProperties.getBoolean(
        mIsPhoneInEcmState = getInEcmMode();
                TelephonyProperties.PROPERTY_INECM_MODE, false);


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


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

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