Remove IPC calls from synchronized block.

updateAccessPointsLocked holds mLock to avoid concurrent modifications.
When WifiSettings onStop is called, it calls the trackers stopTracking
method, it is also synchonized on mLock, hence the main thread is blocked
until updateAccessPoints finished. If the IPCs take too long, this can
cause an ANR. Refactor the IPC calls outside of the synchonized block to
avoid this condition.

Also mark certain tests as flakey.

Bug: b/62343176
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I2b6aff8fafe859dfc1a5192c2d352a65cfa73cbb
2 files changed