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

Commit cd7767a2 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Update ImsPhoneCallTracker state on SRVCC complete.

The state of the ImsPhoneCallTracker is cached (like it is in the GSM/CDMA
tracker) in an instance variable, mState.  When calls undergo SRVCC that
state was not being updated back to IDLE, meaning the tracker would report
being off hook after the SRVCC until another call operation takes place
on the tracker.

This bug fixes that by ensuring we call updatePhoneState() when SRVCC
is complete.

Test: Manual test by setting network to 3G and placing a fake emergency
call to verify SRVCC completes and the phone state updates as required.
Test: Added new unit test to confirm update.
Bug: 154196510
Fixes: 155098145
Merged-In: Icb435f62465d1f7360afbc54009efe19cd87abbb
Change-Id: I95f10906acefda6872f345c2f4818cac46df5e75
parent 16b31355
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3791,6 +3791,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
@@ -1189,6 +1189,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(