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

Commit 06700f47 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Prevent NewOutgoingCallBroadcast from being sent for self-managed calls.

When sending a self-managed call, prevent the new outgoing call broadcast
from being sent.  It realistically has no business being sent for self
managed calls.

Test: Used Duo and Voice APKs to reproduce issue.  Verified this fix corrects it.
Bug: 66671858
Merged-In: Ibe3c08fd9190e0b9f5890c3ef5acc6d943febe2e
Change-Id: I7b5272f03bd174100cd2e12641524f4adfc1892f
parent 153aafa8
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.os.UserHandle;
import android.telecom.GatewayInfo;
import android.telecom.Log;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.DisconnectCause;
@@ -262,6 +263,21 @@ public class NewOutgoingCallIntentBroadcaster {
            return DisconnectCause.INVALID_NUMBER;
        }

        // True for all managed calls, false for self-managed calls.
        boolean sendNewOutgoingCallBroadcast = true;
        PhoneAccountHandle targetPhoneAccount = mIntent.getParcelableExtra(
                TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE);
        if (targetPhoneAccount != null) {
            PhoneAccount phoneAccount =
                    mCallsManager.getPhoneAccountRegistrar().getPhoneAccountUnchecked(
                            targetPhoneAccount);
            if (phoneAccount != null && phoneAccount.isSelfManaged()) {
                callImmediately = true;
                sendNewOutgoingCallBroadcast = false;
                Log.i(this, "Skipping NewOutgoingCallBroadcast for self-managed call.");
            }
        }

        if (callImmediately) {
            String scheme = isUriNumber ? PhoneAccount.SCHEME_SIP : PhoneAccount.SCHEME_TEL;
            boolean speakerphoneOn = mIntent.getBooleanExtra(
@@ -278,9 +294,11 @@ public class NewOutgoingCallIntentBroadcaster {
            // initiate the call again because of the presence of the EXTRA_ALREADY_CALLED extra.
        }

        if (sendNewOutgoingCallBroadcast) {
            UserHandle targetUser = mCall.getInitiatingUser();
            Log.i(this, "Sending NewOutgoingCallBroadcast for %s to %s", mCall, targetUser);
            broadcastIntent(intent, number, !callImmediately, targetUser);
        }
        return DisconnectCause.NOT_DISCONNECTED;
    }