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

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

Merge "Partial revert of Ic0055a53ac85980fa22136a5c8b6cb59be347da9" into lmp-dev

parents 5aed1294 a348438f
Loading
Loading
Loading
Loading
+1 −28
Original line number Diff line number Diff line
@@ -447,12 +447,7 @@ public final class CallsManager extends Call.ListenerBase {
        call.setExtras(extras);

        // Do not add the call if it is a potential MMI code.
        // We also want to skip adding the call if there is a broadcast receiver which could
        // intercept the outgoing call and cancel it.  We do this to ensure that we do not show the
        // InCall UI for the cancelled call.  If the call is not intercepted, it will be added in
        // {@link CallsManager#onSuccessfulOutgoingCall}.
        if (isPotentialMMICode(handle) || isPotentialInCallMMICode ||
                (!isEmergencyCall && canOutgoingCallBroadcastsBeIntercepted())) {
        if (isPotentialMMICode(handle) || isPotentialInCallMMICode) {
            call.addListener(this);
        } else {
            addCall(call);
@@ -1202,28 +1197,6 @@ public final class CallsManager extends Call.ListenerBase {
        return true;
    }

    /**
     * Determines if the {@link Intent#ACTION_NEW_OUTGOING_CALL} intent can be received by another
     * package with priority 0, potentially providing the ability to cancel the intent before it
     * is received.
     *
     * @return {@code true} if the intent can be intercepted by another
     */
    private boolean canOutgoingCallBroadcastsBeIntercepted() {
        PackageManager packageManager = mContext.getPackageManager();
        Intent intent = new Intent(Intent.ACTION_NEW_OUTGOING_CALL);
        List<ResolveInfo> receivers = packageManager.queryBroadcastReceivers(intent, 0);

        for (ResolveInfo info : receivers) {
            // Check for an interceptor with priority 0; this would potentially receive the
            // broadcast before Telecom and cancel it.
            if (info.priority == 0) {
                return true;
            }
        }
        return false;
    }

    /**
     * Dumps the state of the {@link CallsManager}.
     *