[automerge] Update BroadcastDispatcher docs to say not to call goAsync() 2p: f2606d0f1d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17324983

Change-Id: I07f05d0102b1463fb97289f8073cf5d8ff679796
This commit is contained in:
Matt Casey
2022-03-24 13:43:54 +00:00
committed by Presubmit Automerger Backend
2 changed files with 8 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ The dispatcher supports `BroadcastReceiver` dynamic subscriptions in the followi
* The `IntentFilter` may or may not contain categories.
* The `IntentFilter` **does not** contain data types, data schemes, data authorities or data paths.
* The broadcast **is not** gated behind a permission.
* The broadcast **is not** ordered and doesn't need to set result data.
Additionally, the dispatcher supports the following:
@@ -107,3 +108,8 @@ fun unregisterReceiverForUser(BroadcastReceiver, UserHandle)
```
Unregistering can be done even if the `BroadcastReceiver` has never been registered with `BroadcastDispatcher`. In that case, it is a No-Op.
### A note on goAsync()
If you're processing a broadcast in a background thread, you shouldn't call `goAsync()` and
`finish()`. The system will keep sysui alive regardless, so it isn't needed.

View File

@@ -60,6 +60,8 @@ private const val DEBUG = true
* Use only for IntentFilters with actions and optionally categories. It does not support,
* permissions, schemes, data types, data authorities or priority different than 0.
* Cannot be used for getting sticky broadcasts (either as return of registering or as re-delivery).
* Broadcast handling may be asynchronous *without* calling goAsync(), as it's running within sysui
* and doesn't need to worry about being killed.
*/
open class BroadcastDispatcher constructor (
private val context: Context,