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

Commit 9ec60c47 authored by Amit Mahajan's avatar Amit Mahajan Committed by android-build-merger
Browse files

Get current calls on phone type switch.

am: 77eeade7

Change-Id: I2f3a4cae01f37bcbee0d6d39aff8d91038799202
parents add4386d 77eeade7
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));
    }
}