Skip to content

feat(apktool): decode Android resource tables through a caller-supplied launcher - #1556

Merged
morluto merged 5 commits into
morluto:mainfrom
3QL:feat/apktool-resources
Oct 10, 2026
Merged

morluto merged 5 commits into
morluto:mainfrom
3QL:feat/apktool-resources

Conversation

@3QL

@3QL 3QL commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

feat(apktool): decode Android resource tables through a caller-supplied launcher

Implements the Apktool stage of the Android roadmap #717 ("resource ID/XML/locale inspection through Apktool" — the unclaimed piece of the First milestone). With JADX (code), JEB (engine-grade decompilation), and this family (resources), the static Android triad is complete; acquisition and device observation are covered by the ADB family.

Summary

Add an apktool-provider family with two operations over the caller's apktool launcher (REA_APKTOOL_COMMAND, absolute, or apktool on PATH — the same selection pattern as the ADB binary; REA never installs Apktool or Java):

  • inspect_apktool_client — resolved launcher, selection source, version. Decodes nothing; a missing launcher reports capability_unavailable with the REA_APKTOOL_COMMAND remediation.
  • decode_android_resources — runs apktool d --no-src in a provider-owned workspace that is removed before the result returns (an unremovable workspace is named in the limitations, never silently abandoned), then projects:
    • the decoded AndroidManifest.xml text (bounded at 512 KiB, truncation reported),
    • apktool.yml metadata exactly as printed (versionName/versionCode keep their own quoting; SDK range; package_name read from the decoded manifest, not inferred),
    • string resources verbatim — default table or one locale (values-<locale>/strings.xml), bounded to 2,000 entries with coverage: "partial" beyond; escaped entities stay escaped; entries with nested markup are counted as unparsed instead of flattened,
    • every available string locale, and the decoded file count (capped at 100k, cap reported),
    • target.sha256/bytes — the APK is digested before decoding, so Evidence binds the observation to the exact input.

Smali production is skipped by design (--no-src): Java-source recovery belongs to the JADX family. Smali edits and rebuild are a follow-up lane with mutation authority.

Verification

  • 27 module/adapter/service tests with parser goldens taken from a real decode; provider behavior through #!/bin/sh launcher stubs (happy path, locale projection, missing tables noted rather than failed, apktool's own AndrolibException preserved as unsupported_target, missing launcher → capability gap, unreadable target → input refusal, cancellation before spawn).
  • Real-engine lane (npm run verify:apktool): apktool 2.7.0-dirty (Debian packaging) on Linux with OpenJDK 25, against a signed aapt2-built probe APK with two resource locales — launcher version, on-disk digest agreement with the reported target identity, metadata projection (1.2.3, SDK 24–34), manifest package agreement, and both string tables (default + de) projected through the locale option. CLI and MCP surfaces verified against the same launcher.
  • check:fast, docs:generate, docs:check, and 3,400+ tests across domain/services/adapters/composition pass.

Docs

  • New docs/apktool-resource-analysis.md (supply tools, semantics, budgets) and a verification record in docs/testing.md.
  • README analysis table gains an "Android resources" row in English and all 17 translations, following each language's conventions.

Towards #717. No engine, SDK, or tool installation; no new runtime dependencies.

…ed launcher

Add an Apktool family with two operations over the caller's apktool
launcher (REA_APKTOOL_COMMAND, absolute, or apktool on PATH):

- inspect_apktool_client: resolved launcher, selection source, and
  version; decodes nothing.
- decode_android_resources: apktool d --no-src in a provider-owned
  workspace that is removed before the result returns. Projects the
  decoded AndroidManifest.xml (bounded at 512 KiB), apktool.yml version
  and SDK facts exactly as printed, string resources verbatim (default or
  one locale, bounded at 2000 entries, nested-markup entries counted as
  unparsed), available string locales, and the decoded file count with a
  hard cap. The target APK is digested with SHA-256 before decoding so
  Evidence binds the observation to the exact input.

Smali production is skipped by design: Java-source recovery belongs to
the JADX family. Workspace cleanup happens before results return; an
unremovable workspace is named in the limitations instead of abandoned.

Verified against apktool 2.7.0-dirty (Debian packaging) on Linux with
OpenJDK 25 against a signed aapt2-built probe APK with two resource
locales: launcher version, on-disk digest agreement, metadata projection,
manifest package agreement, and both string tables (default and de).
Parser goldens come from the same decode. READMEs carry the new
'Android resources' row in every supported language.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

# Conflicts:
#	README_ar.md
#	README_de.md
#	README_es.md
#	README_fa.md
#	README_fr.md
#	README_ja.md
#	README_ko.md
#	README_pl.md
#	README_pt-BR.md
#	README_ru.md
#	README_th.md
#	README_tr.md
#	README_uk.md
#	README_vi.md
#	README_zh-TW.md
#	README_zh.md
# Conflicts:
#	README.md
#	README_ar.md
#	README_de.md
#	README_es.md
#	README_fa.md
#	README_fr.md
#	README_id.md
#	README_ja.md
#	README_ko.md
#	README_pl.md
#	README_pt-BR.md
#	README_ru.md
#	README_th.md
#	README_tr.md
#	README_uk.md
#	README_vi.md
#	README_zh-TW.md
#	README_zh.md
#	docs/testing.md
#	package.json
#	scripts/lib/catalog-builders.mjs
#	scripts/lib/catalog-core.mjs
#	src/cli.ts
#	src/cliCommandNames.ts
#	src/contracts/toolContractTypes.ts
#	src/contracts/toolContracts.ts
#	src/contracts/toolEffects.ts
#	src/server/createServer.ts
#	vitest.config.ts
@morluto
morluto merged commit 96fd98c into morluto:main Oct 10, 2026
10 of 11 checks passed
@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thanks @3QL for adding Android resource decoding through a caller-supplied Apktool launcher! Squash merged with the review fixes for snapshot identity, resource limits, locales, cancellation, and cleanup. Thank you for all three contributions.

@31420jmm-hash

Copy link
Copy Markdown

Hola disculpa

@morluto morluto added the enhancement New feature or request label Oct 14, 2026
@morluto morluto added provider: apktool Analysis provider / engine: apktool area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: apktool Analysis provider / engine: apktool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants