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

Commit d1bbaa4a authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Signal EVENT_MERGE_COMPLETE connection event on merge completion.

This was previously only sent on merge failure.
We now trigger the merge complete event once all the connections have been
merged (or failed to merge) into the conference.

Test: Manual conference test, verified signal ordering in Telecom logs.
Test: Add unit tests
Bug: 139169804
Merged-In: Ic3b6b0350b4e6a321d175e001df2f786a2317e60
Change-Id: Ic3b6b0350b4e6a321d175e001df2f786a2317e60
parent 03132bbc
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2699,8 +2699,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            }
            foregroundImsPhoneCall.merge(peerImsPhoneCall, ImsPhoneCall.State.ACTIVE);

            try {
            final ImsPhoneConnection conn = findConnection(call);
            try {
                log("onCallMerged: ImsPhoneConnection=" + conn);
                log("onCallMerged: CurrentVideoProvider=" + conn.getVideoProvider());
                setVideoCallProvider(conn, call);
@@ -2728,6 +2728,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                // Reset the flag.
                call.resetIsMergeRequestedByConf(false);
            }

            // Notify completion of merge
            if (conn != null) {
                conn.handleMergeComplete();
            }
            logState();
        }

+15 −6
Original line number Diff line number Diff line
@@ -910,14 +910,22 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {

    @Test
    @SmallTest
    public void testNumericOnlyRemap() {
        assertEquals(ImsReasonInfo.CODE_SIP_FORBIDDEN, mCTUT.maybeRemapReasonCode(
                new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE, 0)));
        assertEquals(ImsReasonInfo.CODE_SIP_FORBIDDEN, mCTUT.maybeRemapReasonCode(
                new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE, 0, "")));
    public void testMergeComplete() {
        boolean[] result = new boolean[1];
        // Place a call.
        ImsPhoneConnection connection = placeCallAndMakeActive();
        connection.addListener(new Connection.ListenerBase() {
            @Override
            public void onConnectionEvent(String event, Bundle extras) {
                result[0] = android.telecom.Connection.EVENT_MERGE_COMPLETE.equals(event);
            }
        });
        ImsCall call = connection.getImsCall();
        call.getListener().onCallMerged(call, null, false);
        assertTrue(result[0]);
    }

    private void placeCallAndMakeActive() {
    private ImsPhoneConnection placeCallAndMakeActive() {
        try {
            doAnswer(new Answer<ImsCall>() {
                @Override
@@ -950,6 +958,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
                new ImsStreamMediaProfile());
        imsCall.getImsCallSessionListenerProxy().callSessionStarted(imsCall.getSession(),
                new ImsCallProfile());
        return connection;
    }
}