diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-04-18 12:02:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-18 12:02:42 +0000 |
commit | 53babdfee5540721798942693cc4f9c731d68635 (patch) | |
tree | 142663559a2174026a4ddde95dee5268c6abcac4 | |
parent | 7e6f10ce0ad0643f2fe5f04f566875ba32ee7101 (diff) | |
parent | 82e396394bd2a67a0d905ceee2de31e69ecebd6f (diff) | |
download | Connectivity-53babdfee5540721798942693cc4f9c731d68635.tar.gz |
Merge "Return current testable networks directly in instant mode" into main
-rw-r--r-- | tests/cts/net/src/android/net/cts/MultinetworkApiTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java b/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java index 73f65e019d..06a827b646 100644 --- a/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java +++ b/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java @@ -265,6 +265,14 @@ public class MultinetworkApiTest { * Get all testable Networks with internet capability. */ private Set<Network> getTestableNetworks() throws InterruptedException { + // Calling requestNetwork() to request a cell or Wi-Fi network via CtsNetUtils or + // NetworkCallbackRule requires the CHANGE_NETWORK_STATE permission. This permission cannot + // be granted to instant apps. Therefore, return currently available testable networks + // directly in instant mode. + if (mContext.getApplicationInfo().isInstantApp()) { + return new ArraySet<>(mCtsNetUtils.getTestableNetworks()); + } + // Obtain cell and Wi-Fi through CtsNetUtils (which uses NetworkCallbacks), as they may have // just been reconnected by the test using NetworkCallbacks, so synchronous calls may not // yet return them (synchronous calls and callbacks should not be mixed for a given |