perf(android): probe each running device with one getprop batch and one feature list

Merged
IM
5d ago
+235-162

Summary

Android device discovery spawned 9 adb processes per running device (separate getprops, four cmd package has-feature, pm list features), and the target probe took four round trips in a row.

Each running device now gets two adb shells, in parallel:

  • one getprop batch printing every property discovery reads;
  • pm list features, kept separate because a busy device can stall it (#4765). A stall still costs only that device's target.

cmd package has-feature is dropped. It reads the same PackageManager feature table that pm list features prints, and the old code already read the list whenever has-feature said no, so the result is unchanged. adb emu avd name is still asked only when no property names the AVD.

Before / after (Pixel 9 emulator, API 36)

agent-device devices --platform android --json, warm daemon, 15 interleaved runs:

Base (3e0814c574)Head (9b5b581b2e)Delta
adb spawns per devices103−7
Shell calls per running device92−7
Wall time (median, min–max)415 ms (314–571)298 ms (238–526)−117 ms

The JSON output is identical. The device answered has-feature android.hardware.wifi true and listed it; it answered leanback false and did not list it.

Validation

  • inventory.test.ts and inventory-parsers.test.ts: 28 passed. 8 mutants each fail a test.
  • Gate at 9b5b581b2e: format, lint, typecheck, layering, fallow, build, vitest-related, and provider-integration (324 passed) passed.
  • Not run on an Android TV or Fire TV device; TV classification is covered by unit tests.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.