From 6f304fc0762015552e5e90155a4c5434db29d74f Mon Sep 17 00:00:00 2001 From: Chris Lee Date: Tue, 8 Sep 2026 22:44:50 -0400 Subject: [PATCH] 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. --- .../main/java/com/faceclaw/app/FaceclawBleCommunicator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawBleCommunicator.java b/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawBleCommunicator.java index b7dd2b10..6d4426d2 100644 --- a/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawBleCommunicator.java +++ b/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawBleCommunicator.java @@ -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) {