Skip to content
Commit 992588ca authored by Michael Plass's avatar Michael Plass
Browse files

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
parent c9f1a9e3
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