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

Commit daee86e9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Reset HOLD/SWAP state after SRVCC"

parents 5e7dddba d1b0c7ac
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3785,6 +3785,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private void resetState() {
        mIsInEmergencyCall = false;
        mPhone.setEcmCanceledForEmergency(false);
        mHoldSwitchingState = HoldSwapState.INACTIVE;
    }

    @VisibleForTesting
    public boolean isHoldOrSwapInProgress() {
        return mHoldSwitchingState != HoldSwapState.INACTIVE;
    }

    //****** Overridden from Handler
+31 −0
Original line number Diff line number Diff line
@@ -1125,6 +1125,37 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        assertFalse(mCTUT.mForegroundCall.isRingbackTonePlaying());
    }

    @Test
    @SmallTest
    public void testClearHoldSwapStateOnSrvcc() throws Exception {
        // Answer an incoming call
        testImsMTCall();
        assertTrue(mCTUT.mRingingCall.isRinging());
        try {
            mCTUT.acceptCall(ImsCallProfile.CALL_TYPE_VOICE);
            verify(mImsCall, times(1)).accept(eq(ImsCallProfile
                    .getCallTypeFromVideoState(ImsCallProfile.CALL_TYPE_VOICE)));
        } catch (Exception ex) {
            ex.printStackTrace();
            Assert.fail("set active, unexpected exception thrown" + ex.getMessage());
        }
        assertEquals(Call.State.ACTIVE, mCTUT.mForegroundCall.getState());
        // Hold the call
        doNothing().when(mImsCall).hold();
        try {
            mCTUT.holdActiveCall();
            assertTrue(mCTUT.isHoldOrSwapInProgress());
        } catch (Exception ex) {
            ex.printStackTrace();
            Assert.fail("hold, unexpected exception thrown" + ex.getMessage());
        }

        // Move the connection to the handover state.
        mCTUT.notifySrvccState(Call.SrvccState.COMPLETED);
        // Ensure we are no longer tracking hold.
        assertFalse(mCTUT.isHoldOrSwapInProgress());
    }

    @Test
    @SmallTest
    public void testHangupHandoverCall() throws RemoteException {