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

Commit d1b0c7ac authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Reset HOLD/SWAP state after SRVCC

If there was a hold/swap in progress during SRVCC, the state
was not being cleared correctly, causing it to remain in that state
when the next call began.

Bug: 161076702
Test: atest FrameworksTelephonyTests:ImsPhoneCallTrackerTest
Change-Id: Ic84bd04a0084a55e4b6071a353548d658a925d2b
parent 17b05cb6
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 {