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

Commit 77eeade7 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Get current calls on phone type switch.

There may be active calls from previous phone type.

Bug: 29738766
Change-Id: I16a57567fd72be35a7e15eccb6a65f540b51874d
parent 2cd71ff6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -160,9 +160,10 @@ public class GsmCdmaCallTracker extends CallTracker {
        updatePhoneType(false);
    }

    private void updatePhoneType(boolean init) {
        if (!init) {
    private void updatePhoneType(boolean duringInit) {
        if (!duringInit) {
            reset();
            pollCallsWhenSafe();
        }
        if (mPhone.isPhoneTypeGsm()) {
            mConnections = new GsmCdmaConnection[MAX_CONNECTIONS_GSM];
+1 −0
Original line number Diff line number Diff line
@@ -458,6 +458,7 @@ public class SimulatedCommands extends BaseCommands
     */
    @Override
    public void getCurrentCalls (Message result) {
        SimulatedCommandsVerifier.getInstance().getCurrentCalls(result);
        if ((mState == RadioState.RADIO_ON) && !isSimLocked()) {
            //Rlog.i("GSM", "[SimCmds] getCurrentCalls");
            resultSuccess(result, simulatedCallState.getDriverCalls());
+12 −0
Original line number Diff line number Diff line
@@ -350,5 +350,17 @@ public class GsmCdmaCallTrackerTest extends TelephonyTest {
        verify(mHandler,times(1)).sendMessageAtTime(mCaptorMessage.capture(), mCaptorLong.capture());
        assertEquals(VOICE_CALL_ENDED_EVENT, mCaptorMessage.getValue().what);
    }

    @Test @SmallTest
    public void testUpdatePhoneType() {
        // verify getCurrentCalls is called on init
        verify(mSimulatedCommandsVerifier).getCurrentCalls(any(Message.class));

        // update phone type
        mCTUT.updatePhoneType();

        // verify getCurrentCalls is called on updating phone type
        verify(mSimulatedCommandsVerifier, times(2)).getCurrentCalls(any(Message.class));
    }
}