Reduce memory leak in NetworkMonitorTest
This change includes:
1. Fix thread leak of probing threads. This won't impact
production code since probing threads would be naturally
terminated after probe timeouts.
But this will impact tests since the threads are not
terminated when leaving the tests, causes NPE when
accessing resources which are no longer exist.
2. Clear inline mocks which hold the references of test
instances and caused 32MB of memory leak.
3. Add @MonitorThreadLeak annotation in the test to ensure
no thread leak problem in the future.
Test: atest ConnectivityCoverageTests:com.android.networkstack.com.android.server.connectivity.NetworkMonitorTest
(With memory leak detect patches applied)
Fix: 321606002
Change-Id: I7b88b9da7c8fe93ef17d116ae83c29872f8094eb
2 files changed