perf(android): read screenshot rotation from the helper response
Summary
Each Android helper screenshot spawned adb shell dumpsys display to learn the rotation. The helper's screenshot response now carries displayRotation (default display, read before and after the capture, sent only when both agree) and displayCount. A helper capture spawns no adb process.
- More than one display still reports no rotation. The helper counts logical displays it can see, which excludes an inactive foldable panel.
dumpsysstays for thescreencapfallback, orientation settle, and a helper without the headers.
10 files touched.
Validation
Head 04a2045827, base 244d1ff683. Emulator API 35, screenshot on a live helper session. 2 passes × 6 interleaved rounds × 5 shots (n=60 per arm), load 23–49 on 12 cores:
| Arm | p50 | p95 | adb spawns per shot |
|---|---|---|---|
| main | 367 ms | 595 ms | 1 |
| branch | 331 ms | 681 ms | 0 |
Main already ran the probe in parallel with the capture, so wall time stays within host noise. The firm gain is one fewer adb call per screenshot, which counts more on remote devices.
At all four rotations, the helper rotation matched dumpsys mCurrentOrientation and the helper PNG was pixel-identical to screencap. This was verified on API 35 only. A second overlay display made the helper report no rotation.
Focused unit tests, helper JVM suite, and pnpm typecheck pass. CI is green.
🤖 Generated with Claude Code