<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>
Faceclaw for Wear OS
A watch remote for Faceclaw: everything the Even R1 ring can do, plus the things it can't. Runs on a Wear OS 3+ watch (API 30) paired with the phone that runs Faceclaw. It is a remote, not a standalone app — without Faceclaw on the phone it only tells you to install it.
What it does
The pad (the home screen; the whole display is the touch surface):
| On the watch | On the glasses |
|---|---|
| tap | select |
| double-tap, or a two-finger tap | back, everywhere: closes menus, leaves a settings column, leaves a folder or the launcher grid, returns to the sidebar (and from the sidebar turns the display off, as the ring does) |
| press and hold | the app's context menu (a long press, held until you lift your finger) |
| swipe ↑ ↓ ← → | spatial navigation, with no mode to enter first: the launcher highlights one app and the swipe moves it by a row or a column; the settings panel moves between its columns and down its lists; the sidebar moves up and down; Music skips to the previous / next track. Right goes into things (sidebar → window, section → items) and left comes back out (first column → sidebar). Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe (long swipes used to repeat, which overshot lists whenever the display lagged); use repeated flicks, the crown, or a two-finger page swipe to cover distance. "Natural swipe" flips the vertical sense; left/right can be remapped in settings. |
| rotate the crown | up / down (one step per detent-ish, sensitivity adjustable) — in the launcher that is rows, elsewhere scrolling |
| two-finger swipe up / down | scroll a page (3 steps) |
| twist the wrist twice (two brisk flicks, either direction) | back — from the gyroscope; on by default, sensitivity adjustable |
| tip taps — tap your index finger against your thumb | select; two quick taps = back. From the accelerometer; off by default (experimental): on a wrist, ordinary hand movement produced phantom selects in testing. Turn on in Watch settings; needs ~¼ s of stillness before a tap counts, and both motion gestures are ignored while the watch is off the wrist or buzzing. |
| Tap zones mode | tap the top / bottom third to scroll, the middle to select — for when swiping is awkward |
The R1 ring's scheme is untouched: the ring only has up/down, tap, double-tap and hold, so on the glasses it still works in the stock two-step way (pick a launcher row, tap, pick the app). Watch input is tagged as its own source, so the same screens give the watch the direct scheme above without the ring ever seeing a difference.
Side buttons (when the app is in front): button 1 tap = select, hold = long press; button 2 = back; button 3 = "Hey Even". You can also set the watch's button shortcut to open Faceclaw.
Bottom row buttons: Assistant, Type into app, Apps, Status.
- Assistant — ask the assistant using the watch's microphone (system speech recognition) or the Wear keyboard, and read the reply on the watch as it streams, mirrored from the glasses overlay. The watch buzzes when the reply finishes. "Hey Even" instead opens the glasses' own voice dialog, which uses the glasses mic.
- Type into app — dictate or type text into the foreground app (the terminal, for instance), the same path finalized voice input takes.
- Apps — the sidebar's open windows (tap to switch, × to close) and the full launcher, including installed EvenHub apps.
- Status — connection and battery, display on/off, lock/unlock, connect / disconnect, and whether Faceclaw is running on the phone; watch settings (haptics, keep screen on, swipe direction, tap zones, horizontal swipe actions, tip taps and their sensitivity, crown sensitivity).
The pad keeps the watch display awake while it is showing (Watch settings > "Keep screen on", default on). Wear OS otherwise dozes within seconds of the wrist dropping and freezes the app, so the remote would need a wake-up tap before every gesture.
Phone-side switches live in Faceclaw's Settings > Watch: turn watch control off entirely, decide whether watch input wakes a dark display (on by default — the ring only wakes it with a double-tap), forbid unlocking from the watch, or stop mirroring assistant replies.
The watch buzzes differently when the phone refuses or doesn't answer a gesture (glasses disconnected, locked, watch control off); the pill at the bottom of the pad says why.
Building and installing
The watch app is a separate Gradle project (Kotlin + Compose for Wear OS). It needs the same Android SDK the phone build uses and a JDK 17+:
cd wear && JAVA_HOME=/path/to/jdk ANDROID_HOME=~/Library/Android/sdk ./gradlew :app:assembleDebug
The APK lands in app/build/outputs/apk/debug/. Install it on the watch over
adb (enable developer options on the watch, then ADB debugging and, for a
watch without USB, Wireless debugging / debug over Wi-Fi):
adb connect <watch-ip>:5555
adb -s <watch-ip>:5555 install -r app/build/outputs/apk/debug/app-debug.apk
Two things must match the phone app or the Data Layer silently won't route:
- Application id
com.faceclaw.app— already set inapp/build.gradle.kts. - Signing key. Debug builds of both apps use the shared Android debug
keystore (
~/.android/debug.keystore) on the machine that builds them, so building both on the same computer just works. For release builds, sign the watch APK with the same keystore as the phone APK.
There's no Play Store listing; sideload.
Troubleshooting
- "No phone connected" — the watch has no Bluetooth link to any phone.
- "Install Faceclaw on the phone" — a phone is connected but no app there
advertises the
faceclaw_phonecapability: the phone build predates the watch integration, or the app ids / signing keys differ. - "Open Faceclaw on the phone" — the phone app is installed but its dashboard isn't running (Play services started the process just for our message). Open Faceclaw once; it keeps running with its foreground service while connected to the glasses.
- "The glasses are not connected" — tap Status > Connect.
- Nothing happens and no message: check Settings > Watch on the phone.
Gestures the watch itself owns — the edge swipe-to-dismiss, the OS-level double-pinch / "universal" gestures on some watches — are not available to apps and aren't remapped here.
Protocol details: PROTOCOL.md.