[Thread] grant the NEARBY_WIFI_DEVICES permission to Thread tests

Fix forward for b/405297285

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: atest ThreadNetworkIntegrationTests
Bug: 405297285
Change-Id: I31aaf147a9f9bd8fab7640b935a163405d31e2b9
This commit is contained in:
Kangping Dong 2025-03-21 17:07:26 +08:00
commit 340c5ca514
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,7 @@
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.THREAD_NETWORK_PRIVILEGED"/>
<uses-permission android:name="android.permission.NETWORK_SETTINGS"/>
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:debuggable="true">

View file

@ -27,6 +27,8 @@ import static android.net.thread.utils.IntegrationTestUtils.waitFor;
import static android.net.thread.utils.ThreadNetworkControllerWrapper.JOIN_TIMEOUT;
import static android.os.SystemClock.elapsedRealtime;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
import static com.android.compatibility.common.util.SystemUtil.runShellCommandOrThrow;
import static com.android.testutils.TestPermissionUtil.runAsShell;
@ -121,6 +123,12 @@ public class ThreadIntegrationTest {
@Before
public void setUp() throws Exception {
getInstrumentation()
.getUiAutomation()
.grantRuntimePermission(
"com.android.thread.tests.integration",
"android.permission.NEARBY_WIFI_DEVICES");
mExecutor = Executors.newSingleThreadExecutor();
mFtd = new FullThreadDevice(10 /* nodeId */);
mOtCtl = new OtDaemonController();