Repository navigation
fix(adb): count requested permissions that the device marks restricted - #2359
Merged
morluto merged 1 commit intoOct 13, 2026
Merged
Conversation
Android 10 and 11 print restricted entries of the requested-permissions list as "NAME: restricted=true". The parser took the first such line as the end of the list, so the count stopped there while coverage still read complete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Owner
|
@greptileai review |
Contributor
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
Contributor
|
3 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inspect_adb_packageundercountsrequested_permissions_counton Android 10 and 11 devices, and still reportscoverage: "complete". The count stops at the first permission the device marks as restricted.No issue is linked: I found this while reading the
dumpsys packageparser, and it is an ordinary fix inside the existing ADB provider.Problem and expected behavior
Smallest trigger:
dumpsys packageoutput in which a requested permission carries the restricted marker.On Android 10 and 11,
Settings.dumpPackageLPrappends: restricted=trueto every hard- or soft-restricted entry of that list (android11-releaseSettings.java;android10-releaseprints it too). Theandroid12-release,android13-releaseandandroid14-releasebranches no longer print it.parseDumpsysPackageOutputaccepted only bare names (/^\s{2,}[A-Za-z0-9._]+$/), so the marked line ended the section and the permissions after it were not counted. The example above gives 1; the list holds 3. The provider's own limitation text says "requested_permissions_count counts the listed requested permissions section only".Expected: every entry of the section is counted, with or without the marker.
Change and scope
The entry pattern in
src/adb/AdbShellOutput.tsnow also accepts the exact: restricted=truesuffix. Nothing else about section detection changes, so the followinginstall permissions:lines (NAME: granted=true) are still outside the count.Not included: the parser adds up every
requested permissions:section it meets. I did not verify whether real output repeats that header for one package, so I left that alone.Follow the contribution scope.
Scope decision: not applicable.
Contract and boundary impact
parseDumpsysPackageOutputinsrc/adb/AdbShellOutput.ts.requested_permissions_countis higher on affected devices.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated: one case in
src/adb/AdbProvider.test.tsthat runs the output above throughinspect_adb_packagewith the existing adb stub and expects a count of 3.Base reproduction or other evidence (executed): without the fix the new test gets 1. The output format is source-derived from the AOSP branches named above.
User-visible CLI/MCP output (executed with
REA_ADB_PATHpointing at a stand-in adb that prints the output above), forrea inspect-adb-package emulator-5554 com.example:Remaining proof gaps: not run against a real Android 10 or 11 device; the fixture follows the AOSP printing code.
For evidence-bearing changes:
Validation performed
macOS 15.6.1 arm64, Node 24.18.0, npm 11.16.0.
npm run test:local -- src/adb/AdbProvider.test.ts— 48 passednpx vitest run src/adb— 5 files, 104 tests passednpm run test:focused -- tests/boundary/cli/adbCli.test.ts tests/boundary/mcp/adbMcp.test.ts tests/boundary/mcp/adbStartMcp.test.ts tests/boundary/process/adbDirectoryListing.test.ts tests/boundary/providers/adb/adbBugreportPublication.test.ts— 5 files, 21 tests passednpm run check— passednpm run check:fast— passedNot run:
npm run check:pr,npm run docs:check(no contract or generated metadata changes), and no real-device lane.Compatibility, safety, and release
This touches
src/adb/AdbProvider.test.tslike #2344 and #2354, in a different place; I will rebase whichever lands later.Before merge
type(scope): outcome.AI assistance (Claude Code, model Claude Opus 5.5) was used for investigation, implementation and running the tests locally.
🤖 Generated with Claude Code