22 Commits
Author SHA1 Message Date
James Babcock 8b70585da8 Metadata updates for Play Store distribution 2026-11-09 12:08:37 -08:00
James Babcock e103b89510 Battery indicators and other places no longer say "G2" when a G1 or iO is paired 2026-11-07 22:56:31 -08:00
James Babcock 6df52021c8 Apple Watch: Sound-effects and vibrate settings, build scripts
Secret scan / gitleaks (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Tests / test-kotlin (push) Canceled after 0s
Tests / stats-server (push) Canceled after 0s
Tests / evenhub-extensions (push) Canceled after 0s
2026-11-04 03:04:43 -08:00
James Babcock 2696f3b76c Add an Apple Watch app that can control the glasses 2026-11-04 02:20:26 -08:00
James Babcock 27756913d0 Show G2 charging case on Settings tab and charging view rather than main activity 2026-11-02 00:30:21 -08:00
James Babcock 5a9ca08921 Unify vertical position and display mode settings; add to onboarding 2026-10-10 22:48:26 -07:00
James Babcock 48f7f3d01f Fix Kotlin warnings 2026-09-29 12:44:26 -07:00
James Babcock deaa93fead Wake the screen on wear faster after charging 2026-09-28 12:04:15 -07:00
James Babcock 2052e268b0 Add touch-down event to simulated and watch inputs 2026-09-28 02:34:08 -07:00
James Babcock f9724ddcab Convert remaining Java to Kotlin 2026-09-22 17:26:09 -07:00
James Babcock 937c73d81b Add battery indicator for Android Wear watch 2026-09-12 19:35:38 -07:00
James Babcock 4681f14dae Implement press-and-hold for glanceboard in watch and simulated inputs 2026-09-11 19:34:50 -07:00
James Babcock 60c9167a87 Wear app: Fix overflowing text "Glasses disconnected" message by shortening it to "Disconnected" 2026-09-04 10:40:08 -07:00
James Babcock 83c3732ba7 Swap app and system context menu gestures 2026-09-02 21:17:15 -07:00
James Babcock c7d4e7a630 Remove some prototype/unfinished features from the Watch app
Double twist gesture: I wasn't able to get this to trigger, and it
conflicted with a Wear OS builtin gesture.

Swipe left/right remapping: Some parts of the glasses UI are written to
assume that if you're using watch inputs, you have access to left/right
navigation, so letting these be remapped effectively broke them.

Tap zones: An interesting idea, but turned out to be bad UX in practice.
Swipe works much better because you're looking at the glasses screen,
not the watch, while using it.

Natural swipe toggle: Inverted swipe makes sense for touch scrolling,
but didn't make sense in this context.
2026-09-01 23:18:38 -07:00
James Babcock 984c65a90e Watch app uses ambient mode, looks correct when idle, doesn't lose taps when woken 2026-09-01 22:32:24 -07:00
James Babcock 216dc59255 Add support for short-then-long gesture to watch input and simulated inputs 2026-08-31 20:42:49 -07:00
James Babcock 6cd7d5fff9 Watch display shows if glasses are charging or silent mode 2026-08-28 18:36:35 -07:00
James Babcock f858f10ce2 Wear watchface design
Makes the button-row appear and disappear with a slide-in/out gesture.
Rearranges the other UI elements for a more watchface-like view.

<details>
<summary>Prompts used</summary>

In faceclaw/wear, we have an Android Wear watch app which can be used as a glasses controller. Currently, its UI is a bit chaotic: we have a bottom row of buttons, the time, a foreground-window title, some help text, and a ring of indicators. The core interaction is tapping, double tapping, long tapping, and swiping (which have the same effect as on the R1 ring), which aren't location sensitive except that they can't hit the row of buttons. There is also a crown, which can be rotated as a prev/next input.

First, let's make a crown-direction setting (in the Watch section of the on-glasses Settings app), which is a toggle that can swap which crown-rotation direction is considered next vs prev. The default will be off, which will be opposite the direction that is currently default.

Next, we will make it so that the row of buttons is hidden by default. They will slide in from the bottom when the user swipes up from off-screen (distinguished from a swipe-up gesture sent to the glasses by the starting position of the swipe). They will slide out with a swipe down starting from anywhere below the top of the buttons (distinguishing from a swipe-down gesture sent to the glasses by the starting position of the swipe).

Next, we will remove the circle and four arrows; change the time from being small, curved and at the top of the screen to being larger, straight and vertically centered. We'll delete the gesture current hint ("● select  ●● back"), and take the current foreground-window display (which is currently either "Disconnected", "Screen off", or an app title) and place it below the time. When the current state is "Screen off", it will display as "●● Wake". We'll then make it so that when the glasses screen is off, all gestures except for double tap (which wakes the screen) are ignored.

gpt-5.6-Sol:

> Implemented the Wear controller redesign.
>
> - Added on-glasses Settings → Watch toggle: “Clockwise crown = next.” Default off maps clockwise to previous, opposite the former default.
> - Replaced the obsolete “Watch input wakes display” setting.
> - Bottom buttons are hidden initially, slide up from a bottom-edge swipe, and dismiss with a downward swipe anywhere in the tray.
> - Removed the ring, arrows, and gesture hint.
> - Added a large centered straight clock with foreground status beneath it; screen-off status is now “●● Wake.”
> - While the glasses display is off, non-double-tap gestures are ignored locally and defensively on the phone.
> - Updated faceclaw/wear/README.md and faceclaw/wear/PROTOCOL.md.
>
> Verification:
>
> - TypeScript type-check passed.
> - All 59 tests passed.
> - git diff --check passed.
> - Wear Gradle compilation could not start because the sandbox blocks Gradle’s local lock socket/cache access.

</details>
2026-08-28 10:28:37 -07:00
James Babcock dc1d4d30a9 Wear app UI refinements
<details>
<summary>Prompts Used</summary>

Thanks. Next up, let's make soem refinements to the watch app UI.
We'll remove the glasses-battery indicator from the watch UI (it's already on the glasses screen so not needed there).
We'll merge the connection status into the current-app display; rather than one line saying "Connected" and one line saying "Display off" or an app name like "Launcher", we'll merge these into one indicator (in the second line's position), which is "Screen off" or an app name if connected, or a connection status otherwise.
We'll make rotating the crown scroll/select in the same way that swiping up/down on the ring or glasses touchpad does. Apps that want to pay attention to the exact source and details of an input should be able to, but apps that don't pay attention should get sensible behavior by default. (There might already be some code attempting to do this, but currently in my testing the crown has no effect)

> All three refinements are in, and the wear app builds cleanly. Here's what changed:
>
> **Battery indicator removed.** The glasses-battery readout is gone from both places it appeared: the touchpad's status line and the Status screen's connection chip (which now says just "Connected", with "· charging" kept since that signals glasses-in-the-case rather than battery level). The watch-side `PhoneState.battery` field was dropped too since nothing reads it now — the phone still publishes it in the state item (documented in PROTOCOL.md), so nothing changes on the wire.
>
> **Merged status/current-app indicator.** The touchpad's separate top `StatusRow` ("● Connected · 78%") is removed, and `statusLine`/`focusLine` in Common.kt are merged into one `padLine()` used in the centre position: when connected it shows "Screen off", "Locked", "Listening…", or the foreground app name ("Launcher" when nothing's open); otherwise it shows the connection state ("No phone", "Open Faceclaw on phone", "Connecting…", "Glasses disconnected", …). The old status dot's color coding survives as the text color — app names render in the normal text color, problem/busy/off states in the red/amber/gray tones — so the at-a-glance signal isn't lost.
>
> **Crown scrolling.** The pipeline you suspected does exist and the phone side of it is already exactly what you described: crown steps arrive as `scroll-up`/`scroll-down` carrying `source: "watch"`, so apps that inspect the source can, and apps that just switch on the event type get the same behavior as a ring/touchpad swipe. I traced that path end-to-end and found no phone-side gap. The break is on the watch: rotary events are only delivered to a *focused* Compose node, and RemoteScreen requested focus once via `LaunchedEffect(Unit)` with a plain `FocusRequester` — fragile against the nav host and never re-run after anything steals focus (the keyboard activity round-trip, ambient mode, screen off/on). It now uses `rememberActiveFocusRequester()` (Google's documented rotary pattern, present in the bundled wear-compose 1.4.1, with the required `@OptIn(ExperimentalWearFoundationApi)`), plus a lifecycle observer that re-requests focus on every `ON_RESUME`. The accumulator/sensitivity logic is unchanged.
>
> One caveat on the crown: since I can't reproduce the failure off-hardware, this fix targets the most likely cause (focus never landing or being lost). Worth a quick on-device check — and if the crown *still* does nothing, the useful datapoint would be whether `adb logcat` on the phone shows `sys-event .../SCROLL_*` lines when you turn it, which would split watch-side from phone-side cleanly.
</details>
2026-08-25 01:16:31 -07:00
James Babcock eef7aa2679 <details>
<summary>Prompts Used</summary>
Act as a code reviewer for https://github.com/jimrandomh/faceclaw/pull/14 (checked out in this working directory).

> * The review finished — 42 raw candidates were verified down to 10 confirmed findings. Reporting them now.
>
> * Code review(review · 10 findings)
>   ⎿  app/phone-ui/main-view-model.ts
>        ●  766 [correctness]   mirrorFraction subtracts view.getLocationOnScreen() from tap coordinates that NativeScript already delivers
>                               view-local, so every phone-mirror tap is shifted up/left and misroutes
>        ●   84 [resource-leak] MainViewModel's constructor registers onAnySettingChanged and discards the unsubscriber; a new view model is
>                               built on every page navigation, leaking listeners and retained preview bitmaps
>      wear/app/src/main/kotlin/com/faceclaw/wear/MainActivity.kt
>        ●   52 [correctness]   onStop abandons an in-progress stem-button hold without sending LONG_PRESS_RELEASE, so the glasses shell
>                               escape menu opens by itself
>      wear/app/src/main/kotlin/com/faceclaw/wear/ui/TouchpadGestures.kt
>        ●   62 [correctness]   Breaking out of the touchpad gesture loop on a consumed pointer event (or coroutine cancellation mid-hold)
>                               skips onLongPressEnd, leaving a stuck long-press
>      wear/app/src/main/kotlin/com/faceclaw/wear/PhoneLink.kt
>        ●  270 [correctness]   loadStateItem queries the Data Layer with a hostless Uri (`wear:/faceclaw/state`), which matches no stored
>                               items, so the cached phone state is never read
>      app/ui/shell/modal-layer.ts
>        ●   14 [correctness]   MODAL_INTERIOR is a module-level constant frozen at import time from the (now runtime-dynamic) display mode,
>                               while modalRect() is computed live, so modals render corrupted after a display-mode switch
>      app/g2/dashboard-controller.ts
>        ● 1404 [correctness]   handleMirrorTouch wakes the glasses display unconditionally, bypassing the watchWakesDisplaySetting gate
>                               that the parallel injectSyntheticRingInput path honors
>        ● 1440 [correctness]   A mirror tap while any second layer is stacked (e.g. an in-window long-press menu) degrades to a blind
>                               synthetic click that activates whatever is highlighted, not what was tapped
>      App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawWearBridge.java
>        ●  147 [correctness]   Watch gestures/commands queued while the JS listener is down are replayed up to 30 seconds later on listener
>                               registration, executing stale non-idempotent input the watch already reported as failed
>      wear/app/src/main/kotlin/com/faceclaw/wear/ui/RemoteScreen.kt
>        ●  232 [efficiency]    WristTwistDetector (gyroscope, default-on) samples at 100 Hz via DisposableEffect and is not stopped when
>                               the activity stops, draining the watch battery while the process is cached
>
> * Review of PR #14 (Wear OS companion app + remote controls, 85 files, +5813/−102) is done — 10 confirmed findings reported above, ranked by
>   severity. The headline items are the phone-mirror tap coordinate double-correction (which misroutes every mirror tap in the default
>   configuration) and two independent paths on the watch that can drop LONG_PRESS_RELEASE, each of which makes the shell escape menu open on the
>   glasses by itself.
>
> A few things beyond the reported list, for context:
>
> Refuted during verification (looked like bugs, aren't): the watch ack-timeout-during-render theory (input injection never blocks on BLE
> transmit), mirror swipes stealing page scroll (no enclosing ScrollView), and a suspected raw-settings-key notification gap (the store-level
> broadcast covers raw keys).
>
> Confirmed but below the 10-finding cap — worth folding in if you're touching those areas anyway:
> - shell.closeAssistant() no-ops via popIfTop when another layer sits above the assistant, yet still acks ok to the watch.
> - Landscape preview sizing still assumes the old 260-wide panel after the XML moved to 360 (overlap under ~568 dip).
> - The shell escape menu and tool-debug dialogs hardcode SIDEBAR_WIDTH + 8, wrong in the new full-panel mode.
> - A CapabilityClient IPC fires every 250 ms during streamed assistant replies even on watchless phones; backgrounded preview updates bypass
>   their 150 ms floor.
> - Cleanups: the sidebarWidth() > 0 || focus === "sidebar" predicate appears three times, sidebar slot math is duplicated in chrome-layer.ts,
>   dead protocol-version plumbing, dead padPointers field, and display-mode is missing from wear/PROTOCOL.md.
>
> If you'd like, I can apply fixes for any subset of these, or post the findings as inline PR comments (/code-review 14 --comment).

<hr>

Thanks, let's go ahead and write fixes for all of the issues you described.

> Everything builds and tests pass. All 16 issues from the review are fixed — the 10 reported findings plus the six below-cap items. Here's what changed, by fix:
>
> **Watch app (Kotlin)**
> - **Stuck long-press via onStop** — `MainActivity.onStop` now sends `LONG_PRESS_RELEASE` when a stem hold is in progress before dropping the link, so the phone's escape-menu countdown can't run to completion on its own.
> - **Stuck long-press via the gesture loop** — `detectTouchpadGestures` wraps the loop in try/finally that pairs every `onLongPressStart` with an `onLongPressEnd`, covering both the consumed-event `break` and coroutine cancellation mid-hold.
> - **Cached state never loading** — `PhoneLink.loadStateItem` now queries `wear://*/faceclaw/state` (wildcard host) instead of a hostless Uri that matched nothing, so the watch shows the cached dashboard state when the phone is unreachable.
> - **Sensors draining battery while stopped** — the gyroscope/accelerometer/off-body detectors are now driven by a `WhileStartedEffect` helper tied to the activity lifecycle: they stop on `ON_STOP` (palmed screen, back to watch face) and restart on `ON_START`, instead of running at 100 Hz for as long as the process is cached.
> - **Dead protocol plumbing** — removed the unused `Protocol.PROTOCOL_VERSION` const and the never-read `PhoneState.protocol` field; the wire field stays and PROTOCOL.md now documents it as reserved.
>
> **Phone Java**
> - **Stale input replay** — `FaceclawWearBridge` now queues only idempotent `/faceclaw/state/request` messages for replay after the JS listener registers; gestures and commands that arrived while the dashboard was down are acked as failed and dropped, never executed up to 30 seconds later.
>
> **Phone TypeScript**
> - **Mirror taps misrouting (the top finding)** — `mirrorFraction` no longer subtracts `getLocationOnScreen()`; NativeScript's `getX`/`getY` are view-local DIPs (I verified this in the installed `@nativescript/core` gesture source), so every mirror tap was being shifted up-left by the status bar + action bar. Taps now land where you touch.
> - **Mirror touch ignoring the wake setting** — `handleMirrorTouch` now honours `watchWakesDisplaySetting`: with it off, only a double-tap reaches a dark display, matching the rest of the watch scheme.
> - **Blind click through open menus** — `LayerStack.hitTest` now consumes a mirror tap when any layer is stacked (menu, dialog) instead of reporting a miss, so a tap on visible app content can no longer activate whatever menu row happened to be highlighted (e.g. "Close window").
> - **Modal corruption after display-mode switch** — `MODAL_INTERIOR` is now a live `modalInterior()` function, and `ShellModalLayer.paint` re-syncs the inner stack's size each paint, so notification modals render correctly after switching Band ↔ Full panel.
> - **View-model leak** — `MainViewModel` keeps its controller/settings unsubscribers and exposes `attach()`/`dispose()`; `main-page.ts` disposes on unload and re-attaches on load (re-attach is needed because suspend/resume fires unloaded/loaded without a navigation, and `subscribe` delivers a fresh snapshot so nothing is missed).
> - **`closeAssistant` no-op** — new `LayerStack.popThrough` closes the assistant overlay plus anything stacked above it (follow-up voice dialog, alert); the watch ack now says "The assistant was not open." when there was nothing to close.
> - **Watchless-phone IPC churn** — assistant stream events and alerts are skipped when no watch is reachable, so a streaming reply no longer triggers a CapabilityClient lookup every 250 ms.
> - **Backgrounded preview floor bypass** — the 150 ms floor check (and timestamp) in `updateCompositePreview` now runs before the foreground-activity check, so backgrounded per-frame refreshes actually throttle.
> - **Full-panel hardcodes** — the shell escape menu and tool-debug dialogs position at `sidebarWidth() + 8` (0 in full-panel mode) instead of the fixed 64 px strip.
> - **Cleanups** — the strip-visible predicate is now one `sidebarStripVisible()` helper in geometry.ts (used in three places); sidebar slot math is a single `slotPosition()` shared by drawing and hit-testing; dead `padPointers` removed; landscape preview sizing updated to the XML's 360 dp panel; `wear/PROTOCOL.md` documents the `display-mode` command and `displayMode` state field.
>
> Verification: `./build.sh` (webpack + Gradle) succeeds, `npx tsc --noEmit` is clean, the wear `:app:assembleDebug` builds, and all 59 tests pass. The behavioral fixes — especially mirror-tap coordinates, the two long-press-release paths, and the watch state cache — still need a hardware pass to confirm on device.
</details>
2026-08-25 00:09:47 -07:00
Kalani Helekunihi 8fa04d1b46 Add Wear OS companion app and remote controls
Add a Wearable Data Layer bridge for syncing dashboard state and commands.

Introduce a standalone watch app with assistant, app launcher, touchpad remote, settings, and connectivity UI.
2026-08-23 15:02:35 -05:00