Skip to content
Commit cfab8e00 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Fix WMS instance leakage of WmTests

It may be common to register a non-static inner class object
to DeviceConfig.addOnPropertiesChangedListener:
 WindowManagerConstants
 HighRefreshRateDenylist
 SplashScreenExceptionList
 WindowOrientationListener.OrientationSensorJudge
That may hold reference chain to WindowManagerService.

It may be annoying to add test-only code to dispose them
once a new path is added, so hook the registration to
make sure that all listeners can be released after a test
method is finished.

For test using FakeDeviceConfig, it only registers to
the local fake instance, so it doesn't need to dispose.

Bug: 219640050
Test: atest SystemServicesTestRuleTest

Change-Id: Ic06d85978886caaea3a9eb123a7a59712b58bb92
Merged-In: Ic06d85978886caaea3a9eb123a7a59712b58bb92
parent 4ab6dfe7
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