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

Commit 3597796a authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Bypass telecom sequencing for managed CSs for multiple Calls on the same PA

When there are multiple calls on the same PhoneAccount for a managed
ConnectionService, leave it to the ConnectionService to handle sequencing
operations across those calls.

Fixes: 391452587
Flag: com.android.server.telecom.flags.enable_call_sequencing
Test: atest CtsTelecomCujTestCases; manual VZW multicalll tests
Change-Id: I87cdc3fb9fc3a34dec069fe0ee4d3547bd2c451f
parent 9de798e9
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ public class CallSequencingController {
                // This call does not support hold. If it is from a different connection
                // service or connection manager, then disconnect it, otherwise allow the connection
                // service or connection manager to figure out the right states.
                Log.i(this, "holdActiveCallForNewCallWithSequencing: disconnecting %s "
                Log.i(this, "holdActiveCallForNewCallWithSequencing: evaluating disconnecting %s "
                        + "so that %s can be made active.", activeCall.getId(), call.getId());
                if (!activeCall.isEmergencyCall()) {
                    // We don't want to allow VOIP apps to disconnect carrier calls. We are
@@ -340,11 +340,15 @@ public class CallSequencingController {
                                + "disconnecting carrier call for making VOIP call active");
                        return CompletableFuture.completedFuture(false);
                    } else {
                        CompletableFuture<Boolean> disconnectFuture = activeCall.disconnect(
                                "Active call disconnected in favor of new call.");
                        return isSequencingRequiredActiveAndCall
                                ? disconnectFuture
                                : CompletableFuture.completedFuture(true);
                        if (isSequencingRequiredActiveAndCall) {
                            return activeCall.disconnect("Active call disconnected in favor of"
                                    + " new call.");
                        } else {
                            Log.i(this, "holdActiveCallForNewCallWithSequencing: "
                                    + "allowing ConnectionService to determine how to handle "
                                    + "this case");
                            CompletableFuture.completedFuture(true);
                        }
                    }
                } else {
                    // It's not possible to hold the active call, and it's an emergency call so
@@ -753,7 +757,15 @@ public class CallSequencingController {
            return CompletableFuture.completedFuture(false);
        }

        if (call.getTargetPhoneAccount() == null) {
        // Self-Managed + Transactional calls require Telecom to manage calls in the same
        // PhoneAccount, whereas managed calls require the ConnectionService to manage calls in the
        // same PhoneAccount for legacy reasons (Telephony).
        if (arePhoneAccountsSame(call, liveCall) && !call.isSelfManaged()) {
            Log.i(this, "makeRoomForOutgoingCall: allowing managed CS to handle "
                    + "calls from the same self-managed account");
            return CompletableFuture.completedFuture(true);
        } else if (call.getTargetPhoneAccount() == null) {
            Log.i(this, "makeRoomForOutgoingCall: no PA specified, allowing");
            // Without a phone account, we can't say reliably that the call will fail.
            // If the user chooses the same phone account as the live call, then it's
            // still possible that the call can be made (like with CDMA calls not supporting
+15 −0
Original line number Diff line number Diff line
@@ -370,6 +370,21 @@ public class CallSequencingTests extends TelecomTestCase {
        assertFalse(waitForFutureResult(resultFuture, true));
    }

    @Test
    @SmallTest
    public void testHoldCallForNewCall_DoesNotSupportHold_SameManagedPA() {
        setPhoneAccounts(mNewCall, mActiveCall, true);
        setActiveCallFocus(mActiveCall);
        when(mCallsManager.canHold(mActiveCall)).thenReturn(false);
        when(mCallsManager.supportsHold(mActiveCall)).thenReturn(false);
        when(mActiveCall.isEmergencyCall()).thenReturn(false);

        assertTrue(mController.arePhoneAccountsSame(mNewCall, mActiveCall));
        CompletableFuture<Boolean> resultFuture = mController
                .holdActiveCallForNewCallWithSequencing(mNewCall);
        assertTrue(waitForFutureResult(resultFuture, true));
    }

    @Test
    @SmallTest
    public void testHoldCallForNewCallFail_DoesNotSupportHold_Reject() {