Skip to content

perf(android): read screenshot rotation from the helper response - #4603

Open
thymikee wants to merge 2 commits into
mainfrom
t3/android-screenshot-rotation-header
Open

thymikee wants to merge 2 commits into
mainfrom
t3/android-screenshot-rotation-header

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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.
  • dumpsys stays for the screencap fallback, 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

thymikee and others added 2 commits November 16, 2026 17:54
The helper's screenshot response now carries the default display's
rotation and the display count, so a helper capture no longer spawns
adb shell dumpsys display beside it. The screencap fallback and a helper
without the headers keep the dumpsys probe; a device with more than one
display still reports no rotation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…antics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.32 MB 6.32 MB +368 B
Package (unpacked) 6.32 MB 6.32 MB +368 B
Package (download) 1.92 MB 1.92 MB +426 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.8 ms 40.4 ms +10.6 ms
CLI --help 63.2 ms 57.6 ms -5.6 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

No open findings.

Reviewed with this repository's own Sentinel configuration (b3c1a3c8abd9).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee
thymikee marked this pull request as ready for review November 16, 2026 17:21

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

You’re at about 97% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

View guided diff | Turn on auto-fix | Re-trigger cubic

This branch has not been deployed

No deployments
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.

1 participant