Loading
Fix flaky WifiTrackerTest
The rssiChangeBroadcastShouldUpdateConnectedAp uses two CountDownLatch instances to synchronize the events on the main thread and the handler thread. The "latch" informs the main thread that mockWifiManager.getConnectionInfo() has been called and allows it to proceed, and "mAccessPointsChangedLatch" notes that onAccessPointsChanged is called. But mAccessPointsChangedLatch was assigned after "latch" released the main thread, so that on occasion the main thread could try to use it before this assignment, causing the timeout. Move the assignment of mAccessPointsChangedLatch to before the body of the test to prevent this race. Bug: 70163367 Test: runtest --path frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java Change-Id: I62c1ef9a2155ffbd08b5e07e94723b28102d1f6d