Skip to content

Commit d7d99c6

Browse files
committed
docs: fix permissions guide
1 parent 2d0ef7d commit d7d99c6

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
__default__: patch
3+
---
4+
5+
Add the `permissions` config flag for cross-platform permission automation, using the iOS XCTest agent for prompt auto-accept and Android `adb pm grant` for requested dangerous permissions.

website/src/docs/guides/permissions.mdx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ When `permissions` is `true`:
2525

2626
- On iOS simulators, Harness starts the XCTest agent and enables best-effort permission prompt auto-accept.
2727
- On iOS physical devices, Harness also starts the XCTest agent when the runner is configured with `device.codeSign`.
28-
- On Android emulators and physical devices, Harness uses `adb shell pm grant` to automatically grant a set of common permissions.
28+
- On Android emulators and physical devices, Harness uses `adb shell pm grant` to automatically grant the app's requested dangerous permissions.
2929

3030
## Platform-Specific Implementation Details
3131

@@ -45,23 +45,19 @@ Because this is button-based automation, it should be treated as a practical hel
4545

4646
### Android
4747

48-
On Android, Harness pre-grants a comprehensive set of common dangerous permissions using `adb shell pm grant`. This approach:
48+
On Android, Harness inspects the installed app and grants only the permissions that meet both of these conditions:
49+
50+
- The app declares the permission in its manifest
51+
- The permission is currently classified by the device as a dangerous permission
52+
53+
This approach:
4954

5055
- Grants permissions **proactively** before the app runs, avoiding permission dialogs during testing
5156
- Works on both emulators and physical devices
52-
- Includes location, camera, microphone, contacts, calendar, storage, SMS, and other common test permissions
53-
- Uses the `pm grant` command which requires API 23+ or emulated environment support
54-
55-
The default set of granted permissions includes:
56-
- Location (fine and coarse)
57-
- Camera and microphone
58-
- Contacts and calendar (read/write)
59-
- Call log (read/write)
60-
- Storage (read/write)
61-
- Phone state and calling
62-
- SMS (read/send/receive)
63-
- Body sensors
64-
- Network state and internet
57+
- Avoids trying to grant normal permissions such as `INTERNET` that do not require a runtime grant
58+
- Uses `adb shell pm grant` for each matching permission
59+
60+
In practice, apps commonly end up having permissions such as camera, microphone, location, contacts, calendar, storage, SMS, or sensors granted automatically, but the exact set depends on what the app requests.
6561

6662
## Performance Impact
6763

0 commit comments

Comments
 (0)