<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 - An unofficial user interface for the Even Realities G2 smart glasses
This is an unofficial user interface for the Even Realities G2 smart glasses. It is entirely unofficial, and comes with no support or warranty from Even Realities or from anyone.
This app runs on Android, and requires installing custom firmware on the glasses. The Android app itself can install and uninstall the custom firmware; it downloads the stock firmware from Even and applies patches generated from https://github.com/jimrandomh/g2flash.
Screenshots
Installation
To compile, you will need an Android SDK environment with SDK version 35 installed and licenses accepted, and the ANDROID_HOME pointing to the install. You will need Nativescript installed, and a JDK environment (v21), with the JAVA_HOME environment variable pointed at it. You will also need a reasonably up to date npm and nodejs installed.
To install a version that you compiled, you will need adb connected. Go to
Settings>About phone and tap the "Build number" field seven times. Then plug
the phone's USB-C port into your computer, authorize access on the phone, then
run `nativescript run android
The compile, run
'npm run build'
To install, run
nativescript run android --juslaunch
Features
- A voice assistant that wakes up when you say "Hey Even", transcribes text with an on-device model, OpenAI Whisper, ElevenLabs, or Soniox API, and responds to queries and commands using an onboard model (Qwen3 4B, slow) or with an Anthropic or OpenAI model (requires an API key), or using your own long-running OpenClaw agent (see "Connecting an external agent" below).
- Multitasking, with an app-switcher sidebar and app launcher
- Mostly-compatible with EvenHub apps
- A lock screen; glasses lock automatically when you take them off and unlock when you unlock your phone
- Full-screen apps can use the full 640x480 display area (rather than the 576x288 that EvenHub apps can use)
- Integration with Android notifications: A top-bar that shows the same icons your phone does, popups when notifications arrive, and menu items to dismiss or use Android-app-provided custom actions like mark as read or quick reply.
- Mirror terminal apps such as Claude Code or Codex CLI with g2mirror (https://github.com/jimrandomh/g2mirror), view them on the glasses, and send them inputs with the voice assistant
- Media player controls including playlist and media library navigation, compatible with most Android media players
- Turn-by-turn directions (requires a Mapbox API token)
- Nightscout, an app for viewing blood-glucose data (requires a cloud server and API token)
- Power management: the glasses go to sleep properly when the screen is off, and wake when you double-tap the ring or speak the wakeword, allowing battery life similar to the stock Even app.
- Connection management with auto-reconnect, and autodetection of conflict with the official Even Realities app
- A Wear OS watch app that replaces (and outdoes) the R1 ring: tap, swipe, hold and crown gestures, side buttons, app launching and window switching, voice or keyboard queries to the assistant with the reply on your wrist, typing into apps, and glasses status/lock/display control (see "Watch remote" below)
- On-phone screen mirroring with touch control: tap what you see on the mirror (sidebar icons, launcher cells), or use the phone's own touchpad, d-pad and Back/Menu buttons — the same spatial scheme as the watch — plus a compact ring simulator. A display-mode picker (576×288 band, 576×480 tall, or the full 640×480 panel with an auto-hiding sidebar) and a brightness slider with an Auto toggle sit beside the mirror.
- Bluetooth pairing that scans for nearby glasses and identifies each pair before connecting: model, frame shape, and colour decoded from the advertised serial (with product photos), left and right arms matched to each other by that serial, an estimated distance so the pair in your hand sorts first, and the optional R1 ring
- Dual-language NativeScript architecture with Java for the multithreaded Android API and bluetooth stack bits, Typescript for the bits you want to hack on
Watch remote (Wear OS)
The wear/ directory holds a companion app for Wear OS 3+ watches that turns
the watch into a remote for the glasses. The whole watch face is a touchpad
that mirrors the ring (tap, double-tap, hold, swipe, crown scrolling, side
buttons), and beyond the ring it can launch apps, switch and close windows,
wake/sleep/lock the display, send spoken or typed queries straight to the
assistant (using the watch's own microphone) and show the reply on the wrist,
and type text into apps such as the terminal. Its swipes are a spatial
control scheme the ring never had, with no mode to enter first: the
launcher highlights one app and moves it by rows and columns, right goes
into things (sidebar → window, settings section → items, next track in
Music), left backs out, tap selects, hold opens the context menu, double-tap
or a two-finger tap is back everywhere, and two wrist twists go back; up/down
scroll and right/left select/back everywhere else. The ring's own scheme is
unchanged — watch input is tagged as a separate source. Faceclaw's Settings > Watch
section has the phone-side switches. See wear/README.md for
building and installing it; it is a separate Gradle build, sideloaded over
adb, and needs no Play Store. The phone side requires Google Play services.
Connecting an external agent (OpenClaw)
Instead of calling an LLM API directly from the phone, the voice assistant can route queries to your own long-running agent, which also gets access to the glasses' tools (show alerts, read notifications, control media, type into apps including terminals) both during conversations and proactively. This works through the faceclaw-agent-bridge OpenClaw plugin (https://github.com/jimrandomh/faceclaw-agent-bridge): the phone dials out to it over a websocket (typically across a tailnet).
Setup lives in the faceclaw-agent-bridge repository's README. It covers both the OpenClaw-host side (plugin install and configuration) and the phone side, which can be configured either by hand in Settings > Assistant on the glasses, or over adb using scripts/pull_config.sh and scripts/push_config.sh from this repo; the instructions are written so an OpenClaw agent with the phone plugged into its host can perform the whole setup itself. Note that a pulled settings file contains your API keys, so treat it as a secret (the default output path is gitignored here).
EvenHub App Notes
Faceclaw is mostly compatible with EvenHub apps. If you are developing an app or using an open source app, you can package it into an EHPK file, send it to your phone, and open it in the file browser to install. Or, you can log into EvenHub and download apps there.
Faceclaw runs EvenHub apps through an emulation layer; you may run into bugs and differences in behavior. If you run into bugs, please try tunning them in the stock Android app before you report them to the app's creator. If you're developing your own app and plan to submit it to the Hub, be sure to test it in the stock Android app before submitting.
Additional Caveats
Some permissions are used, but may not reliably prompted for. Go to Android Settings > Apps > Faceclaw to ensure permissions are available or things may not work.
Being a background app on a locked Android phone is fraught, and there may be issues with manufacturer-psecific battery optimization software that lead to it getting paused, throttled to low CPU usage, etc.
Contributing
Be bold. Modify Faceclaw into the app that you want it to be for yourself, without worrying about whether other people will like your version. Then if you think your changes might be useful to others, make a pull request at https://github.com/jimrandomh/faceclaw.
The Typescript and Java code in this repository runs on your phone, not on the glasses themselves, and (with the narrow exception of the firmware-updating tool), can't hurt your hardware. For changes to the glasses firmware, refer to g2flash; changes there require more caution.
Faceclaw is Free Software (GPLv3). Please only contribute code that you wrote (or prompted an agent to write), hold the copyright to, and have tested on physical hardware under real-world conditions. If you make any changes that involve integration with a third party's API or services, modify PRIVACY to mention them and link to that provider's privacy policy. For services that involve a user-provided API key, we assume that the user agreed to any terms associated with that service when they generated the key. For services that don't involve API keys, more caution may be required.



