forked from Blendman974/faceclaw
Add a lock screen, controlled by wear-detection
This commit is contained in:
1 parent
4302a506d4
commit
960e2fd6e1
10 files changed
+429
-22
No files matched your search
@@ -3,7 +3,11 @@ package com.faceclaw.app;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.bluetooth.BluetoothGatt;
|
import android.bluetooth.BluetoothGatt;
|
||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
@@ -41,6 +45,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
|
|
||||||
private final Context appContext;
|
private final Context appContext;
|
||||||
private final PowerManager powerManager;
|
private final PowerManager powerManager;
|
||||||
|
private final KeyguardManager keyguardManager;
|
||||||
private final FaceclawBleManager bleManager;
|
private final FaceclawBleManager bleManager;
|
||||||
private final InterruptibleSleep interruptibleSleep = new InterruptibleSleep();
|
private final InterruptibleSleep interruptibleSleep = new InterruptibleSleep();
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
@@ -116,6 +121,10 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
private int headsetCharging = -1;
|
private int headsetCharging = -1;
|
||||||
// Silent mode: 1 = on, 0 = off, -1 = not yet known. See updateSilentModeLocked.
|
// Silent mode: 1 = on, 0 = off, -1 = not yet known. See updateSilentModeLocked.
|
||||||
private int silentMode = -1;
|
private int silentMode = -1;
|
||||||
|
private int wearState = -1;
|
||||||
|
private int phoneLockState = -1;
|
||||||
|
private long lastPhoneLockCheckAtMs;
|
||||||
|
private boolean phoneLockReceiverRegistered;
|
||||||
private boolean audioCaptureActive;
|
private boolean audioCaptureActive;
|
||||||
private boolean firmwareInfoQueried;
|
private boolean firmwareInfoQueried;
|
||||||
// Glasses are in the charging case: nobody is wearing them, so display
|
// Glasses are in the charging case: nobody is wearing them, so display
|
||||||
@@ -124,6 +133,13 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
private volatile FaceclawAudioPacketListener audioPacketListener;
|
private volatile FaceclawAudioPacketListener audioPacketListener;
|
||||||
private PowerManager.WakeLock g2ScreenWakeLock;
|
private PowerManager.WakeLock g2ScreenWakeLock;
|
||||||
|
|
||||||
|
private final BroadcastReceiver phoneLockReceiver = new BroadcastReceiver() {
|
||||||
|
@Override public void onReceive(Context context, Intent intent) {
|
||||||
|
emitPhoneLockStateIfChanged(true);
|
||||||
|
interruptibleSleep.interrupt();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private String displayedFingerprint = "";
|
private String displayedFingerprint = "";
|
||||||
// The frame the firmware shadow will hold once the current image pipeline
|
// The frame the firmware shadow will hold once the current image pipeline
|
||||||
// drains: the most recently ENQUEUED image (headerless packed 4bpp, see
|
// drains: the most recently ENQUEUED image (headerless packed 4bpp, see
|
||||||
@@ -162,17 +178,25 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
this.appContext = context.getApplicationContext();
|
this.appContext = context.getApplicationContext();
|
||||||
FrameTimings.getInstance().init(appContext);
|
FrameTimings.getInstance().init(appContext);
|
||||||
this.powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE);
|
this.powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE);
|
||||||
|
this.keyguardManager = (KeyguardManager) appContext.getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
this.bleManager = new FaceclawBleManager(appContext);
|
this.bleManager = new FaceclawBleManager(appContext);
|
||||||
this.bleManager.setListener(this);
|
this.bleManager.setListener(this);
|
||||||
this.rightAddress = requireAddress("rightAddress", rightAddress);
|
this.rightAddress = requireAddress("rightAddress", rightAddress);
|
||||||
this.leftAddress = requireAddress("leftAddress", leftAddress);
|
this.leftAddress = requireAddress("leftAddress", leftAddress);
|
||||||
this.ringAddress = ringAddress == null ? "" : ringAddress.trim();
|
this.ringAddress = ringAddress == null ? "" : ringAddress.trim();
|
||||||
|
IntentFilter phoneLockFilter = new IntentFilter();
|
||||||
|
phoneLockFilter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
|
phoneLockFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
phoneLockFilter.addAction(Intent.ACTION_USER_PRESENT);
|
||||||
|
appContext.registerReceiver(phoneLockReceiver, phoneLockFilter);
|
||||||
|
phoneLockReceiverRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setListener(FaceclawBleCommunicatorListener listener) {
|
public void setListener(FaceclawBleCommunicatorListener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
emitState();
|
emitState();
|
||||||
|
emitPhoneLockStateIfChanged(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
@@ -231,6 +255,10 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
activeInstance = null;
|
activeInstance = null;
|
||||||
}
|
}
|
||||||
disconnect();
|
disconnect();
|
||||||
|
if (phoneLockReceiverRegistered) {
|
||||||
|
phoneLockReceiverRegistered = false;
|
||||||
|
appContext.unregisterReceiver(phoneLockReceiver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setG2ScreenOn(boolean screenOn) {
|
public void setG2ScreenOn(boolean screenOn) {
|
||||||
@@ -407,6 +435,31 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
interruptibleSleep.interrupt();
|
interruptibleSleep.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the stock wear detector, then ask CFW to emit its current cached
|
||||||
|
* state. The queue order matters: the query must run after the setting is
|
||||||
|
* applied, including on a fresh install where wear detection was disabled.
|
||||||
|
*/
|
||||||
|
public void enableWearDetectionAndRequestState() {
|
||||||
|
synchronized (lock) {
|
||||||
|
if (!running || !sessionReady) {
|
||||||
|
logLine("skip wear detector setup; session not ready");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearMessagesOfKindLocked("wear-detection-control");
|
||||||
|
clearMessagesOfKindLocked("wear-query-control");
|
||||||
|
OutboundMessage queryLeft = messageBuilder.faceclawWearQuery(true);
|
||||||
|
OutboundMessage queryRight = messageBuilder.faceclawWearQuery(false);
|
||||||
|
OutboundMessage enable = messageBuilder.setWearDetection(true);
|
||||||
|
enable.onTimeout = () -> logLine("wear detection enable ack timeout");
|
||||||
|
pendingMessages.addFirst(queryLeft);
|
||||||
|
pendingMessages.addFirst(queryRight);
|
||||||
|
pendingMessages.addFirst(enable);
|
||||||
|
logLine("queue wear detection enable + current-state query");
|
||||||
|
}
|
||||||
|
interruptibleSleep.interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
public void addImuListener(FaceclawImuListener listener) {
|
public void addImuListener(FaceclawImuListener listener) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
imuListeners.add(listener);
|
imuListeners.add(listener);
|
||||||
@@ -829,6 +882,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
Log.w(TAG, "Exiting event looop");
|
Log.w(TAG, "Exiting event looop");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
emitPhoneLockStateIfChanged(false);
|
||||||
if (!sessionReady) {
|
if (!sessionReady) {
|
||||||
long now = SystemClock.elapsedRealtime();
|
long now = SystemClock.elapsedRealtime();
|
||||||
if (now < reconnectAfterMs) {
|
if (now < reconnectAfterMs) {
|
||||||
@@ -875,9 +929,15 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
Log.d(TAG, "onNotification: address=" + address + " characteristicUuid=" + characteristicUuid + " data.length=" + data.length);
|
Log.d(TAG, "onNotification: address=" + address + " characteristicUuid=" + characteristicUuid + " data.length=" + data.length);
|
||||||
BleProtocol.ParsedFrame frame = BleProtocol.parseFrame(data);
|
BleProtocol.ParsedFrame frame = BleProtocol.parseFrame(data);
|
||||||
|
int decodedWearState = BleProtocol.parseWearState(frame);
|
||||||
|
boolean emitWearState = false;
|
||||||
G2Event event = null;
|
G2Event event = null;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
lastIncomingAtMs = SystemClock.elapsedRealtime();
|
lastIncomingAtMs = SystemClock.elapsedRealtime();
|
||||||
|
if (decodedWearState >= 0 && decodedWearState != wearState) {
|
||||||
|
wearState = decodedWearState;
|
||||||
|
emitWearState = true;
|
||||||
|
}
|
||||||
boolean faceclawWakeNotification = false;
|
boolean faceclawWakeNotification = false;
|
||||||
if (shutdownRequested
|
if (shutdownRequested
|
||||||
&& frame.ok
|
&& frame.ok
|
||||||
@@ -920,6 +980,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!faceclawWakeNotification
|
if (!faceclawWakeNotification
|
||||||
|
&& decodedWearState < 0
|
||||||
&& frame.ok
|
&& frame.ok
|
||||||
&& frame.sid == BleProtocol.SID_UI_SETTING) {
|
&& frame.sid == BleProtocol.SID_UI_SETTING) {
|
||||||
// Device-initiated settings push. It carries a magic the glasses
|
// Device-initiated settings push. It carries a magic the glasses
|
||||||
@@ -932,6 +993,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!faceclawWakeNotification
|
if (!faceclawWakeNotification
|
||||||
|
&& decodedWearState < 0
|
||||||
&& frame.ok
|
&& frame.ok
|
||||||
&& frame.msgSeq >= 0
|
&& frame.msgSeq >= 0
|
||||||
&& frame.flag != BleProtocol.FLAG_NOTIFY
|
&& frame.flag != BleProtocol.FLAG_NOTIFY
|
||||||
@@ -974,6 +1036,10 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
interruptibleSleep.interrupt();
|
interruptibleSleep.interrupt();
|
||||||
|
if (emitWearState) {
|
||||||
|
logLine(decodedWearState > 0 ? "wear state ON_HEAD" : "wear state OFF_HEAD");
|
||||||
|
emitWearState(decodedWearState > 0);
|
||||||
|
}
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
if (event.hasImu) {
|
if (event.hasImu) {
|
||||||
emitImuData(event.imuX, event.imuY, event.imuZ, event.eventSource);
|
emitImuData(event.imuX, event.imuY, event.imuZ, event.eventSource);
|
||||||
@@ -2470,6 +2536,7 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
faceclawWakePendingNonce = -1;
|
faceclawWakePendingNonce = -1;
|
||||||
lastFaceclawWakeLeaseQueuedAtMs = 0;
|
lastFaceclawWakeLeaseQueuedAtMs = 0;
|
||||||
faceclawWakeControlSentCount = 0;
|
faceclawWakeControlSentCount = 0;
|
||||||
|
wearState = -1;
|
||||||
displayedFingerprint = "";
|
displayedFingerprint = "";
|
||||||
// Deliberately not clearing silentMode: it is a property of the glasses,
|
// Deliberately not clearing silentMode: it is a property of the glasses,
|
||||||
// not of our session, and silent mode blocks app launches, so it can be
|
// not of our session, and silent mode blocks app launches, so it can be
|
||||||
@@ -2542,6 +2609,40 @@ public class FaceclawBleCommunicator implements FaceclawBleListener, Runnable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void emitWearState(boolean wearing) {
|
||||||
|
final FaceclawBleCommunicatorListener current = listener;
|
||||||
|
if (current == null) return;
|
||||||
|
mainHandler.post(() -> {
|
||||||
|
try {
|
||||||
|
current.onWearState(wearing);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Log.w(TAG, "listener onWearState failed", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void emitPhoneLockStateIfChanged(boolean force) {
|
||||||
|
final boolean locked;
|
||||||
|
synchronized (lock) {
|
||||||
|
long now = SystemClock.elapsedRealtime();
|
||||||
|
if (!force && now - lastPhoneLockCheckAtMs < 1_000) return;
|
||||||
|
lastPhoneLockCheckAtMs = now;
|
||||||
|
locked = keyguardManager != null && keyguardManager.isDeviceLocked();
|
||||||
|
int value = locked ? 1 : 0;
|
||||||
|
if (!force && value == phoneLockState) return;
|
||||||
|
phoneLockState = value;
|
||||||
|
}
|
||||||
|
final FaceclawBleCommunicatorListener current = listener;
|
||||||
|
if (current == null) return;
|
||||||
|
mainHandler.post(() -> {
|
||||||
|
try {
|
||||||
|
current.onPhoneLockState(locked);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Log.w(TAG, "listener onPhoneLockState failed", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void emitBatteryState(int headsetBattery, int headsetCharging) {
|
private void emitBatteryState(int headsetBattery, int headsetCharging) {
|
||||||
final FaceclawBleCommunicatorListener current = listener;
|
final FaceclawBleCommunicatorListener current = listener;
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
|
|||||||
+2
@@ -6,6 +6,8 @@ public interface FaceclawBleCommunicatorListener {
|
|||||||
void onRingEvent(String kind, String containerName, int eventType, int eventSource, int systemExitReasonCode, int frameId);
|
void onRingEvent(String kind, String containerName, int eventType, int eventSource, int systemExitReasonCode, int frameId);
|
||||||
void onBatteryState(int headsetBattery, int headsetCharging);
|
void onBatteryState(int headsetBattery, int headsetCharging);
|
||||||
void onSilentMode(boolean silent);
|
void onSilentMode(boolean silent);
|
||||||
|
void onWearState(boolean wearing);
|
||||||
|
void onPhoneLockState(boolean locked);
|
||||||
void onEvenAppConflict(String message);
|
void onEvenAppConflict(String message);
|
||||||
void onFrameMetrics(int paintMs, int transmitMs, int tileCount);
|
void onFrameMetrics(int paintMs, int transmitMs, int tileCount);
|
||||||
void onFrameFinished(int frameId, String outcome);
|
void onFrameFinished(int frameId, String outcome);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class BleProtocol {
|
|||||||
public static final int SID_EVENHUB = 0xe0;
|
public static final int SID_EVENHUB = 0xe0;
|
||||||
public static final int SID_UI_SETTING = 0x09;
|
public static final int SID_UI_SETTING = 0x09;
|
||||||
public static final int SID_STATE_CHANGE = 0x0d;
|
public static final int SID_STATE_CHANGE = 0x0d;
|
||||||
|
public static final int SID_ONBOARDING = 0x10;
|
||||||
/** G2SettingPackage.commandId for device-initiated pushes (vs. 2 = app read). */
|
/** G2SettingPackage.commandId for device-initiated pushes (vs. 2 = app read). */
|
||||||
public static final int SETTINGS_CMD_DEVICE_SEND_TO_APP = 3;
|
public static final int SETTINGS_CMD_DEVICE_SEND_TO_APP = 3;
|
||||||
// Private Faceclaw/CFW wake-takeover protocol. Both payloads are unknown
|
// Private Faceclaw/CFW wake-takeover protocol. Both payloads are unknown
|
||||||
@@ -44,6 +45,7 @@ public class BleProtocol {
|
|||||||
public static final int FACECLAW_WAKE_OP_READY = 4;
|
public static final int FACECLAW_WAKE_OP_READY = 4;
|
||||||
public static final int FACECLAW_FB_OP_ACQUIRE = 5;
|
public static final int FACECLAW_FB_OP_ACQUIRE = 5;
|
||||||
public static final int FACECLAW_FB_OP_RELEASE = 6;
|
public static final int FACECLAW_FB_OP_RELEASE = 6;
|
||||||
|
public static final int FACECLAW_WEAR_OP_QUERY = 7;
|
||||||
private static final int FACECLAW_WAKE_EVENT = 1;
|
private static final int FACECLAW_WAKE_EVENT = 1;
|
||||||
private static final int FACECLAW_WAKE_PROTOCOL_VERSION = 1;
|
private static final int FACECLAW_WAKE_PROTOCOL_VERSION = 1;
|
||||||
// UI_FOREGROUND_EVEN_AI_ID: the stock "Even AI" assistant app. It is a
|
// UI_FOREGROUND_EVEN_AI_ID: the stock "Even AI" assistant app. It is a
|
||||||
@@ -306,6 +308,16 @@ public class BleProtocol {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Enable the firmware's wear detector (DeviceReceiveInfoFromAPP field 5). */
|
||||||
|
public static byte[] buildSetWearDetection(int magic, boolean enabled) {
|
||||||
|
byte[] wear = encodeVarintField(1, enabled ? 1 : 0);
|
||||||
|
return concat(CollectionUtils.listOf(
|
||||||
|
encodeVarintField(1, 1),
|
||||||
|
encodeVarintField(2, magic),
|
||||||
|
encodeMessageField(3, encodeMessageField(5, wear))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] buildSettingsQuery(int magic) {
|
public static byte[] buildSettingsQuery(int magic) {
|
||||||
byte[] request = encodeVarintField(1, 1);
|
byte[] request = encodeVarintField(1, 1);
|
||||||
return concat(CollectionUtils.listOf(
|
return concat(CollectionUtils.listOf(
|
||||||
@@ -356,6 +368,28 @@ public class BleProtocol {
|
|||||||
return (event[4] & 0xff) | ((event[5] & 0xff) << 8);
|
return (event[4] & 0xff) | ((event[5] & 0xff) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode OnboardingDataPackage EVENT/GLS_WEAR_STATUS. Unlike most async
|
||||||
|
* G2 traffic, stock firmware sends this event with flag 0x00, so callers
|
||||||
|
* must recognize it by sid and protobuf shape rather than notify flag.
|
||||||
|
* Returns 0/1, or -1 when the frame is not a wear event.
|
||||||
|
*/
|
||||||
|
public static int parseWearState(ParsedFrame frame) {
|
||||||
|
if (frame == null || !frame.ok || frame.sid != SID_ONBOARDING) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
byte[] root = stripTrailingCrc(frame.pb);
|
||||||
|
if (readVarintFieldValue(root, 1, -1) != 3) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
byte[] event = readFieldBytes(root, 5);
|
||||||
|
if (event == null || readVarintFieldValue(event, 1, -1) != 1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int wearStatus = readVarintFieldValue(event, 2, -1);
|
||||||
|
return wearStatus == 0 || wearStatus == 1 ? wearStatus : -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static BatterySnapshot parseSettingsBattery(byte[] pb) {
|
public static BatterySnapshot parseSettingsBattery(byte[] pb) {
|
||||||
byte[] root = stripTrailingCrc(pb);
|
byte[] root = stripTrailingCrc(pb);
|
||||||
byte[] request = readFieldBytes(root, 4);
|
byte[] request = readFieldBytes(root, 4);
|
||||||
|
|||||||
@@ -137,6 +137,21 @@ public class MessageBuilder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OutboundMessage setWearDetection(boolean enabled) {
|
||||||
|
int magic = magicPool.allocate();
|
||||||
|
return new OutboundMessage(
|
||||||
|
"wear-detection-control",
|
||||||
|
"wear detection " + (enabled ? "enable" : "disable"),
|
||||||
|
BleProtocol.SID_UI_SETTING,
|
||||||
|
BleProtocol.FLAG_REQUEST,
|
||||||
|
magic,
|
||||||
|
BleProtocol.buildSetWearDetection(magic, enabled),
|
||||||
|
ACK_TIMEOUT_MS,
|
||||||
|
-1,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public OutboundMessage createLayout(BleProtocol.ImageTileOptions... tiles) {
|
public OutboundMessage createLayout(BleProtocol.ImageTileOptions... tiles) {
|
||||||
int magic = magicPool.allocate();
|
int magic = magicPool.allocate();
|
||||||
return new OutboundMessage(
|
return new OutboundMessage(
|
||||||
@@ -224,4 +239,18 @@ public class MessageBuilder {
|
|||||||
leftArm
|
leftArm
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OutboundMessage faceclawWearQuery(boolean leftArm) {
|
||||||
|
return new OutboundMessage(
|
||||||
|
"wear-query-control",
|
||||||
|
"wear state query" + (leftArm ? " L" : " R"),
|
||||||
|
BleProtocol.SID_UI_SETTING,
|
||||||
|
BleProtocol.FLAG_REQUEST,
|
||||||
|
0,
|
||||||
|
BleProtocol.buildFaceclawWakeControl(BleProtocol.FACECLAW_WEAR_OP_QUERY, 0),
|
||||||
|
ACK_TIMEOUT_MS,
|
||||||
|
-1,
|
||||||
|
leftArm
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,8 @@ import { isWelcomeSoundPending, setWelcomeSoundPending } from "../phone-ui/onboa
|
|||||||
import { beginRenderPass, endRenderPass } from "../util/render-freshness";
|
import { beginRenderPass, endRenderPass } from "../util/render-freshness";
|
||||||
import { voiceControlBridge } from "../native/voice-control";
|
import { voiceControlBridge } from "../native/voice-control";
|
||||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
|
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
|
||||||
|
import { getDefaultMediumFont } from "../graphics/bdffont";
|
||||||
|
import { wrapText } from "../graphics/textwrap";
|
||||||
import { rawInputEventToInputEvent, shell, type ShellInputOutcome } from "../ui/shell/shell";
|
import { rawInputEventToInputEvent, shell, type ShellInputOutcome } from "../ui/shell/shell";
|
||||||
import { registerSystemTools } from "../assistant/system-tools";
|
import { registerSystemTools } from "../assistant/system-tools";
|
||||||
import { registerNavigateTools } from "../assistant/navigate-tools";
|
import { registerNavigateTools } from "../assistant/navigate-tools";
|
||||||
@@ -95,6 +97,7 @@ import {
|
|||||||
openAiApiKeySetting,
|
openAiApiKeySetting,
|
||||||
nightscoutApiTokenSetting,
|
nightscoutApiTokenSetting,
|
||||||
firmwareDebugFlagsSetting,
|
firmwareDebugFlagsSetting,
|
||||||
|
lockScreenEnabledSetting,
|
||||||
nightscoutSiteUrlSetting,
|
nightscoutSiteUrlSetting,
|
||||||
onAnySettingChanged,
|
onAnySettingChanged,
|
||||||
saveVoiceRecordingsSetting,
|
saveVoiceRecordingsSetting,
|
||||||
@@ -138,6 +141,8 @@ type DashboardListener = (snapshot: DashboardSnapshot) => void;
|
|||||||
// The shell chrome (sidebar + top bar + overlays) composites above all app
|
// The shell chrome (sidebar + top bar + overlays) composites above all app
|
||||||
// window surfaces with color-key transparency.
|
// window surfaces with color-key transparency.
|
||||||
const SHELL_SURFACE_ID = "shell";
|
const SHELL_SURFACE_ID = "shell";
|
||||||
|
const LOCK_SCREEN_SURFACE_ID = "lock-screen";
|
||||||
|
const LOCK_SCREEN_MESSAGE = "Glasses locked; unlock the phone to unlock the glasses.";
|
||||||
// Top-bar clock refresh; the phone-side preview polls the Java composite so
|
// Top-bar clock refresh; the phone-side preview polls the Java composite so
|
||||||
// it reflects every app (including worker apps the TS side never renders).
|
// it reflects every app (including worker apps the TS side never renders).
|
||||||
const SHELL_REFRESH_INTERVAL_MS = 60_000;
|
const SHELL_REFRESH_INTERVAL_MS = 60_000;
|
||||||
@@ -177,6 +182,24 @@ function createInitialDisplayPreview(): ImageSource | null {
|
|||||||
return grayImageToPreviewSource(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
|
return grayImageToPreviewSource(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createLockScreenImage(): GrayImage {
|
||||||
|
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||||
|
const font = getDefaultMediumFont();
|
||||||
|
const boxWidth = 480;
|
||||||
|
const boxHeight = 150;
|
||||||
|
const boxX = Math.round((G2_LENS_WIDTH - boxWidth) / 2);
|
||||||
|
const boxY = Math.round((G2_LENS_HEIGHT - boxHeight) / 2);
|
||||||
|
image.drawRoundedRect(boxX, boxY, boxWidth, boxHeight, 150, 12);
|
||||||
|
const lines = wrapText(font, LOCK_SCREEN_MESSAGE, boxWidth - 64);
|
||||||
|
const textHeight = lines.length * font.lineHeight;
|
||||||
|
const firstY = boxY + Math.round((boxHeight - textHeight) / 2);
|
||||||
|
lines.forEach((line, index) => {
|
||||||
|
const x = Math.round((G2_LENS_WIDTH - font.measureText(line)) / 2);
|
||||||
|
image.drawText(font, x, firstY + index * font.lineHeight, line, 230);
|
||||||
|
});
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
function formatTimestamp(date: Date): string {
|
function formatTimestamp(date: Date): string {
|
||||||
return date.toISOString().slice(11, 23);
|
return date.toISOString().slice(11, 23);
|
||||||
}
|
}
|
||||||
@@ -232,11 +255,19 @@ class DashboardController {
|
|||||||
private evenHubResumePromise: Promise<boolean> | null = null;
|
private evenHubResumePromise: Promise<boolean> | null = null;
|
||||||
private faceclawWakeLeaseSupported = false;
|
private faceclawWakeLeaseSupported = false;
|
||||||
private faceclawWakeLeaseState: boolean | null = null;
|
private faceclawWakeLeaseState: boolean | null = null;
|
||||||
|
private wearNotifySupported = false;
|
||||||
|
private glassesWorn: boolean | null = null;
|
||||||
|
private phoneLocked = false;
|
||||||
|
private glassesLocked = false;
|
||||||
|
private lockSurfaceConfigured = false;
|
||||||
|
private lastLockScreenEnabled = lockScreenEnabledSetting.get();
|
||||||
private offState: (() => void) | null = null;
|
private offState: (() => void) | null = null;
|
||||||
private offLog: (() => void) | null = null;
|
private offLog: (() => void) | null = null;
|
||||||
private offRing: (() => void) | null = null;
|
private offRing: (() => void) | null = null;
|
||||||
private offBattery: (() => void) | null = null;
|
private offBattery: (() => void) | null = null;
|
||||||
private offSilentMode: (() => void) | null = null;
|
private offSilentMode: (() => void) | null = null;
|
||||||
|
private offWearState: (() => void) | null = null;
|
||||||
|
private offPhoneLockState: (() => void) | null = null;
|
||||||
private offEvenAppConflict: (() => void) | null = null;
|
private offEvenAppConflict: (() => void) | null = null;
|
||||||
private offFrameMetrics: (() => void) | null = null;
|
private offFrameMetrics: (() => void) | null = null;
|
||||||
private offFirmwareInfo: (() => void) | null = null;
|
private offFirmwareInfo: (() => void) | null = null;
|
||||||
@@ -333,6 +364,7 @@ class DashboardController {
|
|||||||
this.syncEvenHubScreenOffSetting();
|
this.syncEvenHubScreenOffSetting();
|
||||||
this.applyVerticalPositionIfChanged();
|
this.applyVerticalPositionIfChanged();
|
||||||
this.syncAssistantBridgeIfChanged();
|
this.syncAssistantBridgeIfChanged();
|
||||||
|
this.syncLockScreenSettingIfChanged();
|
||||||
});
|
});
|
||||||
// Connect to the external agent bridge at boot if configured; the
|
// Connect to the external agent bridge at boot if configured; the
|
||||||
// connection stays up (with re-dial) so proactive tool calls work
|
// connection stays up (with re-dial) so proactive tool calls work
|
||||||
@@ -424,6 +456,92 @@ class DashboardController {
|
|||||||
this.scheduleEvenHubSuspend();
|
this.scheduleEvenHubSuspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private syncLockScreenSettingIfChanged(): void {
|
||||||
|
const enabled = lockScreenEnabledSetting.get();
|
||||||
|
if (enabled === this.lastLockScreenEnabled) return;
|
||||||
|
this.lastLockScreenEnabled = enabled;
|
||||||
|
if (!enabled) {
|
||||||
|
this.setGlassesLocked(false, "lock screen disabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.phoneLocked && this.glassesWorn === false) {
|
||||||
|
this.setGlassesLocked(true, "lock screen enabled while glasses are off-head");
|
||||||
|
}
|
||||||
|
this.ensureWearStateTracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleWearState(wearing: boolean): void {
|
||||||
|
this.glassesWorn = wearing;
|
||||||
|
this.appendLog(wearing ? "glasses wear state: ON_HEAD" : "glasses wear state: OFF_HEAD");
|
||||||
|
if (!wearing && this.phoneLocked && lockScreenEnabledSetting.get()) {
|
||||||
|
this.setGlassesLocked(true, "glasses removed while phone locked");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private handlePhoneLockState(locked: boolean): void {
|
||||||
|
if (locked === this.phoneLocked) return;
|
||||||
|
this.phoneLocked = locked;
|
||||||
|
this.appendLog(`phone lock state: ${locked ? "locked" : "unlocked"}`);
|
||||||
|
if (!locked) {
|
||||||
|
this.setGlassesLocked(false, "phone unlocked");
|
||||||
|
} else if (this.glassesWorn === false && lockScreenEnabledSetting.get()) {
|
||||||
|
this.setGlassesLocked(true, "phone locked while glasses are off-head");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setGlassesLocked(locked: boolean, reason: string): void {
|
||||||
|
if (locked === this.glassesLocked) return;
|
||||||
|
this.glassesLocked = locked;
|
||||||
|
this.appendLog(`glasses ${locked ? "locked" : "unlocked"}: ${reason}`);
|
||||||
|
void this.syncLockSurface().catch((error) => {
|
||||||
|
this.appendLog(`lock screen update failed: ${this.formatError(error)}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private ensureWearStateTracking(): void {
|
||||||
|
const communicator = this.communicator;
|
||||||
|
if (
|
||||||
|
!lockScreenEnabledSetting.get() ||
|
||||||
|
!this.wearNotifySupported ||
|
||||||
|
this.phase !== "connected" ||
|
||||||
|
!communicator
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void communicator.enableWearDetectionAndRequestState().catch((error) => {
|
||||||
|
this.appendLog(`wear detector setup failed: ${this.formatError(error)}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async configureLockSurface(communicator: FaceclawCommunicatorBridge): Promise<void> {
|
||||||
|
await communicator.configureSurface(LOCK_SCREEN_SURFACE_ID, {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: G2_LENS_WIDTH,
|
||||||
|
height: G2_LENS_HEIGHT,
|
||||||
|
zOrder: 1000,
|
||||||
|
transparency: "opaque",
|
||||||
|
});
|
||||||
|
await communicator.setSurfaceVisible(LOCK_SCREEN_SURFACE_ID, false);
|
||||||
|
const image = createLockScreenImage();
|
||||||
|
await communicator.submitSurfaceFrame(
|
||||||
|
LOCK_SCREEN_SURFACE_ID,
|
||||||
|
image.to8bppBuffer(),
|
||||||
|
{ x: 0, y: 0, width: image.width, height: image.height },
|
||||||
|
image.fingerprint(),
|
||||||
|
);
|
||||||
|
if (this.communicator === communicator) {
|
||||||
|
this.lockSurfaceConfigured = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async syncLockSurface(): Promise<void> {
|
||||||
|
const communicator = this.communicator;
|
||||||
|
if (!communicator || !this.lockSurfaceConfigured) return;
|
||||||
|
await communicator.setSurfaceVisible(LOCK_SCREEN_SURFACE_ID, this.glassesLocked);
|
||||||
|
this.updateCompositePreview();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The single wake barrier for every source: restore the EvenHub lifecycle,
|
* The single wake barrier for every source: restore the EvenHub lifecycle,
|
||||||
* unblank the retained compositor, and resolve only after that frame is
|
* unblank the retained compositor, and resolve only after that frame is
|
||||||
@@ -780,6 +898,8 @@ class DashboardController {
|
|||||||
this.lastSys = "none yet";
|
this.lastSys = "none yet";
|
||||||
this.welcomeSoundArmed = isWelcomeSoundPending();
|
this.welcomeSoundArmed = isWelcomeSoundPending();
|
||||||
this.firmwareWarningMessage = "";
|
this.firmwareWarningMessage = "";
|
||||||
|
this.glassesWorn = null;
|
||||||
|
this.glassesLocked = false;
|
||||||
this.refreshBatteryOptimizationStatus();
|
this.refreshBatteryOptimizationStatus();
|
||||||
this.refreshEvenAppStatus();
|
this.refreshEvenAppStatus();
|
||||||
this.setPhase("connecting");
|
this.setPhase("connecting");
|
||||||
@@ -791,6 +911,8 @@ class DashboardController {
|
|||||||
let communicator: FaceclawCommunicatorBridge | null = null;
|
let communicator: FaceclawCommunicatorBridge | null = null;
|
||||||
this.faceclawWakeLeaseSupported = false;
|
this.faceclawWakeLeaseSupported = false;
|
||||||
this.faceclawWakeLeaseState = null;
|
this.faceclawWakeLeaseState = null;
|
||||||
|
this.wearNotifySupported = false;
|
||||||
|
this.lockSurfaceConfigured = false;
|
||||||
this.evenHubResumePromise = null;
|
this.evenHubResumePromise = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -834,10 +956,17 @@ class DashboardController {
|
|||||||
this.pushFirmwareDebugFlags();
|
this.pushFirmwareDebugFlags();
|
||||||
this.pushBrightness(true);
|
this.pushBrightness(true);
|
||||||
}
|
}
|
||||||
|
if (mappedPhase !== "connected") {
|
||||||
|
// A wear snapshot is session-scoped. CFW reports a fresh value when
|
||||||
|
// the transport comes back, so do not make lock decisions from a
|
||||||
|
// stale pre-disconnect value in the meantime.
|
||||||
|
this.glassesWorn = null;
|
||||||
|
}
|
||||||
this.setPhase(mappedPhase);
|
this.setPhase(mappedPhase);
|
||||||
this.setStatus(state.status);
|
this.setStatus(state.status);
|
||||||
if (mappedPhase === "connected") {
|
if (mappedPhase === "connected") {
|
||||||
this.syncEvenHubScreenOffSetting();
|
this.syncEvenHubScreenOffSetting();
|
||||||
|
this.ensureWearStateTracking();
|
||||||
} else if (mappedPhase !== "charging") {
|
} else if (mappedPhase !== "charging") {
|
||||||
this.cancelEvenHubSuspendTimer();
|
this.cancelEvenHubSuspendTimer();
|
||||||
this.evenHubSessionSuspended = false;
|
this.evenHubSessionSuspended = false;
|
||||||
@@ -854,6 +983,12 @@ class DashboardController {
|
|||||||
this.silentMode = silent;
|
this.silentMode = silent;
|
||||||
this.emit();
|
this.emit();
|
||||||
});
|
});
|
||||||
|
this.offWearState = communicator.onWearState((wearing) => {
|
||||||
|
this.handleWearState(wearing);
|
||||||
|
});
|
||||||
|
this.offPhoneLockState = communicator.onPhoneLockState((locked) => {
|
||||||
|
this.handlePhoneLockState(locked);
|
||||||
|
});
|
||||||
this.offBattery = communicator.onBatteryState((state) => {
|
this.offBattery = communicator.onBatteryState((state) => {
|
||||||
this.lastHeadsetBattery = state.battery >= 0 ? state.battery : null;
|
this.lastHeadsetBattery = state.battery >= 0 ? state.battery : null;
|
||||||
shell.setBatteryLevels({
|
shell.setBatteryLevels({
|
||||||
@@ -897,6 +1032,10 @@ class DashboardController {
|
|||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.includes("wakelease");
|
.includes("wakelease");
|
||||||
|
const wearNotifySupported = info.capabilities
|
||||||
|
.trim()
|
||||||
|
.split(/\s+/)
|
||||||
|
.includes("wearnotify");
|
||||||
if (wakeLeaseSupported !== this.faceclawWakeLeaseSupported) {
|
if (wakeLeaseSupported !== this.faceclawWakeLeaseSupported) {
|
||||||
this.faceclawWakeLeaseSupported = wakeLeaseSupported;
|
this.faceclawWakeLeaseSupported = wakeLeaseSupported;
|
||||||
this.faceclawWakeLeaseState = null;
|
this.faceclawWakeLeaseState = null;
|
||||||
@@ -904,6 +1043,10 @@ class DashboardController {
|
|||||||
this.appendLog(`wake takeover lease sync failed: ${this.formatError(error)}`);
|
this.appendLog(`wake takeover lease sync failed: ${this.formatError(error)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (wearNotifySupported !== this.wearNotifySupported) {
|
||||||
|
this.wearNotifySupported = wearNotifySupported;
|
||||||
|
this.ensureWearStateTracking();
|
||||||
|
}
|
||||||
if (warning !== this.firmwareWarningMessage) {
|
if (warning !== this.firmwareWarningMessage) {
|
||||||
this.firmwareWarningMessage = warning;
|
this.firmwareWarningMessage = warning;
|
||||||
if (warning) {
|
if (warning) {
|
||||||
@@ -936,6 +1079,7 @@ class DashboardController {
|
|||||||
zOrder: 1,
|
zOrder: 1,
|
||||||
transparency: "color-key",
|
transparency: "color-key",
|
||||||
});
|
});
|
||||||
|
await this.configureLockSurface(communicator);
|
||||||
const foregroundWindowId = shell.foregroundWindow()?.windowId;
|
const foregroundWindowId = shell.foregroundWindow()?.windowId;
|
||||||
for (const window of shell.getWindows()) {
|
for (const window of shell.getWindows()) {
|
||||||
await this.configureWindowSurface(
|
await this.configureWindowSurface(
|
||||||
@@ -945,6 +1089,7 @@ class DashboardController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
await communicator.start();
|
await communicator.start();
|
||||||
|
await this.syncLockSurface();
|
||||||
this.syncEvenHubScreenOffSetting();
|
this.syncEvenHubScreenOffSetting();
|
||||||
shell.foregroundWindow()?.requestRender();
|
shell.foregroundWindow()?.requestRender();
|
||||||
this.requestShellRender();
|
this.requestShellRender();
|
||||||
@@ -974,6 +1119,10 @@ class DashboardController {
|
|||||||
this.offBattery = null;
|
this.offBattery = null;
|
||||||
this.offSilentMode?.();
|
this.offSilentMode?.();
|
||||||
this.offSilentMode = null;
|
this.offSilentMode = null;
|
||||||
|
this.offWearState?.();
|
||||||
|
this.offWearState = null;
|
||||||
|
this.offPhoneLockState?.();
|
||||||
|
this.offPhoneLockState = null;
|
||||||
this.offEvenAppConflict?.();
|
this.offEvenAppConflict?.();
|
||||||
this.offEvenAppConflict = null;
|
this.offEvenAppConflict = null;
|
||||||
this.offFrameMetrics?.();
|
this.offFrameMetrics?.();
|
||||||
@@ -992,6 +1141,8 @@ class DashboardController {
|
|||||||
await communicator.close().catch(() => {});
|
await communicator.close().catch(() => {});
|
||||||
}
|
}
|
||||||
this.communicator = null;
|
this.communicator = null;
|
||||||
|
this.lockSurfaceConfigured = false;
|
||||||
|
this.wearNotifySupported = false;
|
||||||
this.faceclawWakeLeaseSupported = false;
|
this.faceclawWakeLeaseSupported = false;
|
||||||
this.faceclawWakeLeaseState = null;
|
this.faceclawWakeLeaseState = null;
|
||||||
this.evenHubResumePromise = null;
|
this.evenHubResumePromise = null;
|
||||||
@@ -1020,6 +1171,10 @@ class DashboardController {
|
|||||||
this.offBattery = null;
|
this.offBattery = null;
|
||||||
this.offSilentMode?.();
|
this.offSilentMode?.();
|
||||||
this.offSilentMode = null;
|
this.offSilentMode = null;
|
||||||
|
this.offWearState?.();
|
||||||
|
this.offWearState = null;
|
||||||
|
this.offPhoneLockState?.();
|
||||||
|
this.offPhoneLockState = null;
|
||||||
this.offEvenAppConflict?.();
|
this.offEvenAppConflict?.();
|
||||||
this.offEvenAppConflict = null;
|
this.offEvenAppConflict = null;
|
||||||
this.offFrameMetrics?.();
|
this.offFrameMetrics?.();
|
||||||
@@ -1033,6 +1188,7 @@ class DashboardController {
|
|||||||
|
|
||||||
const communicator = this.communicator;
|
const communicator = this.communicator;
|
||||||
this.communicator = null;
|
this.communicator = null;
|
||||||
|
this.lockSurfaceConfigured = false;
|
||||||
this.evenHubSessionSuspended = false;
|
this.evenHubSessionSuspended = false;
|
||||||
this.evenHubResumePromise = null;
|
this.evenHubResumePromise = null;
|
||||||
|
|
||||||
@@ -1073,6 +1229,7 @@ class DashboardController {
|
|||||||
stopForegroundNotification();
|
stopForegroundNotification();
|
||||||
this.faceclawWakeLeaseSupported = false;
|
this.faceclawWakeLeaseSupported = false;
|
||||||
this.faceclawWakeLeaseState = null;
|
this.faceclawWakeLeaseState = null;
|
||||||
|
this.wearNotifySupported = false;
|
||||||
this.setPhase("disconnected");
|
this.setPhase("disconnected");
|
||||||
this.setStatus("Disconnected.");
|
this.setStatus("Disconnected.");
|
||||||
this.appendLog("Disconnected from the glasses.");
|
this.appendLog("Disconnected from the glasses.");
|
||||||
@@ -1225,6 +1382,28 @@ class DashboardController {
|
|||||||
let frameOwned = false;
|
let frameOwned = false;
|
||||||
try {
|
try {
|
||||||
const inputEvent = rawInputEventToInputEvent(event);
|
const inputEvent = rawInputEventToInputEvent(event);
|
||||||
|
if (this.glassesLocked) {
|
||||||
|
const ringDoubleTap =
|
||||||
|
inputEvent.type === "double-click" &&
|
||||||
|
event.eventSource === EventSourceType.TOUCH_EVENT_FROM_RING;
|
||||||
|
const suspendedDisplayWake = inputEvent.type === "display-wake";
|
||||||
|
if (ringDoubleTap || suspendedDisplayWake) {
|
||||||
|
if (shell.isScreenOn()) {
|
||||||
|
// A normal ring double-tap still turns the locked display off.
|
||||||
|
// display-wake is directional and can only turn an off display on.
|
||||||
|
if (ringDoubleTap) shell.sleep();
|
||||||
|
} else {
|
||||||
|
shell.wake("sidebar");
|
||||||
|
const ready = await this.ensureEvenHubSessionActive();
|
||||||
|
if (!ready) {
|
||||||
|
this.appendLog("EvenHub wake barrier timed out for locked display");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frameTimings.finishFrame(frameId, "locked display toggled");
|
||||||
|
frameOwned = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
const wakewordShouldWake =
|
const wakewordShouldWake =
|
||||||
event.kind === "even-ai" &&
|
event.kind === "even-ai" &&
|
||||||
event.eventType === EvenAIStatus.EVEN_AI_WAKE_UP &&
|
event.eventType === EvenAIStatus.EVEN_AI_WAKE_UP &&
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* Compatibility check for the glasses firmware. Faceclaw requires the custom
|
* Compatibility check for the glasses firmware. Faceclaw requires the custom
|
||||||
* firmware: version >= 2.2.4.34 with the "img640" and "fbguard" extension tokens
|
* firmware: version >= 2.2.4.34 with the required direct-framebuffer and wear
|
||||||
* in the CFW capability string. Stock firmware sends no capability string at all.
|
* notification tokens in the CFW capability string. Stock firmware sends no
|
||||||
|
* capability string at all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { type FirmwareInfo } from "../native/faceclaw-communicator";
|
import { type FirmwareInfo } from "../native/faceclaw-communicator";
|
||||||
|
|
||||||
const MIN_FIRMWARE_VERSION = [2, 2, 4, 34];
|
const MIN_FIRMWARE_VERSION = [2, 2, 4, 34];
|
||||||
const REQUIRED_FIRMWARE_EXTENSIONS = ["img640", "fbguard"] as const;
|
const REQUIRED_FIRMWARE_EXTENSIONS = ["img640", "fbguard", "wearnotify"] as const;
|
||||||
|
|
||||||
// The stock firmware release Faceclaw's custom image is built from. Stock at or
|
// The stock firmware release Faceclaw's custom image is built from. Stock at or
|
||||||
// below this can be flashed with our patched image; a newer stock version is
|
// below this can be flashed with our patched image; a newer stock version is
|
||||||
@@ -64,7 +65,7 @@ export function firmwareIncompatibilityMessage(info: FirmwareInfo): string | nul
|
|||||||
`${missingExtensions.map((extension) => `"${extension}"`).join(" and ")} extension` +
|
`${missingExtensions.map((extension) => `"${extension}"`).join(" and ")} extension` +
|
||||||
`${missingExtensions.length === 1 ? "" : "s"}` +
|
`${missingExtensions.length === 1 ? "" : "s"}` +
|
||||||
`${info.capabilities.trim() ? ` (reported: ${info.capabilities.trim()})` : ", which suggests stock firmware"}. ` +
|
`${info.capabilities.trim() ? ` (reported: ${info.capabilities.trim()})` : ", which suggests stock firmware"}. ` +
|
||||||
`Faceclaw requires the modified firmware with the guarded 640x480 direct-framebuffer path.`
|
`Faceclaw requires the modified firmware with the guarded 640x480 direct-framebuffer path and wear notifications.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export type FirmwarePatchSet = {
|
|||||||
export const CFW_PATCH_SET: FirmwarePatchSet = {
|
export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||||
"base": "g2_2.2.6.10.bin",
|
"base": "g2_2.2.6.10.bin",
|
||||||
"baseSha256": "f4dfb0b49ad3de3c2daf17f8a27a157c3dc98411d6a0d3ab2cfd0918f41b9afa",
|
"baseSha256": "f4dfb0b49ad3de3c2daf17f8a27a157c3dc98411d6a0d3ab2cfd0918f41b9afa",
|
||||||
"outputSha256": "e8520b2473d6738de5a2bbf73cf4a42523ddd0153dd08f7ad99137fe94bb9d9d",
|
"outputSha256": "cf929ae83ff351cfe81df97460560420fe05a744253e57da564be797df91f2a9",
|
||||||
"patches": [
|
"patches": [
|
||||||
{
|
{
|
||||||
"offset": 1449549,
|
"offset": 1449549,
|
||||||
@@ -42,61 +42,61 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
|||||||
{
|
{
|
||||||
"offset": 1447919,
|
"offset": 1447919,
|
||||||
"old": "7ef7fefd",
|
"old": "7ef7fefd",
|
||||||
"new": "baf29ef8",
|
"new": "baf2ccfa",
|
||||||
"desc": "bl snapshot_side @ 0x4db968"
|
"desc": "bl snapshot_side @ 0x4db968"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 1448931,
|
"offset": 1448931,
|
||||||
"old": "7ef704fc",
|
"old": "7ef704fc",
|
||||||
"new": "b9f2a4fe",
|
"new": "baf2d2f8",
|
||||||
"desc": "bl snapshot_side @ 0x4dbd5c"
|
"desc": "bl snapshot_side @ 0x4dbd5c"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 1165461,
|
"offset": 1165461,
|
||||||
"old": "45f0cefd",
|
"old": "45f0cefd",
|
||||||
"new": "fff24ff8",
|
"new": "fff27dfa",
|
||||||
"desc": "bl image_deferred (deferred consumer -> FIFO restore + worker, both lenses)"
|
"desc": "bl image_deferred (deferred consumer -> FIFO restore + worker, both lenses)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 1186287,
|
"offset": 1186287,
|
||||||
"old": "d9f7d4ff",
|
"old": "d9f7d4ff",
|
||||||
"new": "faf262fc",
|
"new": "fbf256f9",
|
||||||
"desc": "bl settings_send_wrapper (append caps field 100)"
|
"desc": "bl settings_send_wrapper (append caps field 100)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 1183983,
|
"offset": 1183983,
|
||||||
"old": "f4f75aff",
|
"old": "f4f75aff",
|
||||||
"new": "faf2c0fe",
|
"new": "fbf212fb",
|
||||||
"desc": "bl settings_decode_wrapper (Faceclaw lease field 101)"
|
"desc": "bl settings_decode_wrapper (Faceclaw lease field 101)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 926945,
|
"offset": 926945,
|
||||||
"old": "08f068fa",
|
"old": "08f068fa",
|
||||||
"new": "39f3e3fb",
|
"new": "3af335f8",
|
||||||
"desc": "bl faceclaw_display_start @ 0x45c65a (fail-open double-tap takeover)"
|
"desc": "bl faceclaw_display_start @ 0x45c65a (fail-open double-tap takeover)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 927137,
|
"offset": 927137,
|
||||||
"old": "08f008fa",
|
"old": "08f008fa",
|
||||||
"new": "39f383fb",
|
"new": "39f3d5ff",
|
||||||
"desc": "bl faceclaw_display_start @ 0x45c71a (fail-open double-tap takeover)"
|
"desc": "bl faceclaw_display_start @ 0x45c71a (fail-open double-tap takeover)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 822553,
|
"offset": 822553,
|
||||||
"old": "28f003f8",
|
"old": "28f003f8",
|
||||||
"new": "53f335fb",
|
"new": "53f3f1ff",
|
||||||
"desc": "bl evenhub_longpress (replaces force-quit dialog)"
|
"desc": "bl evenhub_longpress (replaces force-quit dialog)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 823369,
|
"offset": 823369,
|
||||||
"old": "1cf09bfb",
|
"old": "1cf09bfb",
|
||||||
"new": "53f3b9f9",
|
"new": "53f375fe",
|
||||||
"desc": "bl ring_release (forward ring release-long-press)"
|
"desc": "bl ring_release (forward ring release-long-press)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 1474137,
|
"offset": 1474137,
|
||||||
"old": "7fb50600",
|
"old": "7fb50600",
|
||||||
"new": "b4f21bba",
|
"new": "b4f20fbf",
|
||||||
"desc": "even_ai_display_ctrl entry -> conditional Faceclaw lease trampoline"
|
"desc": "even_ai_display_ctrl entry -> conditional Faceclaw lease trampoline"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -111,46 +111,58 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
|||||||
"new": "20f33efb",
|
"new": "20f33efb",
|
||||||
"desc": "bl display_copy_hook @ 0x473d68 (640x480 direct framebuffer)"
|
"desc": "bl display_copy_hook @ 0x473d68 (640x480 direct framebuffer)"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"offset": 1198787,
|
||||||
|
"old": "dff770fb",
|
||||||
|
"new": "f7f238fc",
|
||||||
|
"desc": "bl faceclaw_send_wear_event @ 0x49ec3c (outside onboarding)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"offset": 1198881,
|
||||||
|
"old": "dff741fb",
|
||||||
|
"new": "f7f209fc",
|
||||||
|
"desc": "bl faceclaw_send_wear_event @ 0x49ec9a (outside onboarding)"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"offset": 4301227,
|
"offset": 4301227,
|
||||||
"old": "",
|
"old": "",
|
||||||
"new": "02fb01f044f6d341c0f24701084700bf084644f61751c0f24701084770b500284ed001684ef66162ccf2ff02914218bf70bd90f8081190f8095142f6c52c8d42c0f2500c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b149f29942c0f244022146bde87040104770bd00bf2de9f04f99b043f6fc76c2f20006d6f8009048466ff39600b0f1005f40f04c81d9f800004ef66165ccf2ff05a84240f0438199f81c02002800f02d81d9f81842002c00f0288140f2b870c2f20000d0f8008004a801f07af8b8f1000f00f0708140f2030c45f24077cff6807ca4f1600008f160026ff0bf03c0f20207016ed4182166416ec0336166816ebb42a166c16ee166016f2167416f6167816fa167c16fe167d0f88010c4f88010d0f88410c4f88410d0f88810c4f88810d0f88c10c4f88c10d0f89010c4f89010d0f89410c4f89410d0f89810c4f89810d0f89c10c4f89c10d0f8a010c4f8a010d0f8a410c4f8a410d0f8a810c4f8a810d0f8ac10c4f8ac10d0f8b010c4f8b010d0f8b410c4f8b410d0f8b810c4f8b810d0f8bc10c4f8bc1050f8c01fc4f8c0104168c4f8c4108168c4f8c810c168c4f8cc100169c4f8d0104169c4f8d4108169c4f8d810c169c4f8dc10016ac4f8e010416ac4f8e410816ac4f8e810c16ac4f8ec10016bc4f8f010416bc4f8f410816bc4f8f810c16bc4f8fc10016cc4f80011416cc4f80411816cc4f80811c16cc4f80c11016dc4f81011416dc4f81411816dc4f81811c16dc4f81c117ff462afd6f800e00eea0c00b0f1005f40f08080def80000a8427bd19ef8ce00002840f0c5809ef8dc00002100288df8141000f0258105aa505c002800f0f88053185878002800f0ce809878002800f0cc80d878002800f0ca801879002800f0c8805879002800f0c6809879002800f0c480d879002800f0c280187a002800f0c080587a002800f0be80987a002800f0bc80d87a002800f0ba80187b002800f0b880587b002800f0b680987b002800f0b480d87b002800f0b280187c002800f0b080587c002800f0ae80987c002800f0ac80d87c002800f0aa8014315029abd1cae099f81e0268b1d9f8200238b144f63421c2f207010968401a002870dc002089f81e024cf61520c0f2460019b0bde8f04f004744f6d341c0f247014ff409708847002842d00021002200bf831881540432b2f5097f59709970d970f6d1012180f8ce104ff0ff310560a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e0002089f81c02c9f8180289f81e02012089f81d024cf61520c0f24600804714e000203060002089f81c02c9f818024ff4163045f20f11069005a8c0f24701cdf814808847012089f81e0204a800f08cffc9f8d40019b0bde8f08f013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f2921d84ff0520050541dd00a4445204e29507018d04f204d29907014d052204c29d07010d044204b2910710cd045204a29507108d052204929907104d020204829d07140f08c8600208df8630001219ef8dd00002870d0002205ab985c00284fd09f18787838b3b87838b3f87838b3387938b3787938b3b87938b3f87938b3387a38b3787a38b3b87a38b3f87a38b3387b38b3787b38b3b87b38b3f87b38b3387c38b3787c38b3b87c38b3f87c38b31432502ad2d13ce0013222e0023220e003321ee004321ce005321ae0063218e0073216e0083214e0093212e00a3210e00b320ee00c320ce00d320ae00e3208e00f3206e0103204e0113202e0123200e013324f2a15d84ff05300985411d013444b204e2a58700cd049204d2a987008d050204c2ad87004d020204b2a187140f0608100208df8630001319ef8de0000286cd0002105aa505c00284fd05318587838b3987838b3d87838b3187938b3587938b3987938b3d87938b3187a38b3587a38b3987a38b3d87a38b3187b38b3587b38b3987b38b3d87b38b3187c38b3587c38b3987c38b3d87c38b314315029d2d138e0013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f2911d84ff0440050540dd00a4455204e29507008d050204d29907004d020204c29d07040f0ec8000208df8630001219ef8df0000284dd0002105aa505c002800f0bc8053185878002800f092809878002800f09080d878002800f08e801879002800f08c805879002800f08a809879002800f08880d879002800f08680187a002800f08480587a002800f08280987a002800f08080d87a00287ed0187b00287dd0587b00287cd0987b00287bd0d87b00287ad0187c002879d0587c002878d0987c002877d0d87c002876d014315029b4d1d0e0002940f0d180002105aa505c002800f0b88053185878002800f08e809878002800f08c80d878002800f08a801879002800f088805879002800f086809879002800f08480d879002800f08280187a002800f08080587a00287ed0987a00287dd0d87a00287cd0187b00287bd0587b00287ad0987b002879d0d87b002878d0187c002877d0587c002876d0987c002875d0d87c002874d014315029b6d181e0013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f295ad84ff05300505456d00a444e204e29507051d041204d2990704dd050204c29d07049d04f204b29107145d046204a29507141d02020492990713dd00020d0713de00020107113e7002058719fe6013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f290dd84ff04f00505409d00a444b204e29507004d020204d29907040f07b8400208df8630000220df1140b1bf80200002850d00beb0203587838b3987838b3d87838b3187938b3587938b3987938b3d87938b3187a38b3587a38b3987a38b3d87a38b3187b38b3587b38b3987b38b3d87b38b3187c38b3587c38b3987c38b3d87c38b31432502ad0d12be0013222e0023220e003321ee004321ce005321ae0063218e0073216e0083214e0093212e00a3210e00b320ee00c320ce00d320ae00e3208e00f3206e0103204e0113202e012320Line truncated
|
"new": "02fb01f044f6d341c0f24701084700bf084644f61751c0f24701084770b500284ed001684ef66262ccf2ff02914218bf70bd90f8081190f8095142f6c52c8d42c0f2500c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b149f29942c0f244022146bde87040104770bd00bf2de9f04f99b043f6fc76c2f20006d6f8009048466ff39600b0f1005f40f04d81d9f800004ef66267ccf2ff07b84240f0448199f82802002800f02d81d9f82442002c00f0288140f2b870c2f20000d0f8008004a801f006f9b8f1000f00f0fb8140f2030c45f24075cff6807ca4f1600008f160026ff0bf03c0f20205016ed4182166416ec0336166816eab42a166c16ee166016f2167416f6167816fa167c16fe167d0f88010c4f88010d0f88410c4f88410d0f88810c4f88810d0f88c10c4f88c10d0f89010c4f89010d0f89410c4f89410d0f89810c4f89810d0f89c10c4f89c10d0f8a010c4f8a010d0f8a410c4f8a410d0f8a810c4f8a810d0f8ac10c4f8ac10d0f8b010c4f8b010d0f8b410c4f8b410d0f8b810c4f8b810d0f8bc10c4f8bc1050f8c01fc4f8c0104168c4f8c4108168c4f8c810c168c4f8cc100169c4f8d0104169c4f8d4108169c4f8d810c169c4f8dc10016ac4f8e010416ac4f8e410816ac4f8e810c16ac4f8ec10016bc4f8f010416bc4f8f410816bc4f8f810c16bc4f8fc10016cc4f80011416cc4f80411816cc4f80811c16cc4f80c11016dc4f81011416dc4f81411816dc4f81811c16dc4f81c117ff462afd6f800e00eea0c00b0f1005f40f08180def80000b8427cd19ef8ce00002840f050819ef8dc00002100288df8141000f0b08105aa505c002800f0838153185878002800f059819878002800f05781d878002800f055811879002800f053815879002800f051819879002800f04f81d879002800f04d81187a002800f04b81587a002800f04981987a002800f04781d87a002800f04581187b002800f04381587b002800f04181987b002800f03f81d87b002800f03d81187c002800f03b81587c002800f03981987c002800f03781d87c002800f0358114315029abd155e199f82a0270b1d9f82c0240b144f63421c2f207010968401a002800f3fb80002089f82a024cf61520c0f2460019b0bde8f04f004744f6d341c0f247014ff40c708847002800f0cc804ff6d051cff6ff7100224318463183f8302283f8312283f8322283f8332283f8342283f8352283f8362283f8372283f8382283f8392283f83a2283f83b2283f83c2283f83d2283f83e2283f83f2283f8402283f8412283f8422283f8432283f8442283f8452283f8462283f8472283f8482283f8492283f84a2283f84b2283f84c2283f84d2283f84e2283f84f2283f8502283f8512283f8522283f8532283f8542283f8552283f8562283f8572283f8582283f8592283f85a2283f85b2283f85c2283f85d2283f85e2283f85f2283f8602283f8612283f8622283f8632283f8642283f8652283f8662283f8672283f8682283f8692283f86a2283f86b2283f86c2283f86d2283f86e2283f86f2283f8702283f8712283f8722283f8732283f8742283f875227ff470af012180f8ce104ff0ff310760a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e0002089f82802c9f8240289f82a02012089f829024cf61520c0f24600804714e000203060002089f82802c9f824024ff4163045f20f11069005a8c0f24701cdf814808847012089f82a0204a801f017f8c9f8d40019b0bde8f08f013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f2921d84ff0520050541dd00a4445204e29507018d04f204d29907014d052204c29d07010d044204b2910710cd045204a29507108d052204929907104d020204829d07140f08d8600208df8630001219ef8dd00002870d0002205ab985c00284fd09f18787838b3b87838b3f87838b3387938b3787938b3b87938b3f87938b3387a38b3787a38b3b87a38b3f87a38b3387b38b3787b38b3b87b38b3f87b38b3387c38b3787c38b3b87c38b3f87c38b31432502ad2d13ce0013222e0023220e003321ee004321ce005321ae0063218e0073216e0083214e0093212e00a3210e00b320ee00c320ce00d320ae00e3208e00f3206e0103204e0113202e0123200e013324f2a15d84ff05300985411d013444b204e2a58700cd049204d2a987008d050204c2ad87004d020204b2a187140f0608100208df8630001319ef8de0000286cd0002105aa505c00284fd05318587838b3987838b3d87838b3187938b3587938b3987938b3d87938b3187a38b3587a38b3987a38b3d87a38b3187b38b3587b38b3987b38b3d87b38b3187c38b3587c38b3987c38b3d87c38b314315029d2d138e0013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f2911d84ff0440050540dd00a4455204e29507008d050204d29907004d020204c29d07040f0ec8000208df8630001219ef8df0000284dd0002105aa505c002800f0bc8053185878002800f092809878002800f09080d878002800f08e801879002800f08c805879002800f08a809879002800f08880d879002800f08680187a002800f08480587a002800f08280987a002800f08080d87a00287ed0187b00287dd0587b00287cd0987b00287bd0d87b00287ad0187c002879d0587c002878d0987c002877d0d87c002876d014315029b4d1d0e0002940f0d180002105aa505c002800f0b88053185878002800f08e809878002800f08c80d878002800f08a801879002800f088805879002800f086809879002800f08480d879002800f08280187a002800f08080587a00287ed0987a00287dd0d87a00287cd0187b00287bd0587b00287ad0987b002879d0d87b002878d0187c002877d0587c002876d0987c002875d0d87c002874d014315029b6d181e0013122e0023120e003311ee004311ce005311ae0063118e0073116e0083114e0093112e00a3110e00b310ee00c310ce00d310ae00e3108e00f3106e0103104e0113102e0123100e013314f295ad84ff05300505456d00a444e204e29507051d041204d2990704dd050204c29d07049d04f204b29107145d046204a29507141d02020492990713dd00020d0713de00020107113e7002058719fe6013122e002312Line truncated
|
||||||
"desc": "append injected blobs to main-app payload"
|
"desc": "append injected blobs to main-app payload"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 777711,
|
"offset": 777711,
|
||||||
"old": "44c33500",
|
"old": "44c33500",
|
||||||
"new": "b2003600",
|
"new": "850e3600",
|
||||||
"desc": "main-app subheader payload size (ps)"
|
"desc": "main-app subheader payload size (ps)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 152,
|
"offset": 152,
|
||||||
"old": "c4c33500",
|
"old": "c4c33500",
|
||||||
"new": "32013600",
|
"new": "050f3600",
|
||||||
"desc": "main-app TOC entry size (ps + 128)"
|
"desc": "main-app TOC entry size (ps + 128)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 777831,
|
"offset": 777831,
|
||||||
"old": "44c33504",
|
"old": "44c33504",
|
||||||
"new": "b2003604",
|
"new": "850e3604",
|
||||||
"desc": "main-app preamble length (low 24 bits)"
|
"desc": "main-app preamble length (low 24 bits)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 777835,
|
"offset": 777835,
|
||||||
"old": "df8110c9",
|
"old": "df8110c9",
|
||||||
"new": "20ac3023",
|
"new": "739a2743",
|
||||||
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
|
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 156,
|
"offset": 156,
|
||||||
"old": "c1be0fb1",
|
"old": "c1be0fb1",
|
||||||
"new": "2668f4d0",
|
"new": "44359374",
|
||||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
|
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"offset": 777715,
|
"offset": 777715,
|
||||||
"old": "c1be0fb1",
|
"old": "c1be0fb1",
|
||||||
"new": "2668f4d0",
|
"new": "44359374",
|
||||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
|
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ export class FaceclawCommunicatorBridge {
|
|||||||
private readonly ringListeners = new Set<(event: RawInputEvent) => void>();
|
private readonly ringListeners = new Set<(event: RawInputEvent) => void>();
|
||||||
private readonly batteryListeners = new Set<(state: HeadsetBatteryState) => void>();
|
private readonly batteryListeners = new Set<(state: HeadsetBatteryState) => void>();
|
||||||
private readonly silentModeListeners = new Set<(silent: boolean) => void>();
|
private readonly silentModeListeners = new Set<(silent: boolean) => void>();
|
||||||
|
private readonly wearStateListeners = new Set<(wearing: boolean) => void>();
|
||||||
|
private readonly phoneLockStateListeners = new Set<(locked: boolean) => void>();
|
||||||
|
private latestWearState: boolean | null = null;
|
||||||
|
private latestPhoneLockState: boolean | null = null;
|
||||||
private readonly evenAppConflictListeners = new Set<(message: string) => void>();
|
private readonly evenAppConflictListeners = new Set<(message: string) => void>();
|
||||||
private readonly frameMetricsListeners = new Set<(metrics: FrameMetrics) => void>();
|
private readonly frameMetricsListeners = new Set<(metrics: FrameMetrics) => void>();
|
||||||
private readonly firmwareInfoListeners = new Set<(info: FirmwareInfo) => void>();
|
private readonly firmwareInfoListeners = new Set<(info: FirmwareInfo) => void>();
|
||||||
@@ -175,6 +179,14 @@ export class FaceclawCommunicatorBridge {
|
|||||||
onSilentMode: (silent: boolean) => {
|
onSilentMode: (silent: boolean) => {
|
||||||
this.emitAsync(this.silentModeListeners, Boolean(silent));
|
this.emitAsync(this.silentModeListeners, Boolean(silent));
|
||||||
},
|
},
|
||||||
|
onWearState: (wearing: boolean) => {
|
||||||
|
this.latestWearState = Boolean(wearing);
|
||||||
|
this.emitAsync(this.wearStateListeners, this.latestWearState);
|
||||||
|
},
|
||||||
|
onPhoneLockState: (locked: boolean) => {
|
||||||
|
this.latestPhoneLockState = Boolean(locked);
|
||||||
|
this.emitAsync(this.phoneLockStateListeners, this.latestPhoneLockState);
|
||||||
|
},
|
||||||
onEvenAppConflict: (message: string) => {
|
onEvenAppConflict: (message: string) => {
|
||||||
this.emitAsync(this.evenAppConflictListeners, String(message));
|
this.emitAsync(this.evenAppConflictListeners, String(message));
|
||||||
},
|
},
|
||||||
@@ -264,6 +276,28 @@ export class FaceclawCommunicatorBridge {
|
|||||||
return () => this.silentModeListeners.delete(listener);
|
return () => this.silentModeListeners.delete(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWearState(listener: (wearing: boolean) => void): () => void {
|
||||||
|
this.wearStateListeners.add(listener);
|
||||||
|
if (this.latestWearState !== null) {
|
||||||
|
const wearing = this.latestWearState;
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.wearStateListeners.has(listener)) listener(wearing);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
return () => this.wearStateListeners.delete(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPhoneLockState(listener: (locked: boolean) => void): () => void {
|
||||||
|
this.phoneLockStateListeners.add(listener);
|
||||||
|
if (this.latestPhoneLockState !== null) {
|
||||||
|
const locked = this.latestPhoneLockState;
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.phoneLockStateListeners.has(listener)) listener(locked);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
return () => this.phoneLockStateListeners.delete(listener);
|
||||||
|
}
|
||||||
|
|
||||||
onEvenAppConflict(listener: (message: string) => void): () => void {
|
onEvenAppConflict(listener: (message: string) => void): () => void {
|
||||||
this.evenAppConflictListeners.add(listener);
|
this.evenAppConflictListeners.add(listener);
|
||||||
return () => this.evenAppConflictListeners.delete(listener);
|
return () => this.evenAppConflictListeners.delete(listener);
|
||||||
@@ -376,6 +410,10 @@ export class FaceclawCommunicatorBridge {
|
|||||||
await this.enqueueJavaCall(() => this.communicator.setBrightness(Boolean(autoAdjust), Math.round(level)));
|
await this.enqueueJavaCall(() => this.communicator.setBrightness(Boolean(autoAdjust), Math.round(level)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async enableWearDetectionAndRequestState(): Promise<void> {
|
||||||
|
await this.enqueueJavaCall(() => this.communicator.enableWearDetectionAndRequestState());
|
||||||
|
}
|
||||||
|
|
||||||
/** Set the compositor's output frame size. Call before configuring surfaces. */
|
/** Set the compositor's output frame size. Call before configuring surfaces. */
|
||||||
async configureCompositorScreen(width: number, height: number): Promise<void> {
|
async configureCompositorScreen(width: number, height: number): Promise<void> {
|
||||||
await this.enqueueJavaCall(() => {
|
await this.enqueueJavaCall(() => {
|
||||||
|
|||||||
@@ -255,6 +255,15 @@ export const screenTimeoutSetting = new ConfigSettingEnum<ScreenTimeoutSetting>(
|
|||||||
description: "How long the display stays on after the last input before turning itself off. \"Never\" keeps it on until turned off manually.",
|
description: "How long the display stays on after the last input before turning itself off. \"Never\" keeps it on until turned off manually.",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const lockScreenEnabledSetting = new ConfigSettingBoolean({
|
||||||
|
id: "lock-screen-enabled",
|
||||||
|
label: "Enable lock screen",
|
||||||
|
storageKey: "display.lockScreenEnabled",
|
||||||
|
defaultValue: true,
|
||||||
|
description:
|
||||||
|
"Lock the glasses after they are taken off while the phone is locked. Unlocking the phone unlocks the glasses.",
|
||||||
|
});
|
||||||
|
|
||||||
export type VerticalPosition = "top" | "upper" | "middle" | "lower" | "bottom";
|
export type VerticalPosition = "top" | "upper" | "middle" | "lower" | "bottom";
|
||||||
|
|
||||||
const VERTICAL_POSITION_LABELS: Record<VerticalPosition, string> = {
|
const VERTICAL_POSITION_LABELS: Record<VerticalPosition, string> = {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
openAiApiKeySetting,
|
openAiApiKeySetting,
|
||||||
enumSettingMenuItem,
|
enumSettingMenuItem,
|
||||||
firmwareDebugFlagsSetting,
|
firmwareDebugFlagsSetting,
|
||||||
|
lockScreenEnabledSetting,
|
||||||
saveVoiceRecordingsSetting,
|
saveVoiceRecordingsSetting,
|
||||||
suspendEvenHubWhenScreenOffSetting,
|
suspendEvenHubWhenScreenOffSetting,
|
||||||
terminalAuthTokenSetting,
|
terminalAuthTokenSetting,
|
||||||
@@ -58,6 +59,7 @@ function settingsSections(): SettingsSection[] {
|
|||||||
shell.noteUserActivity();
|
shell.noteUserActivity();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
toggleSettingMenuItem(lockScreenEnabledSetting),
|
||||||
// Where min-height windows (and the sidebar) sit vertically on the
|
// Where min-height windows (and the sidebar) sit vertically on the
|
||||||
// screen; the dashboard controller repositions surfaces on change.
|
// screen; the dashboard controller repositions surfaces on change.
|
||||||
enumSettingMenuItem(verticalPositionSetting),
|
enumSettingMenuItem(verticalPositionSetting),
|
||||||
|
|||||||
Reference in new issue
Block a user