Skip to content
Commit 7006b45b authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Android Build Coastguard Worker
Browse files

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
parent 3c198510
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