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

Commit e659518b authored by Andrew Lee's avatar Andrew Lee
Browse files

Refuse outgoing call if max outgoing exceeded.

This bug was happening because multiple calls in the CONNECTING state
were being added. Now, if there's an attempt to place multiple calls,
ignore when the maximum number of outgoing calls is exceeded.

Exception: if the outgoing call is an emergency call, cancel the
current outgoing call if the current outgoing call is not an
emergency call itself.

Bug: 17610917
Change-Id: I0ae041fa3a09a2fb9508f2342894e77b87001b43
parent 150d8684
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.telecom;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.CallLog.Calls;
import android.telecom.AudioState;
import android.telecom.CallState;
@@ -30,12 +29,10 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.PhoneCapabilities;
import android.telephony.TelephonyManager;

import com.android.internal.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -1028,6 +1025,20 @@ public final class CallsManager extends Call.ListenerBase {
            // have to change.
            Call liveCall = getFirstCallWithState(call, LIVE_CALL_STATES);

            if (hasMaximumOutgoingCalls()) {
                // Disconnect the current outgoing call if it's not an emergency call. If the user
                // tries to make two outgoing calls to different emergency call numbers, we will try
                // to connect the first outgoing call.
                if (isEmergency) {
                    Call outgoingCall = getFirstCallWithState(OUTGOING_CALL_STATES);
                    if (!outgoingCall.isEmergencyCall()) {
                        outgoingCall.disconnect();
                        return true;
                    }
                }
                return false;
            }

            if (hasMaximumHoldingCalls()) {
                // There is no more room for any more calls, unless it's an emergency.
                if (isEmergency) {