Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +9 −2 Original line number Diff line number Diff line Loading @@ -2219,6 +2219,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { if (Phone.DEBUG_PHONE) { log("(backgnd) hangup waiting or background"); } } else if (call == mHandoverCall) { if (Phone.DEBUG_PHONE) { log("(handover) hangup handover (SRVCC) call"); } } else { throw new CallStateException ("ImsPhoneCall " + call + "does not belong to ImsPhoneCallTracker " + this); Loading Loading @@ -3782,8 +3786,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { } } /* package */ void notifySrvccState(Call.SrvccState state) { /** * Notify of a change to SRVCC state * @param state the new SRVCC state. */ public void notifySrvccState(Call.SrvccState state) { if (DBG) log("notifySrvccState state=" + state); mSrvccState = state; Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java +33 −0 Original line number Diff line number Diff line Loading @@ -1114,6 +1114,39 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { assertVtDataUsageUpdated(13, 19, 19); } @Test @SmallTest public void testHangupHandoverCall() 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()); // No need to go through all the rigamarole of the mocked termination we normally do; we // can confirm the hangup gets processed without all that. doNothing().when(mImsCall).terminate(anyInt()); try { mCTUT.hangup(mCTUT.mHandoverCall); } catch (CallStateException e) { Assert.fail("CallStateException not expected"); } assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause()); } private void assertVtDataUsageUpdated(int expectedToken, long rxBytes, long txBytes) throws RemoteException { final ArgumentCaptor<NetworkStats> ifaceStatsCaptor = ArgumentCaptor.forClass( Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +9 −2 Original line number Diff line number Diff line Loading @@ -2219,6 +2219,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { if (Phone.DEBUG_PHONE) { log("(backgnd) hangup waiting or background"); } } else if (call == mHandoverCall) { if (Phone.DEBUG_PHONE) { log("(handover) hangup handover (SRVCC) call"); } } else { throw new CallStateException ("ImsPhoneCall " + call + "does not belong to ImsPhoneCallTracker " + this); Loading Loading @@ -3782,8 +3786,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { } } /* package */ void notifySrvccState(Call.SrvccState state) { /** * Notify of a change to SRVCC state * @param state the new SRVCC state. */ public void notifySrvccState(Call.SrvccState state) { if (DBG) log("notifySrvccState state=" + state); mSrvccState = state; Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java +33 −0 Original line number Diff line number Diff line Loading @@ -1114,6 +1114,39 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest { assertVtDataUsageUpdated(13, 19, 19); } @Test @SmallTest public void testHangupHandoverCall() 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()); // No need to go through all the rigamarole of the mocked termination we normally do; we // can confirm the hangup gets processed without all that. doNothing().when(mImsCall).terminate(anyInt()); try { mCTUT.hangup(mCTUT.mHandoverCall); } catch (CallStateException e) { Assert.fail("CallStateException not expected"); } assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause()); } private void assertVtDataUsageUpdated(int expectedToken, long rxBytes, long txBytes) throws RemoteException { final ArgumentCaptor<NetworkStats> ifaceStatsCaptor = ArgumentCaptor.forClass( Loading