diff options
author | 2022-03-22 16:52:30 +0000 | |
---|---|---|
committer | 2022-03-24 13:40:51 +0000 | |
commit | f2606d0f1d175d5bc8c9df36f7c4783e3fd0b711 (patch) | |
tree | a45236519d3b8e647b7a9ec4d3b67ae37e3cf64f | |
parent | 27df8ca3654ea9d470bfcd4e9f476ca48b7edf12 (diff) |
Update BroadcastDispatcher docs to say not to call goAsync()
Shouldn't be needed within sysui as we're not worried about the process
being killed.
Change-Id: I14977770123c9b41fec1ac556a539cb8f09b9f2b
-rw-r--r-- | packages/SystemUI/docs/broadcasts.md | 6 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/packages/SystemUI/docs/broadcasts.md b/packages/SystemUI/docs/broadcasts.md index e75ae29f407d..0a357251ea36 100644 --- a/packages/SystemUI/docs/broadcasts.md +++ b/packages/SystemUI/docs/broadcasts.md @@ -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. diff --git a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt index bbb75c3521c1..0ff5805ab111 100644 --- a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt +++ b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt @@ -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, |