From 60b26ee4535d367e3e512bdc258b37c18062425d Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Mon, 22 Mar 2021 21:11:35 +0900 Subject: [PATCH] Mark most VpnServiceTest methods as @AppModeFull. In S, instant apps can no longer access the system service that backs the VPN APIs, so these tests started to fail in instant mode. Regardless of that change in S, though, instant apps cannot create VPNs because they cannot access the package manager. Previously, the tests were only passing because they did not check that the VPN would actually work, they only checked that the VPN API calls failed. Fix: 181575083 Test: atest --instant CtsNetTestCases:VpnServiceTest Change-Id: Idd35051bd1c908a8b85c02e8d0c54d3dea2dde38 --- tests/cts/net/src/android/net/cts/VpnServiceTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/cts/net/src/android/net/cts/VpnServiceTest.java b/tests/cts/net/src/android/net/cts/VpnServiceTest.java index 15af23c6f8..5c7b5ca082 100644 --- a/tests/cts/net/src/android/net/cts/VpnServiceTest.java +++ b/tests/cts/net/src/android/net/cts/VpnServiceTest.java @@ -47,6 +47,7 @@ public class VpnServiceTest extends AndroidTestCase { assertEquals(1, count); } + @AppModeFull(reason = "establish() requires prepare(), which requires PackageManager access") public void testEstablish() throws Exception { ParcelFileDescriptor descriptor = null; try { @@ -62,7 +63,7 @@ public class VpnServiceTest extends AndroidTestCase { } } - @AppModeFull(reason = "Socket cannot bind in instant app mode") + @AppModeFull(reason = "Protecting sockets requires prepare(), which requires PackageManager") public void testProtect_DatagramSocket() throws Exception { DatagramSocket socket = new DatagramSocket(); try { @@ -77,6 +78,7 @@ public class VpnServiceTest extends AndroidTestCase { } } + @AppModeFull(reason = "Protecting sockets requires prepare(), which requires PackageManager") public void testProtect_Socket() throws Exception { Socket socket = new Socket(); try { @@ -91,7 +93,7 @@ public class VpnServiceTest extends AndroidTestCase { } } - @AppModeFull(reason = "Socket cannot bind in instant app mode") + @AppModeFull(reason = "Protecting sockets requires prepare(), which requires PackageManager") public void testProtect_int() throws Exception { DatagramSocket socket = new DatagramSocket(); ParcelFileDescriptor descriptor = ParcelFileDescriptor.fromDatagramSocket(socket);