Skip to content

Phase 3: App Manager metadata, label resolution, GUI/CLI detail views - #2

Open
arena-ai-coding-agent[bot] wants to merge 1 commit into
mainfrom
arena/019feb0a-adbpureflow
Open

Phase 3: App Manager metadata, label resolution, GUI/CLI detail views#2
arena-ai-coding-agent[bot] wants to merge 1 commit into
mainfrom
arena/019feb0a-adbpureflow

Conversation

@arena-ai-coding-agent

Copy link
Copy Markdown

Summary

Phase 3 builds on the shared internal/adb core introduced in Phase 2 (this PR also lands the Phase 2 shared-core / CI-release / CLI+GUI rewrite that was pending on this branch) and focuses on making installed applications understandable and inspectable.

Shared core (internal/adb)

  • Expanded Package model with UID, MinSdk, TargetSdk, Enabled, and SplitCodePaths.
  • Added presentation helpers Package.DisplayTitle(), Package.VersionSummary(), and adb.FormatMillis().
  • enrichFromDumpsys now parses minSdk=/targetSdk=, splitCodePaths=[…], uid=/userId=, and User 0: installed=false state.
  • New resolveLabels() runs two best-effort, device-side-only label passes (no aapt, no APK pulls):
    1. A single batched dumpsys package <pkg> | grep 'applicationLabel=|…' over packages whose dumpsys applicationLabel= is a resource ID.
    2. A single batched cmd package resolve-activity -c android.intent.category.LAUNCHER <pkg> | grep '^label=|…' fallback for launcher apps.
  • Resource IDs (0x7f…) and numeric noise are filtered out; labels are never fabricated. Callers fall back to Package.Name via DisplayTitle().
  • Added Manager.PackageInfo() convenience for the new detail views.

GUI

  • Compact two-line app-list items: bold human-readable label (primary), monospace package name (secondary), version tag on the right.
  • New Details action opens a focused detail view: large bold app name (label → package fallback), monospace package name, a back button, and a widget.Form showing Type, Version, Enabled, Installer, APK path, Split APKs, UID, Target SDK, Min SDK, First installed, Last updated. Inline Launch / Force Stop / Uninstall buttons reuse the shared core; confirmation dialogs are retained for destructive actions.
  • Detail view refreshes when apps refresh and auto-closes if the package disappears (e.g. after uninstall).
  • Search matches both label and package name; Install APK… / Mirror / Refresh functionality preserved; no drag-and-drop, no decorative dashboards.

CLI

  • New info [<pkg>|n] command (aliases: show, details) in both REPL and non-interactive modes, rendering the same structured metadata as the GUI (em-dashes for unknown fields).
  • REPL caches the most recent apps/search listing; launch/stop/uninstall/info accept a numeric index or prompt interactively when no argument is given.
  • apps output now includes the resolved label. All existing scriptable subcommand syntax is preserved.

CI/CD

  • Phase 1 CI/release automation (.github/workflows/release.yml, .github/scripts/*, PR template, RELEASING/CONTRIBUTING docs, version linker-stamping for CLI/GUI) ships as part of this branch.
  • Note: the CI workflow update that adds go vet/go test coverage for the new internal/ module is intentionally not included in this PR. The GitHub App token used here lacks workflows permission and GitHub rejects pushes that modify workflow files without it; a maintainer with workflows:write should make the following small follow-up change to .github/workflows/ci.yml:
    • add internal/go.mod to each cache-dependency-path,
    • run gofmt -l CLI GUI internal,
    • add cd internal && go vet ./… and cd internal && go test -v -race ./… steps.
  • Release workflow (release.yml) already references internal/go.mod via the module replace directives; no release-pipeline behavior is broken.

Validation

  • Added/updated unit tests (all device-free, using representative dumpsys / cmd package outputs):
    • UID, split APK, min/target SDK, User 0: installed=false parsing.
    • Per-package label parsing across 6 output variants (plain string, quoted string, resource-ID skipped, application-label:'…', nonLocalizedLabel=…, numeric noise, no label lines).
    • looksLikeResourceID, looksNumeric, parseBracketedList, VersionSummary, DisplayTitle, FormatMillis.
    • CLI helpers: dashIfEmpty, yesNo, i64toa, stdout-captured printPackageInfo.
  • Brace/paren/string/comment balance verified across every .go file (Go toolchain is not available in this sandbox — CI on GitHub Actions will run gofmt, go vet, and go test -race across modules and platforms once approved).
  • Release automation, -ldflags="-X main.version=${VERSION}" version stamping, and the multi-platform build matrix/artifact naming are preserved.

Breaking Changes

  • None. Non-interactive CLI subcommand surface (devices, apps [-u] [serial], install, launch, stop, uninstall, mirror) is unchanged; REPL numeric selection is additive.
  • New fields on Package are within the internal internal/adb package and do not affect external consumers.

Notes

  • Label resolution is capped at 300 packages per refresh to keep the single batched adb-shell call bounded; sorting still prioritizes user apps.
  • Labels for launcher-less system packages remain the package name (we never pull APKs or depend on host-side Android SDK tools like aapt).
  • App icons, logcat, wireless ADB pairing, multi-device batch ops, command palette, and arbitrary activity launching are intentionally out of scope per the Phase 3 spec.

…iews

Shared core (internal/adb):
- Expanded Package model with UID, Min/Target SDK, Enabled, SplitCodePaths.
- Added DisplayTitle()/VersionSummary() presenters and FormatMillis().
- Added resolveLabels() using two best-effort device-side passes:
  (1) batched per-package dumpsys grep for applicationLabel=;
  (2) batched 'cmd package resolve-activity' fallback for launcher apps.
  Resource IDs (0x7f...) and numeric noise are filtered; labels are never
  fabricated, falling back to package name when unresolvable.
- enrichFromDumpsys now parses minSdk=/targetSdk=, splitCodePaths=[...],
  uid=/userId=, and User 0: installed=false.
- PackageInfo() convenience added on Manager for detail views.

GUI:
- Two-line list items showing bold label (primary), monospace package name
  (secondary), and version tag on the right.
- New Details screen with Back button, bold application name, Form rows for
  Type/Version/Enabled/Installer/APK path/Split APKs/UID/SDKs/timestamps, and
  inline Launch/Force Stop/Uninstall actions reusing shared-core ops with
  existing confirmation dialogs. Detail view refreshes with app-list refreshes
  and auto-closes when the package disappears.
- Search continues to match label and package name; existing Install APK…
  and Mirror functionality preserved.

CLI:
- New 'info [<pkg>|n]' command (aliases show/details) in REPL and non-
  interactive modes, mirroring GUI metadata.
- REPL caches last apps/search listing; launch/stop/uninstall/info accept a
  numeric index with interactive prompt when no arg given.
- 'apps' output includes the resolved label.
- Existing scriptable subcommand syntax preserved.

Note: CI/release workflow changes (to add vet/test for the new internal/
module) are intentionally excluded from this commit because the CI bot lacks
workflows permission; they should be applied in a follow-up by a maintainer
with workflows:write permission.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying adbpure with  Cloudflare Pages  Cloudflare Pages

Latest commit: a336b90
Status: ✅  Deploy successful!
Preview URL: https://cbdcd540.adbpure.pages.dev
Branch Preview URL: https://arena-019feb0a-adbpureflow.adbpure.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants