Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / watch / AGENTS.md

AGENTS.md2.2 KiBRenderedCodeRaw
1# AGENTS.md — watch/ (':watch')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply.
4
5- Gradle: :watch / dir: watch/
6- Package roots present: ui, platform, service
7- Entry files: MainActivity.kt, Route.kt, Navigation.kt
8- Deps: :library:wearlink
9- Metadata: metadata_data/watch.md (present)
10- Rust: no / screenshotTest: yes
11
12## Overview
13**Purpose:** Phone half of the Watch conduit — the sole phone<->watch
14messaging app on the phone. It is the only phone app that holds
15Bluetooth permissions and the only one that owns a real
16`WearLinkNode` (appId `watch_conduit`, in `service/ConduitService`
17via `ConduitHost` in `:library:wearlink`). Every other app reaches
18the watch through `WearLinkClientNode` bound to this app's conduit
19service.
20**Architecture / data-flow:** `service/ConduitService` (foreground,
21`connectedDevice`) hosts `ConduitHost` -> `ConduitRouter`, which
22routes by first path segment between local Messenger clients and
23the peer. `platform/BootReceiver` restarts it on boot/replacement.
24The single status screen renders `ConduitRuntime.state` (link state,
25registered apps, per-app counters) and offers the Bluetooth
26permission grant.
27**Entry points + reading order:** `Route` (`Status`) → `MainActivity.kt`
28→ `Navigation.kt` → `ui/WatchStatusScreen.kt`; service side:
29`service/ConduitService.kt` → `:library:wearlink` conduit package.
30**Gotchas:**
31- `applicationId com.vayunmathur.watch` and the signing key are shared
32 with `:watch:wear` on purpose: the handshake token and the
33 `com.vayunmathur.watch.permissions.CONDUIT` signature permission
34 both require one identity.
35- Do not add Bluetooth permissions anywhere else. wearlink declares
36 none; this app and :watch:wear are the only Bluetooth holders.
37
38## Key files
39### Root — entry + navigation
40- com/vayunmathur/watch/MainActivity.kt
41- com/vayunmathur/watch/Navigation.kt
42- com/vayunmathur/watch/Route.kt
43### service/ — conduit host
44- com/vayunmathur/watch/service/ConduitService.kt
45### platform/ — boot restart
46- com/vayunmathur/watch/platform/BootReceiver.kt
47### ui/ — status screen
48- com/vayunmathur/watch/ui/WatchStatusScreen.kt
49
50## Verify (this module only)
51```
52./gradlew :watch:compileDevKotlin
53./gradlew :watch:lint
54./gradlew :watch:checkMetadata
55```