Set explicit destination for CALL_PRIVILEGED.

bug: 8871505
Change-Id: Ib92cfe3b3bd6b56bd69ea7744f74e570a1794b5e
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java
index ccf8bd4..d61b700 100644
--- a/src/com/android/contacts/common/CallUtil.java
+++ b/src/com/android/contacts/common/CallUtil.java
@@ -16,6 +16,7 @@
 
 package com.android.contacts.common;
 
+import android.content.ComponentName;
 import android.content.Intent;
 import android.net.Uri;
 import android.telephony.PhoneNumberUtils;
@@ -33,6 +34,9 @@
     public static final String SCHEME_IMTO = "imto";
     public static final String SCHEME_SIP = "sip";
 
+    public static final ComponentName CALL_INTENT_DESTINATION = new ComponentName(
+            "com.android.phone", "com.android.phone.PrivilegedOutgoingCallBroadcaster");
+
     /**
      * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined
      * automatically.
@@ -67,6 +71,12 @@
         if (callOrigin != null) {
             intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, callOrigin);
         }
+
+        // Set phone as an explicit component of CALL_PRIVILEGED intent.
+        // Setting destination explicitly prevents other apps from capturing this Intent since,
+        // unlike SendBroadcast, there is no API for specifying a permission on startActivity.
+        intent.setComponent(CALL_INTENT_DESTINATION);
+
         return intent;
     }