From 02c09ef889d3604df8c0b78cab73cadf33beb61c Mon Sep 17 00:00:00 2001 From: James Babcock Date: Sat, 1 Aug 2026 14:37:30 -0700 Subject: [PATCH] Fix broken wakeword handling --- .../com/faceclaw/app/FaceclawBleCommunicator.java | 10 ++++++---- app/g2/dashboard-controller.ts | 13 ++++++++++++- app/native/faceclaw-communicator.ts | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) 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 1ec70a9b..5e9e7480 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 @@ -73,9 +73,10 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable { private volatile boolean firmwareDebugFlagsEnabled; private int firmwareDebugFlagsLastSent = -1; private boolean startupProbePending; - // Desired ownership of CFW's fail-open idle-wake lease. This survives a - // transport reconnect; the lease itself is volatile firmware state and is - // re-acquired once both arms are ready. + // Desired ownership of CFW's fail-open stock-wake lease (dashboard launch + // and Even AI foreground takeover). This survives a transport reconnect; + // the lease itself is volatile firmware state and is re-acquired once both + // arms are ready. private boolean faceclawWakeLeaseEnabled; private long lastFaceclawWakeLeaseQueuedAtMs; private int faceclawWakeControlGeneration; @@ -290,7 +291,8 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable { /** * Acquire/renew or release CFW's volatile wake-takeover lease on both * arms. Delivery (not a protocol ACK) is awaited so a caller can ensure - * the fail-open firmware policy is installed before suspending EvenHub. + * the fail-open firmware policy is installed before relying on wakeword + * interception or suspending EvenHub. */ public boolean setFaceclawWakeLeaseEnabled(boolean enabled) { int generation; diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index 34cfc66c..a38f197a 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -410,7 +410,14 @@ class DashboardController { } private desiredFaceclawWakeLeaseState(): boolean { - return suspendEvenHubWhenScreenOffSetting.get() && this.faceclawWakeLeaseSupported; + // The same firmware lease owns two stock wake paths: deferred dashboard + // launch while EvenHub is suspended, and suppression of the stock Even AI + // foreground app when Faceclaw handles the glasses wakeword. Without the + // latter, Even AI displaces EvenHub before our first wake frame can ACK. + return ( + this.faceclawWakeLeaseSupported && + (suspendEvenHubWhenScreenOffSetting.get() || wakeWordActionSetting.get() !== "off") + ); } private async syncFaceclawWakeLease( @@ -766,6 +773,10 @@ class DashboardController { // A transport reconnect starts with a live EvenHub lifecycle again; // if the shell is asleep, begin a fresh five-second grace period. this.evenHubSessionSuspended = false; + // Firmware leases are volatile, and the Java transport may have been + // rebuilt underneath this long-lived controller. Do not let a cached + // TypeScript value suppress re-acquisition on the new session. + this.faceclawWakeLeaseState = null; // Push the CFW firmware-debug-flags overlay preference; Java emits the // mode-7 control message once the dashboard container is warmed up. this.pushFirmwareDebugFlags(); diff --git a/app/native/faceclaw-communicator.ts b/app/native/faceclaw-communicator.ts index ce896c89..78a5d523 100644 --- a/app/native/faceclaw-communicator.ts +++ b/app/native/faceclaw-communicator.ts @@ -514,8 +514,8 @@ export class FaceclawCommunicatorBridge { } /** - * Own CFW's fail-open idle-wake policy while the experimental screen-off - * suspension mode is enabled. Returns after both arm writes complete. + * Own CFW's fail-open stock-wake policy while Faceclaw handles wakewords or + * suspends EvenHub with the screen off. Returns after both arm writes complete. */ async setFaceclawWakeLeaseEnabled(enabled: boolean): Promise { return this.enqueueJavaCall(() =>