diff options
Diffstat (limited to 'core/java/android/app/PendingIntent.java')
-rw-r--r-- | core/java/android/app/PendingIntent.java | 72 |
1 files changed, 60 insertions, 12 deletions
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 031854a..c42ba65 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -613,7 +613,7 @@ public final class PendingIntent implements Parcelable { * is no longer allowing more intents to be sent through it. */ public void send() throws CanceledException { - send(null, 0, null, null, null, null); + send(null, 0, null, null, null, null, null); } /** @@ -627,7 +627,7 @@ public final class PendingIntent implements Parcelable { * is no longer allowing more intents to be sent through it. */ public void send(int code) throws CanceledException { - send(null, code, null, null, null, null); + send(null, code, null, null, null, null, null); } /** @@ -646,9 +646,9 @@ public final class PendingIntent implements Parcelable { * @throws CanceledException Throws CanceledException if the PendingIntent * is no longer allowing more intents to be sent through it. */ - public void send(Context context, int code, Intent intent) + public void send(Context context, int code, @Nullable Intent intent) throws CanceledException { - send(context, code, intent, null, null, null); + send(context, code, intent, null, null, null, null); } /** @@ -667,9 +667,9 @@ public final class PendingIntent implements Parcelable { * @throws CanceledException Throws CanceledException if the PendingIntent * is no longer allowing more intents to be sent through it. */ - public void send(int code, OnFinished onFinished, Handler handler) + public void send(int code, @Nullable OnFinished onFinished, @Nullable Handler handler) throws CanceledException { - send(null, code, null, onFinished, handler, null); + send(null, code, null, onFinished, handler, null, null); } /** @@ -705,9 +705,9 @@ public final class PendingIntent implements Parcelable { * @throws CanceledException Throws CanceledException if the PendingIntent * is no longer allowing more intents to be sent through it. */ - public void send(Context context, int code, Intent intent, - OnFinished onFinished, Handler handler) throws CanceledException { - send(context, code, intent, onFinished, handler, null); + public void send(Context context, int code, @Nullable Intent intent, + @Nullable OnFinished onFinished, @Nullable Handler handler) throws CanceledException { + send(context, code, intent, onFinished, handler, null, null); } /** @@ -748,8 +748,56 @@ public final class PendingIntent implements Parcelable { * @throws CanceledException Throws CanceledException if the PendingIntent * is no longer allowing more intents to be sent through it. */ - public void send(Context context, int code, Intent intent, - OnFinished onFinished, Handler handler, String requiredPermission) + public void send(Context context, int code, @Nullable Intent intent, + @Nullable OnFinished onFinished, @Nullable Handler handler, + @Nullable String requiredPermission) + throws CanceledException { + send(context, code, intent, onFinished, handler, requiredPermission, null); + } + + /** + * Perform the operation associated with this PendingIntent, allowing the + * caller to specify information about the Intent to use and be notified + * when the send has completed. + * + * <p>For the intent parameter, a PendingIntent + * often has restrictions on which fields can be supplied here, based on + * how the PendingIntent was retrieved in {@link #getActivity}, + * {@link #getBroadcast}, or {@link #getService}. + * + * @param context The Context of the caller. This may be null if + * <var>intent</var> is also null. + * @param code Result code to supply back to the PendingIntent's target. + * @param intent Additional Intent data. See {@link Intent#fillIn + * Intent.fillIn()} for information on how this is applied to the + * original Intent. Use null to not modify the original Intent. + * If flag {@link #FLAG_IMMUTABLE} was set when this pending intent was + * created, this argument will be ignored. + * @param onFinished The object to call back on when the send has + * completed, or null for no callback. + * @param handler Handler identifying the thread on which the callback + * should happen. If null, the callback will happen from the thread + * pool of the process. + * @param requiredPermission Name of permission that a recipient of the PendingIntent + * is required to hold. This is only valid for broadcast intents, and + * corresponds to the permission argument in + * {@link Context#sendBroadcast(Intent, String) Context.sendOrderedBroadcast(Intent, String)}. + * If null, no permission is required. + * @param options Additional options the caller would like to provide to modify the sending + * behavior. May be built from an {@link ActivityOptions} to apply to an activity start. + * + * @see #send() + * @see #send(int) + * @see #send(Context, int, Intent) + * @see #send(int, android.app.PendingIntent.OnFinished, Handler) + * @see #send(Context, int, Intent, OnFinished, Handler) + * + * @throws CanceledException Throws CanceledException if the PendingIntent + * is no longer allowing more intents to be sent through it. + */ + public void send(Context context, int code, @Nullable Intent intent, + @Nullable OnFinished onFinished, @Nullable Handler handler, + @Nullable String requiredPermission, @Nullable Bundle options) throws CanceledException { try { String resolvedType = intent != null ? @@ -759,7 +807,7 @@ public final class PendingIntent implements Parcelable { onFinished != null ? new FinishedDispatcher(this, onFinished, handler) : null, - requiredPermission); + requiredPermission, options); if (res < 0) { throw new CanceledException(); } |