Add CHANGE_NETWORK_STATE and INTERNET permission for IpClientRootTests. Some root test cases create a NetworkAgent to request a network and send UDP packets on that network, e.g. Send UDP packets after IPv4 provisioning to trigger the tap interface to do the address resolution process. Add the required permissions for root tests, then we can delete @SignatureRequiredTest annotation on test cases. Test: atest NetworkStackRootTests Change-Id: If5902ba52db6381c2c178e9193c655042ec842a2
diff --git a/tests/integration/AndroidManifest_root.xml b/tests/integration/AndroidManifest_root.xml index 02b82c5..ffc859a 100644 --- a/tests/integration/AndroidManifest_root.xml +++ b/tests/integration/AndroidManifest_root.xml
@@ -16,6 +16,10 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.server.networkstack.roottests"> + <!-- Used by requesting a network and sending packet on that network. --> + <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> + <uses-permission android:name="android.permission.INTERNET" /> + <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> </application>
diff --git a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java index c3da990..a4ba3b2 100644 --- a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java +++ b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java
@@ -4332,7 +4332,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock the NetworkAgent") public void testIpReachabilityMonitor_macAddressChangedWithoutRoam_ok() throws Exception { setFeatureChickenedOut(IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION, @@ -4341,7 +4340,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock the NetworkAgent") public void testIpReachabilityMonitor_macAddressChangedWithoutRoam_disconnect() throws Exception { setFeatureChickenedOut(IP_REACHABILITY_ROUTER_MAC_CHANGE_FAILURE_ONLY_AFTER_ROAM_VERSION, @@ -4427,7 +4425,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock NetworkAgent") public void testIpReachabilityMonitor_incompleteIpv6DnsServerInDualStack() throws Exception { final Inet6Address targetIp = (Inet6Address) InetAddresses.parseNumericAddress(IPV6_ON_LINK_DNS_SERVER); @@ -4438,7 +4435,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock NetworkAgent") public void testIpReachabilityMonitor_incompleteIpv6DnsServerInDualStack_flagoff() throws Exception { final Inet6Address targetIp = @@ -4450,7 +4446,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock the NetworkAgent") public void testIpReachabilityMonitor_incompleteIpv6DefaultRouterInDualStack() throws Exception { runIpReachabilityMonitorAddressResolutionTest(IPV6_OFF_LINK_DNS_SERVER, @@ -4461,7 +4456,6 @@ } @Test - @SignatureRequiredTest(reason = "Need to mock the NetworkAgent") public void testIpReachabilityMonitor_incompleteIpv6DefaultRouterInDualStack_flagoff() throws Exception { runIpReachabilityMonitorAddressResolutionTest(IPV6_OFF_LINK_DNS_SERVER,