Skip to content

settleMs excludes the adopted observation’s screenshot capture

Context

settleMs was read after the adopted observation’s screenshot capture, and that capture waited only on caller cancellation. A slow screenshot therefore read as a slow settle, and captures queued behind one stalled capture (queueAfterPending) stacked their waits until an action blocked for 25–30 s.

Options

  • Report the capture as a perf timing entry. The settle outcome has no timing channel of its own, so this would have meant a second route onto the wire.
  • Bound the capture with the settle fence. The fence ends before the capture starts, so it cannot cover it.
  • Bound the capture with the CtrlProxy capture timeout alone. That cuts off the ADB fallback that follows a CtrlProxy timeout.

Decision

Read settleMs before any capture. Report the capture’s duration as a new optional captureMs that rides the same path as settleMs and settlePolls.

Run every terminal capture under a deadline: the adopted, kept and failed-settle returns alike. The deadline starts when the capture is requested, so queue time counts. It is per platform. Android gets the CtrlProxy attempt, an ADB screencap fallback budget and the settle fence margin. Apple platforms get the iOS screenshot timeout and the margin. A single Android-sized bound would drop slow physical iOS captures on every action. An unknown platform gets the larger one.

On expiry, return the observation without a screenshot and with a freshness.warning. Tell the abandoned capture to stop. The capture writes into a private copy that is committed only if it finishes in time, so late pixels cannot change the returned observation. A cancelled request discards the copy the same way.

Consequences

The host settle gate owns the deadline, so queueing is unchanged for other callers. Until the device-side fix for #19494 lands, a stalled capture keeps its place in the per-device queue.