From 195eb0250eaffee9c928954313b128f057847ec0 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 9 May 2013 18:42:28 -0700 Subject: [PATCH] Set explicit destination for CALL_PRIVILEGED. bug: 8871505 Change-Id: Ib92cfe3b3bd6b56bd69ea7744f74e570a1794b5e --- src/com/android/contacts/common/CallUtil.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java index ccf8bd406..d61b700e7 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 class CallUtil { 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 @@ public static Intent getCallIntent(Uri uri, String callOrigin) { 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; }