Use synchronization rather than locking in WifiTracker.
This vastly simplifies WifiTracker usage. The existing locking behavior closed a lock on thread A, depended on thread B to open it, and would block on Thread A until thread B did. However, thread B can also block on this lock, hence if Thread A closes the lock between thread B opening it and blocking on it, and deadlock would result in an ANR that would crash WifiSettings (see b/37530557 for another example). All work on the WorkHandler is now synchronized, as a preliminary step to removing the worker thread altogether, pending discussions with original author on the threads creation. Also fix test flakiness, an indirect byproduct of now simplifying concurrency issues in this class. Fixes b/37581732. Together with the other changes in this topic, this CL resolves all known wifi picker jank and no ANRs have been witnessed. Bug: b/37504190 Test: runtest --path frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java Change-Id: I0e47a4d50372beb2d141189276b1a4d9230c0d98
Loading
Please register or sign in to comment