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

Commit ab9cd2a8 authored by Calvin On's avatar Calvin On
Browse files

Silence secondary dialing calls.

Devices may already be configured to silence instead
of reject secondary ringing calls. This extends that
configuration to silence instead of reject secondary
dialing calls as well.

Bug: 115587328
Test: make checkbuild
Change-Id: I9e1ab9615bf9603d9424b54b8456ae9cbaddcd15
parent 715b5c83
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -577,9 +577,14 @@ public class CallsManager extends Call.ListenerBase
                    rejectCallAndLog(incomingCall);
                }
            } else if (hasMaximumManagedDialingCalls(incomingCall)) {
                if (shouldSilenceInsteadOfReject(incomingCall)) {
                    incomingCall.silence();
                } else {

                    Log.i(this, "onCallFilteringCompleted: Call rejected! Exceeds maximum number of " +
                            "dialing calls.");
                    rejectCallAndLog(incomingCall);
                }
            } else {
                addCall(incomingCall);
            }
@@ -604,8 +609,10 @@ public class CallsManager extends Call.ListenerBase
    }

    /**
     * Whether allow (silence rather than reject) the incoming call if it has a different source
     * (connection service) from the existing ringing call when reaching maximum ringing calls.
     * In the event that the maximum supported calls of a given type is reached, the
     * default behavior is to reject any additional calls of that type.  This checks
     * if the device is configured to silence instead of reject the call, provided
     * that the incoming call is from a different source (connection service).
     */
    private boolean shouldSilenceInsteadOfReject(Call incomingCall) {
        if (!mContext.getResources().getBoolean(
@@ -613,8 +620,6 @@ public class CallsManager extends Call.ListenerBase
            return false;
        }

        Call ringingCall = null;

        for (Call call : mCalls) {
            // Only operate on top-level calls
            if (call.getParentCall() != null) {
@@ -625,8 +630,7 @@ public class CallsManager extends Call.ListenerBase
                continue;
            }

            if (CallState.RINGING == call.getState() &&
                    call.getConnectionService() == incomingCall.getConnectionService()) {
            if (call.getConnectionService() == incomingCall.getConnectionService()) {
                return false;
            }
        }