AGENTS.md — watch/ (':watch')
Scoped supplement. Global rules in root AGENTS.md apply.
- Gradle: :watch / dir: watch/
- Package roots present: ui, platform, service
- Entry files: MainActivity.kt, Route.kt, Navigation.kt
- Deps: :library:wearlink
- Metadata: metadata_data/watch.md (present)
- Rust: no / screenshotTest: yes
Overview
Purpose: Phone half of the Watch conduit — the sole phone<->watch messaging app on the phone. It is the only phone app that holds Bluetooth permissions and the only one that owns a real WearLinkNode (appId watch_conduit, in service/ConduitService via ConduitHost in :library:wearlink). Every other app reaches the watch through WearLinkClientNode bound to this app's conduit service. Architecture / data-flow: service/ConduitService (foreground, connectedDevice) hosts ConduitHost -> ConduitRouter, which routes by first path segment between local Messenger clients and the peer. platform/BootReceiver restarts it on boot/replacement. The single status screen renders ConduitRuntime.state (link state, registered apps, per-app counters) and offers the Bluetooth permission grant. Scheduled push sync: service/ConduitSyncScheduler (started by ConduitService) discovers sync-capable apps from the package manager (broadcast receivers answering ConduitSync.ACTION under the CONDUIT signature permission, via the manifest <queries> entry for that action), merged with the persisted registration registry (ConduitSyncRegistry, a supplement naming appIds for registered packages), and fires the ConduitSync.ACTION intent at each app on three triggers: the RFCOMM link connecting, a phone app registering, and service/ConduitSyncWorker's 15-minute WorkManager period. Manifest receivers wake apps that have never run since install/reboot. Absent apps are tolerated; the intent carries only the appId. Entry points + reading order: Route (Status) → MainActivity.kt → Navigation.kt → ui/WatchStatusScreen.kt; service side: service/ConduitService.kt → :library:wearlink conduit package. Gotchas:
applicationId com.vayunmathur.watchand the signing key are shared
with :watch:wear on purpose: the handshake token and the com.vayunmathur.watch.permissions.CONDUIT signature permission both require one identity.
- Do not add Bluetooth permissions anywhere else. wearlink declares
none; this app and :watch:wear are the only Bluetooth holders.
Key files
Root — entry + navigation
- com/vayunmathur/watch/MainActivity.kt
- com/vayunmathur/watch/Navigation.kt
- com/vayunmathur/watch/Route.kt
service/ — conduit host
- com/vayunmathur/watch/service/ConduitService.kt
platform/ — boot restart
- com/vayunmathur/watch/platform/BootReceiver.kt
ui/ — status screen
- com/vayunmathur/watch/ui/WatchStatusScreen.kt
Verify (this module only)
./gradlew :watch:compileDevKotlin
./gradlew :watch:lint
./gradlew :watch:checkMetadata