fix(android): let permission all change nothing on an app that declares no permissions
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 on6c1e3207d), base854bba6c5. 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 clean854bba6c5checkout 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. Oncom.callstack.agentdevice.imehelper, which declares no permissions:- Base (0.21.40):
COMMAND_FAILED. - Head: grant, deny and reset
allreturnpermissions: []and a warning. - Head:
grant camerafails beforepm.
- Base (0.21.40):
- On an app that declares permissions,
reset allthengrant allworks as before.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.