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
Loading
Please register or sign in to comment