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

Commit cbca3852 authored by Jaime Lopez's avatar Jaime Lopez
Browse files

Telephony: Register/Unregister Phones with CallManager

Unregister the outgoing phone and register the new one when Technology change
is detected. Otherwise, CallManager keeps trying to use an already dead phone,
which causes a crash

Change-Id: I2a04c76ce882d034d1a2073d2a9f9739d4dd9a38
parent 7d234fab
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.gsm.NetworkInfo;
import com.android.internal.telephony.gsm.GsmDataConnection;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.CallManager;

import java.util.List;

@@ -88,6 +89,7 @@ public class PhoneProxy extends Handler implements Phone {

            if(mOutgoingPhone.equals("GSM")) {
                logd("Make a new CDMAPhone and destroy the old GSMPhone.");
                CallManager.getInstance().unregisterPhone(mActivePhone);

                ((GSMPhone)mActivePhone).dispose();
                Phone oldPhone = mActivePhone;
@@ -100,9 +102,11 @@ public class PhoneProxy extends Handler implements Phone {

                mActivePhone = PhoneFactory.getCdmaPhone();
                ((GSMPhone)oldPhone).removeReferences();
                CallManager.getInstance().registerPhone(mActivePhone);
                oldPhone = null;
            } else {
                logd("Make a new GSMPhone and destroy the old CDMAPhone.");
                CallManager.getInstance().unregisterPhone(mActivePhone);

                ((CDMAPhone)mActivePhone).dispose();
                //mActivePhone = null;
@@ -116,6 +120,7 @@ public class PhoneProxy extends Handler implements Phone {

                mActivePhone = PhoneFactory.getGsmPhone();
                ((CDMAPhone)oldPhone).removeReferences();
                CallManager.getInstance().registerPhone(mActivePhone);
                oldPhone = null;
            }