fix(android): record the launched intent owner from the device

Merged
TH
2d ago
+307-62

Summary

On ADB-backed Android (local adb and ADB providers), open settings and other intent targets left appBundleId undefined, and --relaunch closed the raw target.

  • Owner, in order: the requested package, the package am start -W reports on its Activity: line, then the foreground package when no activity is named. The framework android chooser/forwarder and a permission prompt over the app are never owners.
  • --relaunch closes only a requested package. Otherwise the launch stops the handler: -S for intents, force-stop then start for package and app-bound targets. Bare-URL relaunch stays rejected before dispatch. An unresolved app-bound package previously closed the raw target name.

WebDriver/Appium opens only by package, so its owner is the requested package; Limrun is unchanged.

Supersedes #3555
Related to #3077

Validation

Head d9a726882, rebased on main ba7730af0: pnpm check:affected --base origin/main --run passed (464 files / 3,235 tests). The owner test fails if the lifecycle reads the follow-up open's report.

Live at 19d113ba7 (owner route unchanged since), API 35 emulator, built CLI: open settings reports appBundleId: com.android.settings; open settings --relaunch restarts Settings (PID 981 โ†’ 3249).

Risk: am start -S refuses an implicit intent matching several activities (raw am start -W -S -a MAIN -c HOME: can't stop). settings has one handler here; OEM builds with several Settings handlers would fail a relaunch, where a plain open already shows the chooser.

๐Ÿค– Generated with Claude Code