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

Commit e93eec68 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Fix Ims phone from becoming default phone"

parents 32c38aa1 27d460f8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ public class CallManager {
    // default phone as the first phone registered, which is PhoneBase obj
    private Phone mDefaultPhone;

    // save a cached copy of Ims Phone
    private Phone mImsPhone;

    private boolean mSpeedUpAudioForMtCall = false;

    protected CmHandler mHandler;
@@ -189,6 +192,7 @@ public class CallManager {
        mBackgroundCalls = new ArrayList<Call>();
        mForegroundCalls = new ArrayList<Call>();
        mDefaultPhone = null;
        mImsPhone = null;
        initHandler();
    }

@@ -346,6 +350,10 @@ public class CallManager {
    public boolean registerPhone(Phone phone) {
        Phone basePhone = getPhoneBase(phone);

        if (phone != null && phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            mImsPhone = phone;
        }

        if (basePhone != null && !mPhones.contains(basePhone)) {

            if (DBG) {
@@ -402,6 +410,14 @@ public class CallManager {
        return mDefaultPhone;
    }


    /**
     * return the IMS phone or null if not available
     */
    public Phone getImsPhone() {
        return mImsPhone;
    }

    /**
     * @return the phone associated with the foreground call
     */
+5 −2
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ public class PhoneProxy extends Handler implements Phone {

        String outgoingPhoneName = "Unknown";
        Phone oldPhone = mActivePhone;
        CallManager cm = CallManager.getInstance();

        if (oldPhone != null) {
            outgoingPhoneName = ((PhoneBase) oldPhone).getPhoneName();
@@ -254,7 +255,8 @@ public class PhoneProxy extends Handler implements Phone {
                + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA"));

        if (oldPhone != null) {
            CallManager.getInstance().unregisterPhone(oldPhone);
            cm.unregisterPhone(oldPhone);
            cm.unregisterPhone(cm.getImsPhone());
            logd("Disposing old phone..");
            oldPhone.dispose();
        }
@@ -273,7 +275,8 @@ public class PhoneProxy extends Handler implements Phone {
        }

        if(mActivePhone != null) {
            CallManager.getInstance().registerPhone(mActivePhone);
            cm.registerPhone(mActivePhone);
            cm.registerPhone(cm.getImsPhone());
        }

        oldPhone = null;