d2bd9db36a817cb41bfa6045ce8a8e6904977526
The version of ConnectivityManagerTest#waitForAvailable that takes a callback and a Network implicitly requires that the network be validated, because it calls expectAvailableCallbacks with validated=true. This is incorrect because a network can become available without being validated. In particular, testMobileDataPreferredUids is flaky due to this problem, because it calls connectToCell, which does not wait for validation, and then calls waitForAvailable, which expects that the network is already validated. Fix it by not requiring any particular validation state. This method is only used by a few tests and they should not be affected by this change: - The first two calls in testSetOemNetworkPreferenceForTestPref happen after waiting for validation, so the network is validated already. The third call waits for a test network, and test networks are always validated. - The first call in testSetOemNetworkPreferenceForTestOnlyPref waits for a test network, which is always validated. The second is incorrect because ensureWifiConnected does not wait for validation, and is fixed by this CL. - The calls in testMobileDataPreferredUids similarly incorrectly assume that wifi is validated and are fixed by this CL. Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testMobileDataPreferredUids Change-Id: I614d0ba87c3931fcbe4011fed379e1736f5c4a44
Description
android_packages_modules_Connectivity
Languages
Java
81.4%
Kotlin
7.7%
AIDL
4.5%
C++
4.5%
C
1.7%
Other
0.1%