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

Commit a25e1013 authored by Calvin On's avatar Calvin On Committed by android-build-merger
Browse files

Silence secondary dialing calls.

am: ab9cd2a8

Change-Id: Iad25d445d4a3b16988f4671af3b9ce87d856fc9c
parents fc242388 ab9cd2a8
Loading
Loading
Loading
Loading
+13 −9
Original line number Original line Diff line number Diff line
@@ -577,9 +577,14 @@ public class CallsManager extends Call.ListenerBase
                    rejectCallAndLog(incomingCall);
                    rejectCallAndLog(incomingCall);
                }
                }
            } else if (hasMaximumManagedDialingCalls(incomingCall)) {
            } else if (hasMaximumManagedDialingCalls(incomingCall)) {
                if (shouldSilenceInsteadOfReject(incomingCall)) {
                    incomingCall.silence();
                } else {

                    Log.i(this, "onCallFilteringCompleted: Call rejected! Exceeds maximum number of " +
                    Log.i(this, "onCallFilteringCompleted: Call rejected! Exceeds maximum number of " +
                            "dialing calls.");
                            "dialing calls.");
                    rejectCallAndLog(incomingCall);
                    rejectCallAndLog(incomingCall);
                }
            } else {
            } else {
                addCall(incomingCall);
                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
     * In the event that the maximum supported calls of a given type is reached, the
     * (connection service) from the existing ringing call when reaching maximum ringing calls.
     * 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) {
    private boolean shouldSilenceInsteadOfReject(Call incomingCall) {
        if (!mContext.getResources().getBoolean(
        if (!mContext.getResources().getBoolean(
@@ -613,8 +620,6 @@ public class CallsManager extends Call.ListenerBase
            return false;
            return false;
        }
        }


        Call ringingCall = null;

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


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