Wake up notifyAll() waiters when a BLE ack lands (fixes up-to-100ms dead time on every EvenHub resume)

awaitEvenHubSessionReady() polls fixedLayoutCreated/displayedFingerprint at up to 100ms
granularity because resolveAckLocked() never notified waiters when the relevant ack
actually arrived. Confirmed live on real hardware (2026-09-08): full resume (prelude +
create-layout + content frame) now completes in 449ms with a clean, tight ack sequence
and no regressions. Safe by construction: the one caller already holds the lock, and
every lock.wait() consumer in this file rechecks its own condition in a loop.
This commit is contained in:
Chris Lee committed 2026-09-08 22:54:27 -04:00
1 parent 070c891577
commit 6f304fc076
1 file changed
+6
@@ -2375,6 +2375,12 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
message.onAck.run();
}
consecutiveAckTimeouts = 0;
// onAck may have just satisfied a waiter blocked on lock.wait() (e.g.
// awaitEvenHubSessionReady polling fixedLayoutCreated/displayedFingerprint
// after a create-layout or image ack). Without this, that waiter only
// notices on its own up-to-100ms poll tick, adding avoidable latency to
// every EvenHub wake. Always called with lock held (see call site).
lock.notifyAll();
}
private void logImageUpdateSendLandmarkLocked(OutboundMessage message) {