Phone screen input shows gesture help for wake (and not random other gesture-help)

This commit is contained in:
James Babcock committed 2026-10-14 01:01:41 -07:00
1 parent 22c31f4240
commit f01214f4a0
8 files changed
+73 -12

No files matched your search

+12 -3
View File
@@ -93,7 +93,7 @@ import { createNotificationsAppWindow, NOTIFICATIONS_SURFACE_ID, NOTIFICATIONS_W
import { isInstalledPackagePresent } from "../apps/evenhub/updates";
import { wearerVerificationOptions } from "../apps/microphones/speakers";
import { micSession } from "../apps/microphones/mic-session";
import { glassesDisplayLabel } from "./glasses-display-state";
import { glassesDisplayAsleep, glassesDisplayLabel, type GlassesDisplayState } from "./glasses-display-state";
import { PreviewDisplayTarget, type DisplayTarget } from "../native/preview-display";
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
@@ -1171,14 +1171,23 @@ class DashboardController {
/** What occupies the foreground-title line on the watch-style controls. */
glassesDisplayLabel(): string {
return glassesDisplayLabel({
return glassesDisplayLabel(this.glassesDisplayState());
}
/** Whether that line reads "Display off" (the watch face adds a wake hint under it). */
glassesDisplayAsleep(): boolean {
return glassesDisplayAsleep(this.glassesDisplayState());
}
private glassesDisplayState(): GlassesDisplayState {
return {
phase: this.phase,
silentMode: this.silentMode,
screenOn: shell.isScreenOn(),
battery: this.lastHeadsetBattery,
foregroundTitle: shell.getForegroundApp()?.title ?? null,
previewMode: this.isPreviewDisplayActive(),
});
};
}
/**
+14 -1
View File
@@ -23,12 +23,25 @@ export function glassesDisplayLabel(state: GlassesDisplayState): string {
if (state.silentMode) {
return "Silent mode";
}
if (!state.screenOn) {
if (glassesDisplayAsleep(state)) {
return "Display off";
}
return state.foregroundTitle || "Launcher";
}
/**
* True when the label reads "Display off": the screen is dark but the glasses
* (or the preview standing in for them) would light it on a wake gesture.
*/
export function glassesDisplayAsleep(state: GlassesDisplayState): boolean {
return (
state.phase !== "charging" &&
(state.phase === "connected" || state.previewMode) &&
!state.silentMode &&
!state.screenOn
);
}
export function chargingDisplayLabel(battery: number | null): string {
return validBatteryLevel(battery) ? `Charging · G2 ${battery}%` : "Charging";
}
+6
View File
@@ -1127,8 +1127,14 @@ export class MainViewModel extends RemoteControlsViewModel {
return dashboardController.glassesDisplayLabel();
}
protected override get padDisplayAsleep(): boolean {
return dashboardController.glassesDisplayAsleep();
}
private refreshPadFocusLine(): void {
this.notifyPropertyChange("padFocusLine", this.padFocusLine);
this.notifyPropertyChange("padFocusClass", this.padFocusClass);
this.notifyPropertyChange("padWakeHintVisibility", this.padWakeHintVisibility);
}
async onPadTap(): Promise<void> {
@@ -33,6 +33,23 @@ export class RemoteControlsViewModel extends Observable {
return this._controlsTab === "ring" ? "tab-button tab-button-selected" : "tab-button";
}
/**
* The watch face's status line reads "Display off": dim it and show the wake
* gesture under it. The host overrides this and notifies padFocusClass and
* padWakeHintVisibility when it changes.
*/
protected get padDisplayAsleep(): boolean {
return false;
}
get padFocusClass(): string {
return this.padDisplayAsleep ? "pad-focus pad-focus-asleep" : "pad-focus";
}
get padWakeHintVisibility(): "visible" | "collapse" {
return this.padDisplayAsleep ? "visible" : "collapse";
}
onSettingsTabTap(): void {
this.setControlsTab("settings");
}
+7 -3
View File
@@ -104,10 +104,14 @@
font-size: 20;
color: #ffffff;
}
.pad-legend {
font-size: 11;
/* "Display off": dimmed like the dark screen it describes. */
.pad-focus-asleep {
color: #8a8a8a;
margin-bottom: 8;
}
.pad-wake-hint {
font-size: 13;
color: #6a6a6a;
margin-top: 4;
}
.action-row {
margin-top: 6;
+6 -4
View File
@@ -52,10 +52,12 @@
</StackLayout>
<!-- Watch tab: centered in the leftover height, capped at the 1.5:1 face
aspect (watchFaceWidth = min(available, 1.5 x face height). -->
<GridLayout visibility="{{ watchTabVisibility }}" width="{{ watchFaceWidth }}" height="{{ watchFaceHeight }}" horizontalAlignment="center" verticalAlignment="center" class="touchpad" android:tap="{{ onPadTap }}" android:doubleTap="{{ onPadDoubleTap }}" android:longPress="{{ onPadLongPress }}" android:swipe="{{ onPadSwipe }}" touch="{{ onPadTouch }}">
<Label isUserInteractionEnabled="false" text="{{ padFocusLine }}" class="pad-focus" horizontalAlignment="center" verticalAlignment="center" />
<Label isUserInteractionEnabled="false" text="▲▼ swipe ● select ●● back ‒ menu" class="pad-legend" horizontalAlignment="center" verticalAlignment="bottom" />
aspect (watchFaceWidth = min(available, 1.5 x face height). The star
rows center the status line, plus the wake hint under it while the
display is off (a double-tap is the only gesture that wakes it). -->
<GridLayout visibility="{{ watchTabVisibility }}" width="{{ watchFaceWidth }}" height="{{ watchFaceHeight }}" rows="*,auto,auto,*" horizontalAlignment="center" verticalAlignment="center" class="touchpad" android:tap="{{ onPadTap }}" android:doubleTap="{{ onPadDoubleTap }}" android:longPress="{{ onPadLongPress }}" android:swipe="{{ onPadSwipe }}" touch="{{ onPadTouch }}">
<Label row="1" isUserInteractionEnabled="false" text="{{ padFocusLine }}" class="{{ padFocusClass }}" horizontalAlignment="center" />
<Label row="2" isUserInteractionEnabled="false" text="●● wake" visibility="{{ padWakeHintVisibility }}" class="pad-wake-hint" horizontalAlignment="center" />
</GridLayout>
<!-- Ring tab: a touchpad on the ring's own scheme. Vertical swipes only
Binary file not shown.
+11 -1
View File
@@ -1,7 +1,7 @@
const test = require("node:test");
const assert = require("node:assert/strict");
const { chargingDisplayLabel, glassesDisplayLabel } = require("../.test-build/app/g2/glasses-display-state.js");
const { chargingDisplayLabel, glassesDisplayAsleep, glassesDisplayLabel } = require("../.test-build/app/g2/glasses-display-state.js");
const connected = {
phase: "connected",
@@ -9,6 +9,7 @@ const connected = {
screenOn: true,
battery: 72,
foregroundTitle: "Music",
previewMode: false,
};
test("the foreground-title line covers visible, dark, and silent displays", () => {
@@ -18,6 +19,15 @@ test("the foreground-title line covers visible, dark, and silent displays", () =
assert.equal(glassesDisplayLabel({ ...connected, screenOn: false, silentMode: true }), "Silent mode");
});
test("only the Display off state counts as asleep (the watch face's wake hint)", () => {
assert.equal(glassesDisplayAsleep({ ...connected, screenOn: false }), true);
assert.equal(glassesDisplayAsleep({ ...connected, phase: "disconnected", screenOn: false, previewMode: true }), true);
assert.equal(glassesDisplayAsleep(connected), false);
assert.equal(glassesDisplayAsleep({ ...connected, screenOn: false, silentMode: true }), false);
assert.equal(glassesDisplayAsleep({ ...connected, phase: "charging", screenOn: false }), false);
assert.equal(glassesDisplayAsleep({ ...connected, phase: "disconnected", screenOn: false }), false);
});
test("charging takes precedence and includes the last-known G2 battery", () => {
assert.equal(
glassesDisplayLabel({ ...connected, phase: "charging", silentMode: true, screenOn: false }),