AGENTS.md โ library/wearlink/ (':library:wearlink')
Scoped supplement. Global rules in root AGENTS.md apply.
- Gradle: :library:wearlink / dir: library/wearlink/
- Package:
com.vayunmathur.library.wearlinkfor the transport, plus one
per-app protocol subpackage (e.g. com.vayunmathur.library.wearlink.clock)
- Entry:
WearLinkNode.kt(Android),WearLinkProtocol.kt(pure wire),
conduit/WearLinkClientNode.kt (Messenger client used by every app except the Watch apps)
- Wear entry shell:
WearShellActivity.ktโ every wear companion's main
activity extends WearShellActivity<route, store> (createStore() warm-up, Wear Material theme + route state held in the shell; no permission request โ the Watch conduit owns Bluetooth); each wear module keeps its concrete activity name, route type and screen when.
Purpose
First-party replacement for the proprietary Play-services Wearable Data Layer. RFCOMM over already-bonded Bluetooth, both sides listen + dial, cert-bound handshake. No Play services, no BLE scan/advertise, no location.
Also hosts the shared phone<->wear wire protocols that were previously duplicated per app pair: each migrated protocol lives in com.vayunmathur.library.wearlink.<app> and is consumed by both the phone and wear app modules (which may not depend on each other). Golden-JSON tests stay in each app module and pin the shared code's wire format. Migrated: clock, launcher, calendar, weather, music, notes, maps, appstore, contacts, findfamily, todo, communicate, camera. Remaining pairs are listed in docs/structure/wear-protocol-pairs.tsv.
The conduit/ package is the Watch conduit contract and core: ConduitProtocol (Messenger codes/keys), ConduitRouter (pure routing: registrations, latest-data replay, bounded queue for unregistered apps, status fan-out, counters), WearLinkClientNode (drop-in WearLinkNode replacement over the conduit binding; reports NotInstalled/Unavailable when the Watch app is absent), and ConduitHost/ConduitRuntime used by the two Watch apps' ConduitServices. Merged phone/watch pairs ship as single APKs whose phone and watch experiences pick their side at runtime. This module declares no Bluetooth permissions; only the Watch apps (:watch, :watch:wear) do.
Verify
./gradlew :library:wearlink:testDebugUnitTest
./gradlew :library:wearlink:lint