Backport sendBroadcastAsUserMultiplePermissions to oc-dev

Bug: 159373687
Test: Verify Settings still works correctly.

Change-Id: I857ea00cc58a0abbb77960643f361dd6dd9c8b56
Merged-In: I857ea00cc58a0abbb77960643f361dd6dd9c8b56
This commit is contained in:
Tyler Gunn
2018-04-26 14:43:31 -07:00
committed by David Su
parent dcc3d1d5fd
commit ea7ef4ad2a
7 changed files with 70 additions and 0 deletions

View File

@@ -1950,6 +1950,33 @@ public abstract class Context {
public abstract void sendBroadcastMultiplePermissions(Intent intent,
String[] receiverPermissions);
/**
* Broadcast the given intent to all interested BroadcastReceivers, allowing
* an array of required permissions to be enforced. This call is asynchronous; it returns
* immediately, and you will continue executing while the receivers are run. No results are
* propagated from receivers and receivers can not abort the broadcast. If you want to allow
* receivers to propagate results or abort the broadcast, you must send an ordered broadcast
* using {@link #sendOrderedBroadcast(Intent, String)}.
*
* <p>See {@link BroadcastReceiver} for more information on Intent broadcasts.
*
* @param intent The Intent to broadcast; all receivers matching this
* Intent will receive the broadcast.
* @param user The user to send the broadcast to.
* @param receiverPermissions Array of names of permissions that a receiver must hold
* in order to receive your broadcast.
* If null or empty, no permissions are required.
*
* @see android.content.BroadcastReceiver
* @see #registerReceiver
* @see #sendBroadcast(Intent)
* @see #sendOrderedBroadcast(Intent, String)
* @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)
* @hide
*/
public abstract void sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user,
String[] receiverPermissions);
/**
* Broadcast the given intent to all interested BroadcastReceivers, allowing
* an optional required permission to be enforced. This

View File

@@ -448,6 +448,13 @@ public class ContextWrapper extends Context {
mBase.sendBroadcastMultiplePermissions(intent, receiverPermissions);
}
/** @hide */
@Override
public void sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user,
String[] receiverPermissions) {
mBase.sendBroadcastAsUserMultiplePermissions(intent, user, receiverPermissions);
}
/** @hide */
@SystemApi
@Override