From 64f99babd5363f01636edb007715fec3de322429 Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 15 Aug 2026 21:01:00 +0530 Subject: [PATCH] docs(sidecar): put the measured read cost in the dismissal bound --- .../kotlin/dev/sanderling/sidecar/DriverBackend.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt b/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt index 7652d5d..89292f2 100644 --- a/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt +++ b/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt @@ -809,10 +809,12 @@ internal fun dismissSoftKeyboard(shell: (String) -> String) { } // KEYBOARD_DISMISS_READS bounds the re-reads a snapshot spends waiting for the -// IME window to leave the tree after BACK. The window goes over an animation, -// so the first read back can still carry it; a hierarchy read plus the interval -// costs ~250ms on the emulator, which covers a retraction several times over -// without turning a keyboard the app keeps re-raising into an unbounded wait. +// IME window to leave the tree after BACK. The window leaves over an +// animation, so the first read back can still carry it. A hierarchy read +// measures at a 76ms median and a 168ms p90 on the API 34 emulator, so with +// the interval these four reads watch most of a second: several retractions +// over, without turning a keyboard the app keeps re-raising into a wait with +// no end. internal const val KEYBOARD_DISMISS_READS = 4 internal const val KEYBOARD_DISMISS_INTERVAL_MILLIS = 100L