Skip to content
Commit 4dda2323 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

New MessageRouter interface to replace Handler.

Proposal introduced in http://go/sysui-message-router

This introduces a testable, controllerable MessageRouter interface
intended to replace Handler#sendMessage. Listeners subscribe to
specific messages rather than subclassing Handler.

Also, metadata can be passed in any form, rather than the generic
android.os.Message.

To use, developers simply inject either an @Main or a @Background
MessageRouter. This provides them with a new instance of a
MessageRouter, tied to the corresponding Executor.

As an example, the internal Handler subclass in GarbageMonitor has
been replaced. There is an overall reduction in the number of lines
of code, and the corresponding test has been refactored to be more
deterministic and useful.

Bug: 191077376
Test: atest SystemUITests

Change-Id: Ibd1e05b1b5b7421c2085d8811b8f5cd61cf0ffde
parent ed048c6a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment