Skip network requests in MultinetworkApiTest for instant mode
MultinetworkApiTest would attempt to request cellular and Wi-Fi network connections in test setup. This requires the CHANGE_NETWORK_STATE permission, which is not granted to the instant app. Therefore, skip the network requests if the tests are running in instant mode. Bug: 413261962 Test: atest android.net.cts.MultinetworkApiTest --instant Flag: EXEMPT bug fix Change-Id: I64366a4f2528402d3050adb54bb0aea352c53088
This commit is contained in:
parent
cfa9a2e9b6
commit
37c39d0af6
1 changed files with 6 additions and 2 deletions
|
|
@ -112,8 +112,12 @@ public class MultinetworkApiTest {
|
|||
final Context context = InstrumentationRegistry.getInstrumentation().getContext();
|
||||
mCM = context.getSystemService(ConnectivityManager.class);
|
||||
mCtsNetUtils = new CtsNetUtils(context);
|
||||
mNetworkCallbackRule.requestCellIfSupported();
|
||||
mNetworkCallbackRule.requestWifiIfSupported();
|
||||
// In instant mode, do not request cell or Wi-Fi connection, as this requires the
|
||||
// CHANGE_NETWORK_STATE permission which cannot be granted.
|
||||
if (!context.getApplicationInfo().isInstantApp()) {
|
||||
mNetworkCallbackRule.requestCellIfSupported();
|
||||
mNetworkCallbackRule.requestWifiIfSupported();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in a new issue