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

Commit 2c7537c8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update ImsPhoneCallTracker state on SRVCC complete." into rvc-dev

parents 3521e02a f147db03
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3808,6 +3808,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            transferHandoverConnections(mForegroundCall);
            transferHandoverConnections(mBackgroundCall);
            transferHandoverConnections(mRingingCall);
            updatePhoneState();
        }
    }

+30 −0
Original line number Diff line number Diff line
@@ -1147,6 +1147,36 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause());
    }

    /**
     * Verifies that the {@link ImsPhoneCallTracker#getState()} goes to IDLE when an SRVCC takes
     * place.
     * @throws RemoteException
     */
    @Test
    @SmallTest
    public void testTrackerStateOnHandover() throws RemoteException {
        doReturn("1").when(mImsCallSession).getCallId();
        assertEquals(PhoneConstants.State.IDLE, mCTUT.getState());
        assertFalse(mCTUT.mRingingCall.isRinging());
        // mock a MT call
        mMmTelListener.onIncomingCall(mock(IImsCallSession.class), Bundle.EMPTY);
        verify(mImsPhone, times(1)).notifyNewRingingConnection((Connection) any());
        verify(mImsPhone, times(1)).notifyIncomingRing();
        assertEquals(PhoneConstants.State.RINGING, mCTUT.getState());
        assertTrue(mCTUT.mRingingCall.isRinging());
        assertEquals(1, mCTUT.mRingingCall.getConnections().size());
        ImsPhoneConnection connection =
                (ImsPhoneConnection) mCTUT.mRingingCall.getConnections().get(0);
        connection.addListener(mImsPhoneConnectionListener);

        // Move the connection to the handover state.
        mCTUT.notifySrvccState(Call.SrvccState.COMPLETED);
        assertEquals(1, mCTUT.mHandoverCall.getConnections().size());

        // Make sure the tracker states it's idle.
        assertEquals(PhoneConstants.State.IDLE, mCTUT.getState());
    }

    private void assertVtDataUsageUpdated(int expectedToken, long rxBytes, long txBytes)
            throws RemoteException {
        final ArgumentCaptor<NetworkStats> ifaceStatsCaptor = ArgumentCaptor.forClass(