mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 12:07:09 +00:00
feat(sidecar): add snapshot default on DriverBackend
Default impl calls hierarchy() then screenshot(). The service layer wraps the call in a mutex so concurrent runners observe a serialized pair.
This commit is contained in:
1 parent
5a19ef885f
commit
4bc3147d2a
1 file changed
+11
@@ -14,8 +14,19 @@ interface DriverBackend {
|
|||||||
fun waitForIdle(durationMillis: Long)
|
fun waitForIdle(durationMillis: Long)
|
||||||
fun healthy(): Boolean
|
fun healthy(): Boolean
|
||||||
fun metrics(bundleId: String): MetricsSample
|
fun metrics(bundleId: String): MetricsSample
|
||||||
|
|
||||||
|
// snapshot captures hierarchy then screenshot back-to-back. The service
|
||||||
|
// layer holds a mutex around the call so concurrent callers observe a
|
||||||
|
// serialized pair from the same on-device frame. Backends may override
|
||||||
|
// to fuse the two reads more tightly when their native API allows.
|
||||||
|
fun snapshot(): SnapshotSample = SnapshotSample(hierarchy(), screenshot())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class SnapshotSample(
|
||||||
|
val hierarchyJson: String,
|
||||||
|
val screenshot: Triple<ByteArray, Int, Int>,
|
||||||
|
)
|
||||||
|
|
||||||
// STABILITY_POLL_INTERVAL_MILLIS is set wide enough that UiAutomation /
|
// STABILITY_POLL_INTERVAL_MILLIS is set wide enough that UiAutomation /
|
||||||
// Maestro's contentDescriptor doesn't get hammered: tighter intervals were
|
// Maestro's contentDescriptor doesn't get hammered: tighter intervals were
|
||||||
// observed to back the sidecar gRPC stream up under fuzz load to the point
|
// observed to back the sidecar gRPC stream up under fuzz load to the point
|
||||||
|
|||||||
Reference in new issue
Block a user