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

Commit 44d7fae5 authored by Roshan Pius's avatar Roshan Pius Committed by Android Git Automerger
Browse files

am 9608c400: am 9a017a3c: am af557380: Merge "Reject incoming calls when...

am 9608c400: am 9a017a3c: am af557380: Merge "Reject incoming calls when dialing a outgoing call" into mnc-dr-dev

* commit '9608c400':
  Reject incoming calls when dialing a outgoing call
parents 63b88426 9608c400
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