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

Commit 4de4a89b authored by Roshan Pius's avatar Roshan Pius
Browse files

Reject incoming calls when dialing a outgoing call

When an outgoing call is still being dialled, we cannot hold that call
if a new incoming call is received at the same moment. Hence reject any
incoming calls if we're still dialing an outgoing call. These incoming
calls will be logged as missed to the user in call logger.

BUG: 23428950
Change-Id: I97693afd443073ea9642d69aa67542ee1aa3eff7
parent f5c3a700
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
    private static final int MAXIMUM_LIVE_CALLS = 1;
    private static final int MAXIMUM_HOLD_CALLS = 1;
    private static final int MAXIMUM_RINGING_CALLS = 1;
    private static final int MAXIMUM_DIALING_CALLS = 1;
    private static final int MAXIMUM_OUTGOING_CALLS = 1;
    private static final int MAXIMUM_TOP_LEVEL_CALLS = 2;

@@ -244,7 +245,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        Log.d(this, "onSuccessfulIncomingCall");
        setCallState(incomingCall, CallState.RINGING, "successful incoming call");

        if (hasMaximumRingingCalls()) {
        if (hasMaximumRingingCalls() || hasMaximumDialingCalls()) {
            incomingCall.reject(false, null);
            // since the call was not added to the list of calls, we have to call the missed
            // call notifier and the call logger manually.
@@ -1454,6 +1455,10 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        return MAXIMUM_OUTGOING_CALLS <= getNumCallsWithState(OUTGOING_CALL_STATES);
    }

    private boolean hasMaximumDialingCalls() {
        return MAXIMUM_DIALING_CALLS <= getNumCallsWithState(CallState.DIALING);
    }

    private boolean makeRoomForOutgoingCall(Call call, boolean isEmergency) {
        if (hasMaximumLiveCalls()) {
            // NOTE: If the amount of live calls changes beyond 1, this logic will probably