Skip to content

fix(android): let permission all change nothing on an app that declares no permissions - #4796

Merged
thymikee merged 1 commit into
callstack:mainfrom
imranbarbhuiya:fix/android-grant-all-no-permissions
Nov 20, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
imranbarbhuiya:fix/android-grant-all-no-permissions

Conversation

@imranbarbhuiya

@imranbarbhuiya imranbarbhuiya commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On Android, settings permission <grant|deny|reset> all --app <pkg> failed with COMMAND_FAILED: Could not read declared permissions for an app that declares no permissions. Android prints no requested permissions: section for such a package, so a client that sets all before each launch could not launch it.

Now a dump counts as declaring nothing only when it reaches the acting user's empty runtime permissions: block and has no install permissions: section. all then changes nothing and warns. Unreadable dumps still refuse before any pm call, as do named targets. A shared-user-id package has no per-user runtime block, so it still refuses, as before.

4 files. No linked issue.

Validation

  • Head ce216dc47 (device run on 6c1e3207d), base 854bba6c5.
  • check:affected --run --head ce216dc47 (exactCommit: true): format, lint, typecheck, layering, fallow, build and vitest-related pass.
    • unit: 21198 pass, 1 fails: upload-http-deadline.test.ts ("did not complete in 3s"). It fails the same way on a clean 854bba6c5 checkout on this macOS host.
    • Checks skipped after it pass alone: test:integration:provider (308), check:command-docs, check:doc-links, check:doc-prose.
  • Pixel 9 AVD, Android 16 (API 36), source 6c1e3207d, node bin/agent-device.mjs settings permission <action> <target> --app <pkg> --platform android --serial emulator-5554. On com.callstack.agentdevice.imehelper, which declares no permissions:
    • Base (0.21.40): COMMAND_FAILED.
    • Head: grant, deny and reset all return permissions: [] and a warning.
    • Head: grant camera fails before pm.
  • On an app that declares permissions, reset all then grant all works as before.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

…es no permissions

Android prints no requested permissions section for a package with no
<uses-permission>, so permission all refused it as an unreadable dump and
an app launch with all failed. A dump that reaches the user's empty
runtime block with no install section now reads as declaring nothing.

A package with a shared user id gets no per-user runtime block, so one
that declares nothing still refuses, as before.
@thymikee

Copy link
Copy Markdown
Member

This PR is ready at 6c1e320: permission all now changes nothing on an app that declares no permissions, and the code has no problems. CI is green, with 14 checks and none failing at this head, and that includes the Android unit lane and the docs checks for the edited commands.md line. There are no conflicts. Nothing blocks merge. The live Android 16 emulator record in the PR body covers the changed route.

Not blocking, and you can take or leave these: in settings-permission.test.ts the new named-target test hand-rolls its assert.rejects check where assertRejectsAppError is the file's helper (add the typed permissions detail to ExpectedAppError and use it), and the two new refusal cases match the message regex where they could assert details.appPackage. The doc block on readAndroidPackagePermissions in permission-grant-state.ts still says all always refuses, so it should state the empty-declared answer. The NO_PERMISSIONS_DUMP named-target test could also cover deny and reset, since named revoke and reset now take the new empty branch. Last, it is unclear whether Android prints a requested permissions: section for an install-only package, so a test that names that case and keeps it refusing would show the boundary.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
@thymikee
thymikee merged commit 9429721 into callstack:main Nov 20, 2026
14 checks passed
@imranbarbhuiya

imranbarbhuiya commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Edit: #4796 merged at 6c1e320 before this push, so ce216dc isn't in main. I can send it as a small follow-up PR if you want these test changes.

Thanks. I took all of them in ce216dc (tests and one doc comment, no runtime change).

  • Typed details: ExpectedAppError now carries typed appPackage and permissions. The named-target test uses assertRejectsAppError with both, and the all refusal cases assert details.appPackage instead of the message regex.
  • Doc comment: the block on readAndroidPackagePermissions now states the empty-declared answer. all changes nothing, and a named target refuses before pm.
  • Named revoke and reset: the NO_PERMISSIONS_DUMP named-target test covers grant, deny and reset for camera. Each refuses with no pm call.
  • Install-only boundary: I checked on the Android 16 emulator. com.android.systemui.accessibility.accessibilitymenu declares only install permissions (CONTROL_DISPLAY_BRIGHTNESS, MANAGE_USERS), and its dump still prints requested permissions: beside the install section, with an empty runtime permissions: block. So it never takes the new path. grant all on it with this branch returns permissions: [] and one "Skipped … not a changeable permission type" warning per id, with no "declares no permissions" warning. A new test pins that case with a requested section listing INTERNET, an install section and an empty runtime block. The existing refusal case keeps covering an install section with no requested section.

check:affected --run --head ce216dc47 (exactCommit: true): everything passes except the same upload-http-deadline.test.ts failure noted in the body, which also fails on a clean 854bba6c5 on this host. The checks it skipped pass on their own: test:integration:provider (308), check:command-docs, check:doc-links and check:doc-prose. The two permission test files pass 63 tests. Turning off the declares-nothing check fails all 6 tests that cover it.

thymikee added a commit to pcbeingused333/agent-device that referenced this pull request Nov 20, 2026
* origin/main: (70 commits)
  refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (callstack#4774)
  fix(android): require acknowledgements for test IME typing (callstack#4722)
  feat(scroll): add scroll refresh for pull-to-refresh (callstack#4770)
  refactor(host-kit): add request Scope and use it for the wait capture deadline (callstack#4794)
  fix(android): let permission all change nothing on an app that declares no permissions (callstack#4796)
  fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (callstack#4797)
  fix(host-kit): accept a group-writable script directory the user owns (callstack#4799)
  fix(cli): escape control characters at the CLI's stdout and stderr writes (callstack#4778)
  fix(audit): do not report rows under a persistent bar that scrolling reveals (callstack#4775)
  fix(daemon): refuse an unsafe state directory before first use (callstack#4783)
  refactor: settle remaining single-deadline races through settleWithin (callstack#4788)
  refactor(host-kit): settle deadline races via settleWithin with R87 race ratchet (callstack#4766)
  fix(android): authenticate and bound persistent snapshot helper sessions (callstack#4729)
  fix(daemon): bound upload ingress and finalization (callstack#4721)
  chore(gates): ratchet wire-published reason literals by value (R89) (callstack#4779)
  feat(audit): evaluate role-less clickable views on Android (callstack#4780)
  fix(mutation): keep umask-setting tests out of Stryker's thread pool (callstack#4785)
  feat(audit): report controls that share one accessible name (callstack#4771)
  fix(contracts): pair open runtime hints with their apply operation (callstack#4754)
  refactor(daemon): report startup progress over the launch channel instead of marker files (callstack#4777)
  ...
thymikee added a commit that referenced this pull request Nov 20, 2026
* origin/main:
  feat(gesture): hold before the move with gesture pan --hold-ms (#4767)
  docs: clarify device verification and security proposals (#4805)
  fix(daemon-client): say that a hung daemon is stopped before ensureDaemon starts a new one (#4803)
  test: remove five timing races from CI (#4800)
  refactor(remote): save a remote script from memory with the local publisher (#4802)
  refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (#4774)
  fix(android): require acknowledgements for test IME typing (#4722)
  feat(scroll): add scroll refresh for pull-to-refresh (#4770)
  refactor(host-kit): add request Scope and use it for the wait capture deadline (#4794)
  fix(android): let permission all change nothing on an app that declares no permissions (#4796)
  fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (#4797)
  fix(host-kit): accept a group-writable script directory the user owns (#4799)
imranbarbhuiya added a commit to imranbarbhuiya/e2e that referenced this pull request Nov 24, 2026
…sions fails with 'all'

agent-device 0.21.42, which main now pins, leaves such an app unchanged under permission all (callstack/agent-device#4796), so the launch goes ahead.
mikolajadamowicz pushed a commit to mikolajadamowicz/e2e that referenced this pull request Nov 25, 2026
…c#1918)

* feat(app): grant every permission with app.permissions: 'all'

A mobile() target sends one agent-device 'permission all grant' before each
fresh launch, and device.openApp takes 'all' for one launch. A web() target
grants every permission its browser grants. A map of names is unchanged.

* fix(mobile): grant each permission for 'all' on iOS, and test it on the benchmark app

The iOS simulator ignores the all service simctl privacy grant all records,
so the microphone still prompted. 'all' now grants every DevicePermission but
notifications, which the simulator refuses to set, one by one; Android keeps
agent-device's single all grant. A benchmark test asks for the microphone
after permissions: 'all' and fails on a system dialog.

* docs(app): name the iOS notifications gap and the Android-only Appium capability

* fix(mobile): skip an iOS service the runtime refuses under permissions 'all', and show 'all' in the reference types

List the iOS services 'all' grants explicitly, so a future Android-only
permission name never reaches simctl. Mirror the 'all' type in the config,
engine and mobile references (en, ja, zh), and keep the changeset and
reference to what users see.

* docs(app): describe permissions 'all' in the ja and zh config reference, and name the iOS runtime skip

Mirror the OpenAppOptions.permissions JSDoc in the mobile reference, and
say in the changeset and LaunchPermissions that iOS skips a permission its
runtime does not support.

* fix(app): require core and e2e 0.24.1 in web and mobile for permissions 'all'

core 0.24.0 refuses permissions: 'all' at config load, so a web or mobile
release that documents it needs the core release that accepts it.

* refactor(mobile): grant permissions 'all' on iOS in one agent-device all

agent-device 0.21.40 expands an iOS all grant to each privacy service
itself and skips one the runtime refuses, notifications included, so the
engine sends one all on both platforms. iOS now grants location always.

* docs(mobile): say Android 'all' grants runtime permissions, and fails for an app that declares none

* docs(mobile): name the Android no-permissions caveat in the Maestro row, and point presetPermissions at LaunchPermissions

* docs(mobile): put the Android no-permissions caveat next to the Android clause in the Maestro row

* fix(app): require core and e2e 0.25.0 in web and mobile, the release that ships permissions all

The pending release versions core and e2e to 0.25.0, so 0.24.1 is never published.

* fix(app): engines opt in to permissions 'all' with grantsAllPermissions, and web skips names an older browser does not know

- EngineAppInfo.permissions stays a map of names; 'all' reaches an engine
  that declares grantsAllPermissions as allPermissions. Config load refuses
  'all' for any other engine, so one released before 'all' never reads the
  string as a map.
- For 'all', web leaves out a permission type the browser refuses as unknown
  (Chrome 134 over CDP refuses localNetworkAccess) and grants the rest; a
  named grant still fails.

* docs(changeset): engines receive allPermissions: true, not the string 'all'

* docs(web): say which refused permission types 'all' can skip

* docs(mobile): drop the caveat that an Android app declaring no permissions fails with 'all'

agent-device 0.21.42, which main now pins, leaves such an app unchanged under permission all (callstack/agent-device#4796), so the launch goes ahead.

* fix(app): stop the 'all' config error at what the engine does not take

desktop() refuses a named permissions map too, so telling its target to name
each permission sent the user to a second error.

* docs(web): name the three permissions an older Chrome may skip under 'all'

* test(web): start an attempt under 'all' on a browser that refuses one name

* test(mobile): check the app as config load hands it under 'all'

* test(protocol): carry allPermissions into prepare, and compare grantsAllPermissions in the manifest

* docs(core): say launch() takes permissions 'all', linking the config reference

* docs(mobile): drop SYSTEM_ALERT_WINDOW from permissions 'all' docs

agent-device 0.21.42 sends declared permissions other than notifications and photos through pm grant, which skips SYSTEM_ALERT_WINDOW as not changeable.

---------

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants