[DO NOT MERGE] Fix BroadcastDispatcher registering with CURRENT
When a BroadcastReceiver is registered with UserHandle.CURRENT, the current user should be obtained. This has to be cached in order to not call ActivityManager every time. As it is done in the initializer the initial value caching will happen before any other BroadcastReceiver is actually registered. The caching and updating is all done in the background thread. Also, remove unnecessary dependency. Test: manual Test: atest BroadcastDispatcher Fixes: 158298581 Change-Id: Idfd2dc65f9079c57e971250aa7b0aef222da5af5
This commit is contained in:
@@ -62,7 +62,7 @@ Acquire the dispatcher by using `@Inject` to obtain a `BroadcastDispatcher`. The
|
||||
* @param executor An executor to dispatch [BroadcastReceiver.onReceive]. Pass null to use an
|
||||
* executor in the main thread (default).
|
||||
* @param user A user handle to determine which broadcast should be dispatched to this receiver.
|
||||
* By default, it is the current user.
|
||||
* By default, it is the user of the context (system user in SystemUI).
|
||||
* @throws IllegalArgumentException if the filter has other constraints that are not actions or
|
||||
* categories or the filter has no actions.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user