From 3891ed5eba0cf6165ad69a279095c9c2cc564d8d Mon Sep 17 00:00:00 2001 From: Paul Hu Date: Thu, 19 May 2022 15:18:36 +0800 Subject: [PATCH] Fix test failure on S image + S module aosp/2085868 has not included in a tethering train build and it probably will be included in a T module release. But the test in that CL has been put to the S MTS test. Thus, fix the test failure on S image + S module. Bug: 233019430 Test: atest CtsNetTestCasesLatestSdk:android.net.cts\ .ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks on the S image + S module device. Change-Id: Iafb26a1c80c48232a76050d4c8c21e2de2c21207 --- .../net/cts/ConnectivityManagerTest.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java index 8f6786f151..3b881890a9 100644 --- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java +++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java @@ -3235,14 +3235,16 @@ public class ConnectivityManagerTest { // TODD: Have a significant signal to know the uids has been sent to netd. assertBindSocketToNetworkSuccess(network); - // Uid is in allowed list. Try file network request again. - requestNetwork(restrictedRequest, restrictedNetworkCb); - // Verify that the network is restricted. - restrictedNetworkCb.eventuallyExpect(CallbackEntry.NETWORK_CAPS_UPDATED, - NETWORK_CALLBACK_TIMEOUT_MS, - entry -> network.equals(entry.getNetwork()) - && (!((CallbackEntry.CapabilitiesChanged) entry).getCaps() - .hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED))); + if (TestUtils.shouldTestTApis()) { + // Uid is in allowed list. Try file network request again. + requestNetwork(restrictedRequest, restrictedNetworkCb); + // Verify that the network is restricted. + restrictedNetworkCb.eventuallyExpect(CallbackEntry.NETWORK_CAPS_UPDATED, + NETWORK_CALLBACK_TIMEOUT_MS, + entry -> network.equals(entry.getNetwork()) + && (!((CallbackEntry.CapabilitiesChanged) entry).getCaps() + .hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED))); + } } finally { agent.unregister();