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

Commit ed98c45b authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Fix regression for answering a ringing call when there are 2 calls already." into pi-dev

am: e574daa1

Change-Id: I8e7b7ee43d1ef07e0db9c3c3c0ed512708670e2b
parents 5d91c692 e574daa1
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -1460,8 +1460,21 @@ public class CallsManager extends Call.ListenerBase
            Call activeCall = (Call) mConnectionSvrFocusMgr.getCurrentFocusCall();
            Log.d(this, "Incoming call = %s Ongoing call %s", call, activeCall);
            if (activeCall != null && activeCall != call) {
                // Hold the telephony call even if it doesn't have the hold capability.
                if (canHold(activeCall)) {
                // We purposely don't check if the active call CAN current hold, but rather we check
                // whether it CAN support hold.  Consider this scenario:
                // Call A - Active (CAPABILITY_SUPPORT_HOLD, but not CAPABILITY_HOLD)
                // Call B - Held (CAPABILITY_SUPPORT_HOLD, but not CAPABILITY_HOLD)
                // Call C - Incoming call
                // In this scenario we are going to first disconnect the held call (Call B), which
                // will mean that the active call (Call A) will now support hold.
                if (supportsHold(activeCall)) {
                    Call heldCall = getHeldCall();
                    if (heldCall != null) {
                        Log.i(this, "Disconnecting held call %s before holding active call.",
                                heldCall);
                        heldCall.disconnect();
                    }

                    Log.d(this, "Answer %s, hold %s", call, activeCall);
                    activeCall.hold();
                } else {
@@ -3733,6 +3746,10 @@ public class CallsManager extends Call.ListenerBase
        return call.can(Connection.CAPABILITY_HOLD);
    }

    private boolean supportsHold(Call call) {
        return call.can(Connection.CAPABILITY_SUPPORT_HOLD);
    }

    private final class ActionSetCallState implements PendingAction {

        private final Call mCall;