Fixing flakiness of AppStandbyController test.
Since AppStandbyController uses a handler to notify listeners of a state change,
there is some inherent latency between changing the state and getting the
notification. testEnabledState needs to wait until the paroleListener has
been notified that parole is on before continuing with the test.
In order to test this, I added Thread.sleep(27) to
informParoleStateChanged. Without this change, the test fails every few
iterations. With the change, the test doesn't fail.
Bug: 119774928
Test: for i in `seq 10`; do atest com.android.server.usage.AppStandbyControllerTests#testEnabledState; done
Change-Id: Ic5c7313d6bca18c966837ba357615aa4619edec6
1 file changed