Fix flakes due to networks obtained via sync APIs
After reconnectWifiIfSupported is called, it is possible that ConnectivityManager#getAllNetworks does not return the Network, as this is mixing network callbacks and synchronous calls which is racy (as per ConnectivityManager javadoc). Ensure that networks that are reconnected in the test, wifi and cellular, are obtained through network callbacks through CtsNetUtils. Other networks are still obtained through the synchronous call, as they should not change during the test, and there would be no non-racy way to obtain them otherwise anyway as they are not guaranteed to be connected. Bug: 328331492 Test: atest (cherry picked from https://android-review.googlesource.com/q/commit:f8999e32e1e6de820ee62ee3a8becce07c512595) Merged-In: I5a511c87c64fde0276aecd6ff6599815fa08e437 Change-Id: I5a511c87c64fde0276aecd6ff6599815fa08e437
Loading
Please register or sign in to comment