Skip to content

Commit

Permalink
am 195eb02: Set explicit destination for CALL_PRIVILEGED.
Browse files Browse the repository at this point in the history
* commit '195eb0250eaffee9c928954313b128f057847ec0':
  Set explicit destination for CALL_PRIVILEGED.
  • Loading branch information
Santos Cordon authored and Android Git Automerger committed May 13, 2013
2 parents 82d2edd + 195eb02 commit 26752ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/com/android/contacts/common/CallUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 26752ac

Please sign in to comment.