From 042ebce713b2ea761ce58173823b78dcd75104ba Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Fri, 21 Mar 2025 21:05:33 +0900 Subject: [PATCH] Grant the NEARBY_WIFI_DEVICES permission to VpnHostside tests Fix forward for b/405308292 Background: new / existing runtime permission is now used to guard access to local networks. apps / tests now need to hold this permission to do traffic with local devices. Test: CtsHostsideNetworkTests, TH Bug: 405308292 Change-Id: Ib4892cc817946c74094bfc5d9c54a95bb17ad30b --- tests/cts/hostside/app/AndroidManifest.xml | 1 + .../app/src/com/android/cts/net/hostside/VpnTest.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tests/cts/hostside/app/AndroidManifest.xml b/tests/cts/hostside/app/AndroidManifest.xml index e0f4cdc156..2ef53b98a2 100644 --- a/tests/cts/hostside/app/AndroidManifest.xml +++ b/tests/cts/hostside/app/AndroidManifest.xml @@ -27,6 +27,7 @@ + diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java index 6c92b74348..29e2ebb205 100755 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java @@ -267,6 +267,11 @@ public class VpnTest { mNetwork = null; mTestContext = getInstrumentation().getContext(); mTargetContext = getInstrumentation().getTargetContext(); + getInstrumentation() + .getUiAutomation() + .grantRuntimePermission( + "com.android.cts.net.hostside", + "android.permission.NEARBY_WIFI_DEVICES"); storePrivateDnsSetting(); mDevice = UiDevice.getInstance(getInstrumentation()); mActivity = launchActivity(mTargetContext.getPackageName(), MyActivity.class);