diff --git a/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java b/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java index a54fd6425e..86642ea201 100644 --- a/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java +++ b/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java @@ -35,6 +35,7 @@ import android.os.BatteryStatsManager; import android.os.Build; import android.os.connectivity.CellularBatteryStats; import android.os.connectivity.WifiBatteryStats; +import android.platform.test.annotations.AppModeFull; import android.util.Log; import androidx.test.runner.AndroidJUnit4; @@ -80,6 +81,7 @@ public class BatteryStatsManagerTest{ } @Test + @AppModeFull(reason = "Cannot get CHANGE_NETWORK_STATE to request wifi/cell in instant mode") @SkipPresubmit(reason = "Virtual hardware does not support wifi battery stats") public void testReportNetworkInterfaceForTransports() throws Exception { try { @@ -132,6 +134,7 @@ public class BatteryStatsManagerTest{ } @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R) + @AppModeFull(reason = "Cannot get WifiManager in instant app mode") @Test public void testReportNetworkInterfaceForTransports_throwsSecurityException() throws Exception { diff --git a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt index ccc941625c..7c380e3e83 100644 --- a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt +++ b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt @@ -101,6 +101,7 @@ import com.android.testutils.RecorderCallback.CallbackEntry.Lost import com.android.testutils.TestableNetworkCallback import org.junit.After import org.junit.Assert.assertArrayEquals +import org.junit.Assume.assumeFalse import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -1034,6 +1035,9 @@ class NetworkAgentTest { @Test fun testQosCallbackRegisterWithUnregister() { + // Instant apps can't bind sockets to localhost + // TODO: use @AppModeFull when supported by DevSdkIgnoreRunner + assumeFalse(realContext.packageManager.isInstantApp()) val (agent, socket) = setupForQosCallbackTesting() val qosCallback = TestableQosCallback() @@ -1060,6 +1064,9 @@ class NetworkAgentTest { @Test fun testQosCallbackOnQosSession() { + // Instant apps can't bind sockets to localhost + // TODO: use @AppModeFull when supported by DevSdkIgnoreRunner + assumeFalse(realContext.packageManager.isInstantApp()) val (agent, socket) = setupForQosCallbackTesting() val qosCallback = TestableQosCallback() Executors.newSingleThreadExecutor().let { executor -> @@ -1104,6 +1111,9 @@ class NetworkAgentTest { @Test fun testQosCallbackOnError() { + // Instant apps can't bind sockets to localhost + // TODO: use @AppModeFull when supported by DevSdkIgnoreRunner + assumeFalse(realContext.packageManager.isInstantApp()) val (agent, socket) = setupForQosCallbackTesting() val qosCallback = TestableQosCallback() Executors.newSingleThreadExecutor().let { executor -> @@ -1142,6 +1152,9 @@ class NetworkAgentTest { @Test fun testQosCallbackIdsAreMappedCorrectly() { + // Instant apps can't bind sockets to localhost + // TODO: use @AppModeFull when supported by DevSdkIgnoreRunner + assumeFalse(realContext.packageManager.isInstantApp()) val (agent, socket) = setupForQosCallbackTesting() val qosCallback1 = TestableQosCallback() val qosCallback2 = TestableQosCallback() @@ -1182,6 +1195,9 @@ class NetworkAgentTest { @Test fun testQosCallbackWhenNetworkReleased() { + // Instant apps can't bind sockets to localhost + // TODO: use @AppModeFull when supported by DevSdkIgnoreRunner + assumeFalse(realContext.packageManager.isInstantApp()) val (agent, socket) = setupForQosCallbackTesting() Executors.newSingleThreadExecutor().let { executor -> try { diff --git a/tests/cts/net/src/android/net/cts/PacProxyManagerTest.java b/tests/cts/net/src/android/net/cts/PacProxyManagerTest.java index 7d5e9ff02e..a20f1cc1d5 100644 --- a/tests/cts/net/src/android/net/cts/PacProxyManagerTest.java +++ b/tests/cts/net/src/android/net/cts/PacProxyManagerTest.java @@ -35,6 +35,7 @@ import android.net.Proxy; import android.net.ProxyInfo; import android.net.Uri; import android.os.Build; +import android.platform.test.annotations.AppModeFull; import android.util.Log; import android.util.Range; @@ -145,6 +146,7 @@ public final class PacProxyManagerTest { } } + @AppModeFull(reason = "Instant apps can't bind sockets to localhost for a test proxy server") @Test public void testSetCurrentProxyScriptUrl() throws Exception { // Register a PacProxyInstalledListener