You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: website/src/docs/guides/permissions.mdx
+11-15Lines changed: 11 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ When `permissions` is `true`:
25
25
26
26
- On iOS simulators, Harness starts the XCTest agent and enables best-effort permission prompt auto-accept.
27
27
- 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.
29
29
30
30
## Platform-Specific Implementation Details
31
31
@@ -45,23 +45,19 @@ Because this is button-based automation, it should be treated as a practical hel
45
45
46
46
### Android
47
47
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:
49
54
50
55
- Grants permissions **proactively** before the app runs, avoiding permission dialogs during testing
51
56
- 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.
0 commit comments