From b887009f0a658a33a7a51185982f1374c366ca0c Mon Sep 17 00:00:00 2001 From: Jacob Hobbie Date: Wed, 17 Nov 2021 12:40:26 -0800 Subject: [PATCH] Updating documentation for broadcast receivers. Forgot to propagate updated flag documentation to all versions of register receiver, and needed to include a link to system broadcasts (which has replaced all instances of the term protected broadcasts). Test: comments only, not needed Bug: 202146686 Change-Id: I61804cd3f3738093bc8a08d2bff6c7a5a863e7f1 --- core/java/android/content/Context.java | 53 ++++++++++++++++++-------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index e6df79ed26953..4b5111e5cacd8 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3004,10 +3004,11 @@ public abstract class Context { * {@link android.os.Build.VERSION_CODES#TIRAMISU}, * either {@link #RECEIVER_EXPORTED} or * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered - * for protected broadcasts or an exception will be thrown. If + * for + * system broadcasts or an exception will be thrown. If * {@link #RECEIVER_EXPORTED} is specified, a receiver may additionally * specify {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}. For a complete list of - * protected broadcast actions, see the BROADCAST_ACTIONS.TXT file in the + * system broadcast actions, see the BROADCAST_ACTIONS.TXT file in the * Android SDK. If both {@link #RECEIVER_EXPORTED} and * {@link #RECEIVER_NOT_EXPORTED} are specified, an exception will be thrown as * well. @@ -3082,12 +3083,18 @@ public abstract class Context { * no permission is required. * @param scheduler Handler identifying the thread that will receive * the Intent. If null, the main thread of the process will be used. - * @param flags Additional options for the receiver. As of - * Android T, either {@link #RECEIVER_EXPORTED} or + * @param flags Additional options for the receiver. For apps targeting + * {@link android.os.Build.VERSION_CODES#TIRAMISU}, + * either {@link #RECEIVER_EXPORTED} or * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered - * for protected broadcasts, and may additionally specify - * {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS} if {@link #RECEIVER_EXPORTED} is - * specified. + * for + * system broadcasts or an exception will be thrown. If + * {@link #RECEIVER_EXPORTED} is specified, a receiver may additionally + * specify {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}. For a complete list of + * system broadcast actions, see the BROADCAST_ACTIONS.TXT file in the + * Android SDK. If both {@link #RECEIVER_EXPORTED} and + * {@link #RECEIVER_NOT_EXPORTED} are specified, an exception will be thrown as + * well. * * @return The first sticky intent found that matches filter, * or null if there are none. @@ -3146,10 +3153,18 @@ public abstract class Context { * no permission is required. * @param scheduler Handler identifying the thread that will receive * the Intent. If {@code null}, the main thread of the process will be used. - * @param flags Additional options for the receiver. As of - * Android T, either {@link #RECEIVER_EXPORTED} or - * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being - * registered for protected broadcasts + * @param flags Additional options for the receiver. For apps targeting + * {@link android.os.Build.VERSION_CODES#TIRAMISU}, + * either {@link #RECEIVER_EXPORTED} or + * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered + * for + * system broadcasts or an exception will be thrown. If + * {@link #RECEIVER_EXPORTED} is specified, a receiver may additionally + * specify {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}. For a complete list of + * system broadcast actions, see the BROADCAST_ACTIONS.TXT file in the + * Android SDK. If both {@link #RECEIVER_EXPORTED} and + * {@link #RECEIVER_NOT_EXPORTED} are specified, an exception will be thrown as + * well. * * @return The first sticky intent found that matches filter, * or {@code null} if there are none. @@ -3213,10 +3228,18 @@ public abstract class Context { * no permission is required. * @param scheduler Handler identifying the thread that will receive * the Intent. If null, the main thread of the process will be used. - * @param flags Additional options for the receiver. As of - * Android T, either {@link #RECEIVER_EXPORTED} or - * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being - * registered for protected broadcasts + * @param flags Additional options for the receiver. For apps targeting + * {@link android.os.Build.VERSION_CODES#TIRAMISU}, + * either {@link #RECEIVER_EXPORTED} or + * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered + * for + * system broadcasts or an exception will be thrown. If + * {@link #RECEIVER_EXPORTED} is specified, a receiver may additionally + * specify {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}. For a complete list of + * system broadcast actions, see the BROADCAST_ACTIONS.TXT file in the + * Android SDK. If both {@link #RECEIVER_EXPORTED} and + * {@link #RECEIVER_NOT_EXPORTED} are specified, an exception will be thrown as + * well. * * @return The first sticky intent found that matches filter, * or null if there are none.