summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-05-09 18:42:28 -0700
committerSantos Cordon <santoscordon@google.com>2013-05-10 11:32:27 -0700
commit195eb0250eaffee9c928954313b128f057847ec0 (patch)
treebaf9f1acdbb9b8f93d09f8b0153cf32f11724739
parente89462d28ddc234cb228632dbc89a64643fc403e (diff)
downloadpackages_apps_ContactsCommon-195eb0250eaffee9c928954313b128f057847ec0.tar.gz
packages_apps_ContactsCommon-195eb0250eaffee9c928954313b128f057847ec0.tar.bz2
packages_apps_ContactsCommon-195eb0250eaffee9c928954313b128f057847ec0.zip
Set explicit destination for CALL_PRIVILEGED.
bug: 8871505 Change-Id: Ib92cfe3b3bd6b56bd69ea7744f74e570a1794b5e
-rw-r--r--src/com/android/contacts/common/CallUtil.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java
index ccf8bd40..d61b700e 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 class CallUtil {
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;
}