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

Commit ad3355a3 authored by Andrew Lee's avatar Andrew Lee Committed by Android (Google) Code Review
Browse files

Merge "Refuse outgoing call if max outgoing exceeded." into lmp-dev

parents c673b996 e659518b
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;
@@ -1036,6 +1033,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) {