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

Commit 4d3347da authored by Tyler Gunn's avatar Tyler Gunn Committed by Gerrit Code Review
Browse files

Merge "Add Explicit Call Transfer feature for IMS call"

parents f18b86a5 e6788070
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