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

Commit 8561f774 authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Fix mmi command for holding calls on IMS"

parents d713df62 2f4df2ca
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -681,8 +681,18 @@ public class ImsPhone extends ImsPhoneBase {
                if (getRingingCall().getState() != ImsPhoneCall.State.IDLE) {
                    if (DBG) logd("MmiCode 2: accept ringing call");
                    mCT.acceptCall(ImsCallProfile.CALL_TYPE_VOICE);
                } else if (getBackgroundCall().getState() == ImsPhoneCall.State.HOLDING) {
                    // If there's an active ongoing call as well, hold it and the background one
                    // should automatically unhold. Otherwise just unhold the background call.
                    if (getForegroundCall().getState() != ImsPhoneCall.State.IDLE) {
                        if (DBG) logd("MmiCode 2: switch holding and active");
                        mCT.holdActiveCall();
                    } else {
                    if (DBG) logd("MmiCode 2: holdActiveCall");
                        if (DBG) logd("MmiCode 2: unhold held call");
                        mCT.unholdHeldCall();
                    }
                } else if (getForegroundCall().getState() != ImsPhoneCall.State.IDLE) {
                    if (DBG) logd("MmiCode 2: hold active call");
                    mCT.holdActiveCall();
                }
            } catch (CallStateException e) {
+1 −1
Original line number Diff line number Diff line
@@ -1345,7 +1345,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    /**
     * Unhold the currently held call.
     */
    void unholdHeldCall() throws CallStateException {
    public void unholdHeldCall() throws CallStateException {
        ImsCall imsCall = mBackgroundCall.getImsCall();
        if (mHoldSwitchingState == HoldSwapState.PENDING_SINGLE_CALL_UNHOLD
                || mHoldSwitchingState == HoldSwapState.SWAPPING_ACTIVE_AND_HELD) {
+15 −1
Original line number Diff line number Diff line
@@ -223,11 +223,25 @@ public class ImsPhoneTest extends TelephonyTest {
        assertEquals(Phone.SuppService.SEPARATE,
                ((AsyncResult) messageArgumentCaptor.getValue().obj).result);

        // ringing call is idle
        // ringing call is idle, only an active call present
        doReturn(Call.State.ACTIVE).when(mForegroundCall).getState();
        assertEquals(true, mImsPhoneUT.handleInCallMmiCommands("2"));
        verify(mImsCT).holdActiveCall();

        // background call is holding
        doReturn(Call.State.HOLDING).when(mBackgroundCall).getState();
        doReturn(Call.State.IDLE).when(mForegroundCall).getState();
        assertEquals(true, mImsPhoneUT.handleInCallMmiCommands("2"));
        verify(mImsCT).unholdHeldCall();

        // background call is holding and there's an active foreground call
        doReturn(Call.State.ACTIVE).when(mForegroundCall).getState();
        assertEquals(true, mImsPhoneUT.handleInCallMmiCommands("2"));
        verify(mImsCT, times(2)).holdActiveCall();

        // ringing call is not idle
        doReturn(Call.State.IDLE).when(mForegroundCall).getState();
        doReturn(Call.State.IDLE).when(mBackgroundCall).getState();
        doReturn(Call.State.INCOMING).when(mRingingCall).getState();
        assertEquals(true, mImsPhoneUT.handleInCallMmiCommands("2"));
        verify(mImsCT).acceptCall(ImsCallProfile.CALL_TYPE_VOICE);