Skip to content
Commit 81168164 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Add warnings for leaked receivers in tests

This CL adds a way to track BroadcastReceivers that are leaking in test
cases that use SysuiTestCase (all of SystemUITests). Every receiver that
is registered with Context is recorded and those that are not
unregistered are logged as a Warning. After each test, receivers are
unregistered so they don't polute following tests.

Additionally, if a BroadcastDispatcher is instantiated, a Fake is
provided that will also track leaked receivers and log them as Info (as
BroadcastDispatcher will only keep WeakReferences).

This is a separate tracker done directly in SysuiTestableContext instead
of using LeakCheckedTest or a LeakChecker as that is usually pretty
stringent (it will fail the test).

Test: SystemUITests
Bug: 151614195
Change-Id: I11afb49ce3bbc51d98fa069ba4074c852d07bcce
parent a7dae497
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