diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-08-29 22:37:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-29 22:37:48 +0000 |
commit | e56665cd4eddf4666d4c0b53c65bc2cf1c9ab4ac (patch) | |
tree | 39e0775d5cee9d56f757fc985c7b76dce351ed15 /core | |
parent | bd6937841983230bd65dc08548367caa7d409238 (diff) | |
parent | 2c3530061fc3194fd1e654ae67ede91d45a1d3c4 (diff) | |
download | frameworks_base-e56665cd4eddf4666d4c0b53c65bc2cf1c9ab4ac.zip frameworks_base-e56665cd4eddf4666d4c0b53c65bc2cf1c9ab4ac.tar.gz frameworks_base-e56665cd4eddf4666d4c0b53c65bc2cf1c9ab4ac.tar.bz2 |
Merge "Oh sticky broadcasts, I'd like to do even worse to you." into lmp-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/content/Context.java | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index b7d7c25..f979a0c 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1486,8 +1486,6 @@ public abstract class Context { * @see #sendBroadcast(Intent) * @see #sendBroadcast(Intent, String) * @see #sendOrderedBroadcast(Intent, String) - * @see #sendStickyBroadcast(Intent) - * @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) * @see android.content.BroadcastReceiver * @see #registerReceiver * @see android.app.Activity#RESULT_OK @@ -1584,7 +1582,7 @@ public abstract class Context { @Nullable Bundle initialExtras); /** - * Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the + * <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the * Intent you are sending stays around after the broadcast is complete, * so that others can quickly retrieve that data through the return * value of {@link #registerReceiver(BroadcastReceiver, IntentFilter)}. In @@ -1595,6 +1593,12 @@ public abstract class Context { * permission in order to use this API. If you do not hold that * permission, {@link SecurityException} will be thrown. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast, and the Intent will be held to * be re-broadcast to future receivers. @@ -1602,10 +1606,11 @@ public abstract class Context { * @see #sendBroadcast(Intent) * @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) */ + @Deprecated public abstract void sendStickyBroadcast(Intent intent); /** - * Version of {@link #sendStickyBroadcast} that allows you to + * <p>Version of {@link #sendStickyBroadcast} that allows you to * receive data back from the broadcast. This is accomplished by * supplying your own BroadcastReceiver when calling, which will be * treated as a final receiver at the end of the broadcast -- its @@ -1622,6 +1627,12 @@ public abstract class Context { * * <p>See {@link BroadcastReceiver} for more information on Intent broadcasts. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast. * @param resultReceiver Your own BroadcastReceiver to treat as the final @@ -1644,31 +1655,45 @@ public abstract class Context { * @see #registerReceiver * @see android.app.Activity#RESULT_OK */ + @Deprecated public abstract void sendStickyOrderedBroadcast(Intent intent, BroadcastReceiver resultReceiver, @Nullable Handler scheduler, int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras); /** - * Remove the data previously sent with {@link #sendStickyBroadcast}, + * <p>Remove the data previously sent with {@link #sendStickyBroadcast}, * so that it is as if the sticky broadcast had never happened. * * <p>You must hold the {@link android.Manifest.permission#BROADCAST_STICKY} * permission in order to use this API. If you do not hold that * permission, {@link SecurityException} will be thrown. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent that was previously broadcast. * * @see #sendStickyBroadcast */ + @Deprecated public abstract void removeStickyBroadcast(Intent intent); /** - * Version of {@link #sendStickyBroadcast(Intent)} that allows you to specify the + * <p>Version of {@link #sendStickyBroadcast(Intent)} that allows you to specify the * user the broadcast will be sent to. This is not available to applications * that are not pre-installed on the system image. Using it requires holding * the INTERACT_ACROSS_USERS permission. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast, and the Intent will be held to * be re-broadcast to future receivers. @@ -1676,10 +1701,11 @@ public abstract class Context { * * @see #sendBroadcast(Intent) */ + @Deprecated public abstract void sendStickyBroadcastAsUser(Intent intent, UserHandle user); /** - * Version of + * <p>Version of * {@link #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)} * that allows you to specify the * user the broadcast will be sent to. This is not available to applications @@ -1688,6 +1714,12 @@ public abstract class Context { * * <p>See {@link BroadcastReceiver} for more information on Intent broadcasts. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast. * @param user UserHandle to send the intent to. @@ -1705,13 +1737,14 @@ public abstract class Context { * * @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) */ + @Deprecated public abstract void sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, @Nullable Handler scheduler, int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras); /** - * Version of {@link #removeStickyBroadcast(Intent)} that allows you to specify the + * <p>Version of {@link #removeStickyBroadcast(Intent)} that allows you to specify the * user the broadcast will be sent to. This is not available to applications * that are not pre-installed on the system image. Using it requires holding * the INTERACT_ACROSS_USERS permission. @@ -1720,11 +1753,18 @@ public abstract class Context { * permission in order to use this API. If you do not hold that * permission, {@link SecurityException} will be thrown. * + * @deprecated Sticky broadcasts should not be used. They provide no security (anyone + * can access them), no protection (anyone can modify them), and many other problems. + * The recommended pattern is to use a non-sticky broadcast to report that <em>something</em> + * has changed, with another mechanism for apps to retrieve the current value whenever + * desired. + * * @param intent The Intent that was previously broadcast. * @param user UserHandle to remove the sticky broadcast from. * * @see #sendStickyBroadcastAsUser */ + @Deprecated public abstract void removeStickyBroadcastAsUser(Intent intent, UserHandle user); /** |