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

Commit e6788070 authored by Yanjun Kang's avatar Yanjun Kang Committed by Tyler Gunn
Browse files

Add Explicit Call Transfer feature for IMS call

This feature is to connect the two calls and disconnects the
subscriber from both calls.

Test: manual - Check whether Explicit Call Transfer feature is worked
correctly over IMS.
Bug: 141256488

Change-Id: I4711d5415befd1172ea2f442d4f1da0b9497a329
parent 36906dbd
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ public class ImsPhone extends ImsPhoneBase {
    }

    @Override
    public void explicitCallTransfer() {
    public void explicitCallTransfer() throws CallStateException {
        mCT.explicitCallTransfer();
    }

@@ -650,15 +650,17 @@ public class ImsPhone extends ImsPhoneBase {
    }

    private boolean handleEctIncallSupplementaryService(String dialString) {

        int len = dialString.length();

        if (len != 1) {
        if (dialString.length() != 1) {
            return false;
        }

        if (DBG) logd("MmiCode 4: not support explicit call transfer");
        if (DBG) logd("MmiCode 4: explicit call transfer");
        try {
            explicitCallTransfer();
        } catch (CallStateException e) {
            if (DBG) Rlog.d(LOG_TAG, "explicit call transfer failed", e);
            notifySuppServiceFailed(Phone.SuppService.TRANSFER);
        }
        return true;
    }

+18 −3
Original line number Diff line number Diff line
@@ -1884,9 +1884,23 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        }
    }

    public void
    explicitCallTransfer() {
        //TODO : implement
    /**
     * Connects the two calls and disconnects the subscriber from both calls. Throws a
     * {@link CallStateException} if there is an issue.
     * @throws CallStateException
     */
    public void explicitCallTransfer() throws CallStateException {
        ImsCall fgImsCall = mForegroundCall.getImsCall();
        ImsCall bgImsCall = mBackgroundCall.getImsCall();
        if ((fgImsCall == null) || (bgImsCall == null) || !canTransfer()) {
            throw new CallStateException("cannot transfer");
        }

        try {
            fgImsCall.consultativeTransfer(bgImsCall);
        } catch (ImsException e) {
            throw new CallStateException(e.getMessage());
        }
    }

    @UnsupportedAppUsage
@@ -3470,6 +3484,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        @Override
        public void onCallSessionTransferFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) {
            if (DBG) log("onCallSessionTransferFailed reasonInfo=" + reasonInfo);
            mPhone.notifySuppServiceFailed(Phone.SuppService.TRANSFER);
        }

        /**
+2 −6
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ public class ImsPhoneTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testHandleInCallMmiCommandCallEct() {
    public void testHandleInCallMmiCommandCallEct() throws Exception {
        doReturn(Call.State.ACTIVE).when(mForegroundCall).getState();

        // dial string length > 1
@@ -266,11 +266,7 @@ public class ImsPhoneTest extends TelephonyTest {

        // dial string length == 1
        assertEquals(true, mImsPhoneUT.handleInCallMmiCommands("4"));
        ArgumentCaptor<Message> messageArgumentCaptor = ArgumentCaptor.forClass(Message.class);
        verify(mTestHandler).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong());
        assertEquals(EVENT_SUPP_SERVICE_FAILED, messageArgumentCaptor.getValue().what);
        assertEquals(Phone.SuppService.TRANSFER,
                ((AsyncResult) messageArgumentCaptor.getValue().obj).result);
        verify(mImsCT).explicitCallTransfer();
    }

    @Test