Modern Apps git

← Modern-Apps.git

apps: add manifest open-on-phone receivers for watch wake

Commit
3b5b640857c4726dda71a35e79f870e40c61f8c1
Author
Vayun Mathur <[email protected]>
When
2026-12-06 05:54 UTC (11 hours ago)
Parents
839c8f1
Mechanical per-app wiring for the shared wearlink open-on-phone
wake (see the preceding wearlink commit): every app whose watch
experience has an Open on phone button gains a manifest
OpenOnPhoneReceiver exported only under the CONDUIT signature
permission, answering OpenOnPhoneContract.ACTION for its own appId
by launching its MainActivity through OpenOnPhoneLauncher (new task,
wear_open_id extra). Camera's existing receiver additionally answers
the shared action alongside its legacy camera action; appstore gains
the receiver even though it has no sync-trigger receiver. Each app's
live sync message handler now launches through the same shared
launcher, so the registered and woken paths build identical intents.
The watch side is unchanged: it still sends the same conduit message.

Apps: notes, clock, calendar, weather, music, contacts, findfamily,
todo, communicate, launcher, appstore, camera. Maps has no watch
open-on-phone button and is untouched. Per-module AGENTS.md updated
where they documented the receiver set or the open path.

Verified per module (lint/lintVitalRelease/testDevUnitTest):
wearlink, notes, weather, music, launcher, appstore, camera,
findfamily and todo pass fully; clock, calendar and contacts lint
passes with unit-test failures that reproduce unchanged on clean
origin/main (ClockPagesUiTest, ImportGlanceHolidayTest,
DeepInteractionsPass2Test/InsertOrEditIntentActivityPass2Test), and
communicate's one parallel-run failure passes on re-run.

Diff

appstore/AGENTS.md
diff --git a/appstore/AGENTS.md b/appstore/AGENTS.mdindex 5ed35f0498..03ca730bbb 100644--- a/appstore/AGENTS.md+++ b/appstore/AGENTS.md@@ -43,7 +43,7 @@ form factor. **Protocol:** shared wire types live in `:library:wearlink` at `com.vayunmathur.library.wearlink.appstore.WearSyncProtocol`; the golden-JSON test in `domain/WearSyncProtocolTest` pins the shared code's wire format. - Catalog + watch-state sync: conduit data items (`/appstore/catalog`, `/appstore/watch-state`) - Offers / install requests / results: conduit messages; APK bytes: conduit stream (`/appstore/apk/<package>`), verified size+SHA-256 against the preceding offer before PackageInstaller ever sees them-- **Transport: Watch conduit client** — phone side `sync/WearSyncManager` and watch side `sync/WearLinkBridge` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `appstore`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; the catalog and watch state republish on conduit `Connected`. Delivery is app-lifecycle-bound — no system listener wakes a dead process. `FormFactor` picks the side at runtime.+- **Transport: Watch conduit client** — phone side `sync/WearSyncManager` and watch side `sync/WearLinkBridge` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `appstore`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; the catalog and watch state republish on conduit `Connected`. Catalog delivery is app-lifecycle-bound, but the watch open-on-phone request is not: `sync/OpenOnPhoneReceiver` (manifest, `CONDUIT` signature permission) launches the main activity when the conduit host broadcasts it for an app with no live registration. `FormFactor` picks the side at runtime.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`, `exported=false`, entered only via `MainActivity`'s watch routing) is the whole watch store: one scrolling catalog/install list reading only the watch's persisted state, so it works standalone with whatever has already been downloaded.
appstore/src/main/AndroidManifest.xml
diff --git a/appstore/src/main/AndroidManifest.xml b/appstore/src/main/AndroidManifest.xmlindex 7a505c0745..0ec35fa2cb 100644--- a/appstore/src/main/AndroidManifest.xml+++ b/appstore/src/main/AndroidManifest.xml@@ -190,5 +190,18 @@             </intent-filter>         </receiver> ++        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application> </manifest>
appstore/src/main/java/com/vayunmathur/appstore/sync/OpenOnPhoneReceiver.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/sync/OpenOnPhoneReceiver.kt b/appstore/src/main/java/com/vayunmathur/appstore/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..2f95f815aa--- /dev/null+++ b/appstore/src/main/java/com/vayunmathur/appstore/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.appstore.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "appstore"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.appstore.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
appstore/src/main/java/com/vayunmathur/appstore/sync/WearSyncManager.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/sync/WearSyncManager.kt b/appstore/src/main/java/com/vayunmathur/appstore/sync/WearSyncManager.ktindex 2d8418ceee..4406bce431 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/sync/WearSyncManager.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/sync/WearSyncManager.kt@@ -1,7 +1,6 @@ package com.vayunmathur.appstore.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.appstore.data.UnifiedApp import com.vayunmathur.library.wearlink.appstore.ApkHash import com.vayunmathur.library.wearlink.appstore.ApkOffer@@ -20,6 +19,7 @@ import com.vayunmathur.library.wearlink.FileStreamSource import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import java.io.File import java.io.IOException@@ -62,7 +62,7 @@ class WearSyncManager(     private val listener = object : WearLinkListener {         override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { context.startActivity(Intent(context, com.vayunmathur.appstore.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(context, com.vayunmathur.appstore.MainActivity::class.java, body.decodeToString())                 return             }             if (path != WearSyncProtocol.INSTALL_RESULT_PATH) return
calendar/AGENTS.md
diff --git a/calendar/AGENTS.md b/calendar/AGENTS.mdindex 30921ee740..51d319639e 100644--- a/calendar/AGENTS.md+++ b/calendar/AGENTS.md@@ -42,6 +42,7 @@ any phone state loads; phones get the month/agenda UI. The phone - Sync request and event delete: conduit messages (`/calendar/request-sync`, `/calendar/op` with a delete-event op the phone applies to the provider), watch -> phone only - **Transport: Watch conduit client** — phone side `sync/WearCalendarSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `calendar`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected` and on calendar changes. `FormFactor` picks the side at runtime, so only one of the two nodes runs on a given device. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearCalendarSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first. **Watch experience:** - `ui/WearMainActivity` routes `ui/WearRoute` over the agenda (`ui/WearAgendaScreen`) and event detail (`ui/WearEventScreen`: read-only fields plus a Delete event button after Open on phone, applied by the phone over the conduit), rendered from `data/WearCalendarStore` (`wear-calendar-snapshot.json`); sectioning is `domain/wearAgenda`. The watch has no event editing or RSVP and no manual sync action; snapshots arrive automatically over the conduit. - Watch listing screenshots are the `group = "wear"` previews in `src/screenshotTest/.../ui/WearMetadataPreviews.kt`, collected by `:calendar:metadata` into `metadata_data/photos/calendar/wear/`; phone shots use the `phone` bucket.
calendar/src/main/AndroidManifest.xml
diff --git a/calendar/src/main/AndroidManifest.xml b/calendar/src/main/AndroidManifest.xmlindex eec594f6a9..6690c5d410 100644--- a/calendar/src/main/AndroidManifest.xml+++ b/calendar/src/main/AndroidManifest.xml@@ -226,6 +226,18 @@                 android:name="androidx.wear.tiles.PREVIEW"                 android:resource="@mipmap/ic_launcher" />         </service>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application>  </manifest>\ No newline at end of file
calendar/src/main/java/com/vayunmathur/calendar/sync/OpenOnPhoneReceiver.kt
diff --git a/calendar/src/main/java/com/vayunmathur/calendar/sync/OpenOnPhoneReceiver.kt b/calendar/src/main/java/com/vayunmathur/calendar/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..9aaaf7af84--- /dev/null+++ b/calendar/src/main/java/com/vayunmathur/calendar/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.calendar.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "calendar"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.calendar.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt
diff --git a/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt b/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.ktindex 63dff686e3..ac7d6ccb7e 100644--- a/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt+++ b/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt@@ -1,7 +1,6 @@ package com.vayunmathur.calendar.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.calendar.data.Calendar import com.vayunmathur.calendar.data.Event import com.vayunmathur.calendar.data.Instance@@ -17,6 +16,7 @@ import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers@@ -96,7 +96,7 @@ class WearCalendarSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.calendar.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.calendar.MainActivity::class.java, body.decodeToString())                 return             }             if (path == WearCalendarProtocol.OP_PATH) {
camera/src/main/AndroidManifest.xml
diff --git a/camera/src/main/AndroidManifest.xml b/camera/src/main/AndroidManifest.xmlindex 50c75deed1..d99f84a6a9 100644--- a/camera/src/main/AndroidManifest.xml+++ b/camera/src/main/AndroidManifest.xml@@ -112,6 +112,7 @@             android:permission="com.vayunmathur.watch.permissions.CONDUIT">             <intent-filter>                 <action android:name="com.vayunmathur.camera.action.OPEN_ON_PHONE" />+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />             </intent-filter>         </receiver>         <!-- Watch experience: entered only via MainActivity's watch routing
camera/src/main/java/com/vayunmathur/camera/sync/OpenOnPhoneReceiver.kt
diff --git a/camera/src/main/java/com/vayunmathur/camera/sync/OpenOnPhoneReceiver.kt b/camera/src/main/java/com/vayunmathur/camera/sync/OpenOnPhoneReceiver.ktindex 61423622c7..d7b17922a0 100644--- a/camera/src/main/java/com/vayunmathur/camera/sync/OpenOnPhoneReceiver.kt+++ b/camera/src/main/java/com/vayunmathur/camera/sync/OpenOnPhoneReceiver.kt@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import com.vayunmathur.camera.platform.AndroidPhoneCameraLauncher+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract  /**  * Pure decision for the direct open-on-phone broadcast: only this app's@@ -13,6 +14,9 @@ object OpenOnPhoneHandler {     /** Broadcast action asking this app to open its Camera on the phone. */     const val ACTION = "com.vayunmathur.camera.action.OPEN_ON_PHONE" +    /** Conduit appId this app opens under. */+    const val APP_ID = "camera"+     /** True (and [launch] invoked) only for [ACTION]. */     fun handle(         action: String?,@@ -22,6 +26,17 @@ object OpenOnPhoneHandler {         launch()         return true     }++    /** True (and [launch] invoked) only for the shared conduit wake for camera. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    } }  /**@@ -37,8 +52,12 @@ class OpenOnPhoneReceiver : BroadcastReceiver() {         context: Context,         intent: Intent,     ) {-        OpenOnPhoneHandler.handle(intent.action) {-            AndroidPhoneCameraLauncher(context.applicationContext).launchCamera()-        }+        val launch = { AndroidPhoneCameraLauncher(context.applicationContext).launchCamera() }+        if (OpenOnPhoneHandler.handle(intent.action, launch)) return+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+            launch,+        )     } }
clock/AGENTS.md
diff --git a/clock/AGENTS.md b/clock/AGENTS.mdindex 80393861e2..77953ae50c 100644--- a/clock/AGENTS.md+++ b/clock/AGENTS.md@@ -41,6 +41,7 @@ same way — `platform/BootReceiver` (phone) and - Sync request: conduit message (`/clock/request-sync`), watch -> phone only - **Transport: Watch conduit client** — phone side `sync/WearClockSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `clock`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected` and on alarm/world-clock changes. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearClockSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`) routes `ui/WearRoute`: the root `Home` is a swipe pager (`ui/WearPagerScreen` + `ui/WearClockPage`: home time face, world clocks, alarms, timers, stopwatch) and `AlarmDetail` pushes over it on the shell back stack. World clocks are synced/display-only; alarms are synced and armed on the watch by `platform/WatchAlarmScheduler` (armed proof in `domain/WearAlarmState.kt`); timers + stopwatch are watch-native (`platform/WatchTimerScheduler`, `domain/WatchTimerState.kt`). The pager uses the Material 1 wear generation the repo ships (foundation `HorizontalPager` + Material `Scaffold` TimeText/page-indicator, `TransformingLazyColumn` per page); see `ui/WearPagerScreen.kt` for the Material 3 hierarchy mapping.
clock/src/main/AndroidManifest.xml
diff --git a/clock/src/main/AndroidManifest.xml b/clock/src/main/AndroidManifest.xmlindex 7511937835..2e438b5824 100644--- a/clock/src/main/AndroidManifest.xml+++ b/clock/src/main/AndroidManifest.xml@@ -206,5 +206,17 @@                 android:name="androidx.wear.tiles.PREVIEW"                 android:resource="@mipmap/ic_launcher" />         </service>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application> </manifest>\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/sync/OpenOnPhoneReceiver.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/sync/OpenOnPhoneReceiver.kt b/clock/src/main/java/com/vayunmathur/clock/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..7a9d541f5b--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.clock.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "clock"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.clock.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt b/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.ktindex 145a5721f9..42c53407c3 100644--- a/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt+++ b/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt@@ -1,7 +1,6 @@ package com.vayunmathur.clock.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.clock.data.ClockRepository import com.vayunmathur.library.wearlink.clock.WearClockAlarm import com.vayunmathur.library.wearlink.clock.WearClockProtocol@@ -16,6 +15,7 @@ import com.vayunmathur.library.util.DataStoreUtils import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import java.io.DataInputStream import kotlinx.coroutines.CoroutineScope@@ -95,7 +95,7 @@ class WearClockSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.clock.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.clock.MainActivity::class.java, body.decodeToString())                 return             }             if (path != WearClockProtocol.REQUEST_SYNC_PATH) return
communicate/AGENTS.md
diff --git a/communicate/AGENTS.md b/communicate/AGENTS.mdindex c49b08934c..c747ce7c6e 100644--- a/communicate/AGENTS.md+++ b/communicate/AGENTS.md@@ -42,6 +42,7 @@ its messages over the Watch conduit. - Thread pages, new-message/incoming-call alerts, and watch ops with phone verdicts (quick reply, mark-read, voicemail-read, decline-call, delete-thread): conduit messages (see the protocol file for paths and caps) - **Transport: Watch conduit client** — phone side `data/WearCommunicateSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `communicate`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected`. `FormFactor` picks the side at runtime, so only one of the two nodes runs on a given device. The watch keeps ops pending and resends on reconnect. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearCommunicateSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`) routes `ui/WearRoute` over the conversation list / thread (paged, cached offline) / quick reply / call log (read-only) / voicemail indicators / phone-only explanation; an incoming-call overlay offers Decline only (no answer-on-watch: watch audio routing is not guaranteed).
communicate/src/main/AndroidManifest.xml
diff --git a/communicate/src/main/AndroidManifest.xml b/communicate/src/main/AndroidManifest.xmlindex bd7c2613cc..03c8f7638d 100644--- a/communicate/src/main/AndroidManifest.xml+++ b/communicate/src/main/AndroidManifest.xml@@ -357,6 +357,19 @@                 <action android:name="com.vayunmathur.watch.action.SYNC_TRIGGER" />             </intent-filter>         </receiver>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>+     </application>  </manifest>
communicate/src/main/java/com/vayunmathur/communicate/data/WearCommunicateSync.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/WearCommunicateSync.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/WearCommunicateSync.ktindex 5968fe12fd..96de5b46a4 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/WearCommunicateSync.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/WearCommunicateSync.kt@@ -1,7 +1,6 @@ package com.vayunmathur.communicate.data  import android.content.Context-import android.content.Intent import com.vayunmathur.communicate.data.call.InAppCallPhase import com.vayunmathur.communicate.data.call.InAppCallRegistry import com.vayunmathur.communicate.data.googlevoice.GoogleVoiceParser@@ -9,6 +8,7 @@ import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import com.vayunmathur.library.wearlink.communicate.WearCommLine import com.vayunmathur.library.wearlink.communicate.WearCommOp@@ -186,7 +186,7 @@ class WearCommunicateSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.communicate.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.communicate.MainActivity::class.java, body.decodeToString())                 return             }             when (path) {
communicate/src/main/java/com/vayunmathur/communicate/sync/OpenOnPhoneReceiver.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/sync/OpenOnPhoneReceiver.kt b/communicate/src/main/java/com/vayunmathur/communicate/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..6170d21f45--- /dev/null+++ b/communicate/src/main/java/com/vayunmathur/communicate/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.communicate.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "communicate"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.communicate.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
contacts/AGENTS.md
diff --git a/contacts/AGENTS.md b/contacts/AGENTS.mdindex 01f6af11fd..1b7bfe88af 100644--- a/contacts/AGENTS.md+++ b/contacts/AGENTS.md@@ -33,14 +33,15 @@ phones and watches alike. `platform/FormFactor.kt` reads `PackageManager.FEATURE_WATCH` at runtime: `MainActivity` (the sole launcher entry) forwards watches to `ui/WearMainActivity` before any phone state loads; phones get the list/detail/edit UI. The watch-activity has no launcher entry of its own (`exported=false`). There-are no watch receivers in this module.+activity has no launcher entry of its own (`exported=false`). The watch-related receivers are the conduit sync-trigger and+open-on-phone receivers in `sync/` (both `CONDUIT` signature permission).  ## Wear sync (Watch conduit client) **Protocol:** shared wire types live in `:library:wearlink` at `com.vayunmathur.library.wearlink.contacts.WearContactsProtocol`; the golden-JSON test in this module (`domain/WearContactsProtocolTest`) pins the shared code's wire format. - Snapshot: phone -> watch as chunked conduit data items plus a manifest (`/contacts/snapshot/...`); each row carries capped phones/emails, the messenger platforms the phone joins for that contact (call/message/video, `WearContactPlatforms`), and a downscaled photo (`photoBase64`: ≤96 px, ≤8,192 decoded bytes per contact, ≤512,000 decoded photo bytes per snapshot; absent/too-large degrades to the letter avatar); watch state: watch -> phone (`/contacts/watch-state`); snapshot request, call/message/video/email handoff (with platform + contact id, phone re-joins provider rows), and contact delete (`/contacts/delete`, phone deletes from the provider book and republishes) are watch -> phone conduit messages. - **Transport: Watch conduit client** — phone side `sync/WearContactsSync.kt` and watch side `sync/WearLinkBridge.kt` (with `sync/WearWatchStatePublisher.kt` publishing watch state / requests / handoffs) use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `contacts`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle and never crashes the phone UI; snapshots republish on conduit `Connected` and on book changes. - **Push triggers:** the snapshot publish runs on (1) the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearContactsSync.triggerPush()` — no UI, no prompt), (2) book changes (immediate publish from `MainActivity`), and (3) conduit `Connected`. The watch side's user-data mutation is the contact-delete request: its outbound pushes are the immediate watch-state publish, call/message handoff requests, and delete requests via `WearWatchStatePublisher`. Snapshots arriving while the watch process is dead land in the watch conduit's persistent store and replay on registration; the watch copy itself persists in `data/WearContactsStore`.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`) routes `ui/WearRoute` over the contact list and a detail carrying the contact id.
contacts/src/main/AndroidManifest.xml
diff --git a/contacts/src/main/AndroidManifest.xml b/contacts/src/main/AndroidManifest.xmlindex 491aea58f6..7cd97b4eb8 100644--- a/contacts/src/main/AndroidManifest.xml+++ b/contacts/src/main/AndroidManifest.xml@@ -227,6 +227,19 @@                 <action android:name="com.vayunmathur.watch.action.SYNC_TRIGGER" />             </intent-filter>         </receiver>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>+          <!-- Watch experience: entered only via MainActivity's watch routing              (no launcher filter of its own). Inert on a phone: it is reached
contacts/src/main/java/com/vayunmathur/contacts/sync/OpenOnPhoneReceiver.kt
diff --git a/contacts/src/main/java/com/vayunmathur/contacts/sync/OpenOnPhoneReceiver.kt b/contacts/src/main/java/com/vayunmathur/contacts/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..21b54f12e7--- /dev/null+++ b/contacts/src/main/java/com/vayunmathur/contacts/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.contacts.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "contacts"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.contacts.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
contacts/src/main/java/com/vayunmathur/contacts/sync/WearContactsSync.kt
diff --git a/contacts/src/main/java/com/vayunmathur/contacts/sync/WearContactsSync.kt b/contacts/src/main/java/com/vayunmathur/contacts/sync/WearContactsSync.ktindex e855309762..3720eb9cfd 100644--- a/contacts/src/main/java/com/vayunmathur/contacts/sync/WearContactsSync.kt+++ b/contacts/src/main/java/com/vayunmathur/contacts/sync/WearContactsSync.kt@@ -26,6 +26,7 @@ import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers@@ -135,7 +136,7 @@ class WearContactsSync(          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { context.startActivity(Intent(context, com.vayunmathur.contacts.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(context, com.vayunmathur.contacts.MainActivity::class.java, body.decodeToString())                 return             }             when (path) {
findfamily/AGENTS.md
diff --git a/findfamily/AGENTS.md b/findfamily/AGENTS.mdindex d55843638f..5a05e7286c 100644--- a/findfamily/AGENTS.md+++ b/findfamily/AGENTS.md@@ -52,6 +52,7 @@ location sharing never starts there. - Ops + sync request: conduit messages (`/findfamily/op` stop-sharing / request-refresh, `/findfamily/request-sync`), watch -> phone only - **Transport: Watch conduit client** — phone side `sync/WearFindFamilySync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `findfamily`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected` and on Room changes. `FormFactor` picks the side at runtime, so only one of the two nodes runs on a given device. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearFindFamilySync.triggerPush()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`, `exported=false`, no
findfamily/src/main/AndroidManifest.xml
diff --git a/findfamily/src/main/AndroidManifest.xml b/findfamily/src/main/AndroidManifest.xmlindex d13921a980..ddb49c76a9 100644--- a/findfamily/src/main/AndroidManifest.xml+++ b/findfamily/src/main/AndroidManifest.xml@@ -222,6 +222,18 @@                 android:name="androidx.wear.tiles.PREVIEW"                 android:resource="@mipmap/ic_launcher" />         </service>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application>  </manifest>\ No newline at end of file
findfamily/src/main/java/com/vayunmathur/findfamily/sync/OpenOnPhoneReceiver.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/sync/OpenOnPhoneReceiver.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..3311601e17--- /dev/null+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.findfamily.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "findfamily"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.findfamily.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.ktindex 7f192c85f5..9554731eb5 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/sync/WearFindFamilySync.kt@@ -1,7 +1,6 @@ package com.vayunmathur.findfamily.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.findfamily.data.LocationSource import com.vayunmathur.findfamily.data.FindFamilyRepository import com.vayunmathur.findfamily.data.RequestStatus@@ -20,6 +19,7 @@ import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers@@ -96,7 +96,7 @@ class WearFindFamilySync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.findfamily.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.findfamily.MainActivity::class.java, body.decodeToString())                 return             }             when (path) {
launcher/AGENTS.md
diff --git a/launcher/AGENTS.md b/launcher/AGENTS.mdindex fe5b64828c..ddd9d00f51 100644--- a/launcher/AGENTS.md+++ b/launcher/AGENTS.md@@ -31,10 +31,11 @@ sideload/F-Droid, not Play's watch channel, so the APK installs on phones, TVs and watches alike. `platform/FormFactor.kt` reads `PackageManager.FEATURE_WATCH` at runtime: `MainActivity` (the sole launcher entry) forwards watches to `ui/WearMainActivity` before-any phone/TV state loads; phones/TVs get the UiMode-routed UI. There-one broadcast receiver, the conduit sync-trigger receiver-(`sync/ConduitSyncTriggerReceiver`), starts the phone sync-(`sync/WearLauncherSync`) outside the phone path; the watch+any phone/TV state loads; phones/TVs get the UiMode-routed UI. There are two broadcast receivers:+the conduit sync-trigger receiver+(`sync/ConduitSyncTriggerReceiver`) starts the phone sync+(`sync/WearLauncherSync`) outside the phone path, and the open-on-phone+receiver (`sync/OpenOnPhoneReceiver`) launches the main activity; the watch bridge (`sync/WearLinkBridge`) starts only from `ui/WearMainActivity`, so neither runs on the wrong form factor. @@ -64,6 +65,7 @@ neither runs on the wrong form factor. - Only the phone hotseat (pinned row) syncs — not the workspace grid, folders or widgets. Recents are watch-local and never sync. - **Transport: Watch conduit client** — phone side `sync/WearLauncherSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `launcher`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; favorites republish on conduit `Connected`. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearLauncherSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  **Gotchas:** - Exempt from the raw-animation rule: built on `animateBounds`/`Animatable` — do NOT "migrate" its motion to library helpers. TV code under `tv/` keeps using `library.ui` helpers anyway — no regression just because the package is exempt.
launcher/src/main/AndroidManifest.xml
diff --git a/launcher/src/main/AndroidManifest.xml b/launcher/src/main/AndroidManifest.xmlindex a2d18ecd21..9f1598d8d4 100644--- a/launcher/src/main/AndroidManifest.xml+++ b/launcher/src/main/AndroidManifest.xml@@ -141,5 +141,18 @@                 <action android:name="com.vayunmathur.watch.action.SYNC_TRIGGER" />             </intent-filter>         </receiver>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>+     </application> </manifest>
launcher/src/main/java/com/vayunmathur/launcher/sync/OpenOnPhoneReceiver.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/sync/OpenOnPhoneReceiver.kt b/launcher/src/main/java/com/vayunmathur/launcher/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..eeee07f560--- /dev/null+++ b/launcher/src/main/java/com/vayunmathur/launcher/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.launcher.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "launcher"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.launcher.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
launcher/src/main/java/com/vayunmathur/launcher/sync/WearLauncherSync.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLauncherSync.kt b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLauncherSync.ktindex b14edf9a4d..1c69f058cd 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLauncherSync.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/sync/WearLauncherSync.kt@@ -1,7 +1,6 @@ package com.vayunmathur.launcher.sync  import android.content.Context-import android.content.Intent import android.content.pm.PackageManager import com.vayunmathur.launcher.data.LauncherRepository import com.vayunmathur.launcher.domain.ContainerRef@@ -15,6 +14,7 @@ import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers@@ -83,7 +83,7 @@ class WearLauncherSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.launcher.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.launcher.MainActivity::class.java, body.decodeToString())                 return             }             if (path != WearLauncherProtocol.REQUEST_SYNC_PATH) return
music/AGENTS.md
diff --git a/music/AGENTS.md b/music/AGENTS.mdindex 4330b5c8c5..28003e819a 100644--- a/music/AGENTS.md+++ b/music/AGENTS.md@@ -49,6 +49,7 @@ player or session on a watch. - Search: conduit message (`/music/search-request`, watch -> phone) - **Transport: Watch conduit client** — phone side `sync/WearMusicSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `music`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; playback state republishes on conduit `Connected`, and pending watch ops resend on `Connected`. `FormFactor` picks the side at runtime, so only one of the two nodes runs on a given device. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearMusicSync.triggerPush()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` routes `ui/WearRoute` (home / albums / artists / playlists / now playing / queue / search / add-to-playlist / settings) over the phone's pages, rendered from cached page snapshots + streamed playback state in `data/WearMusicStore` (`wear-music-pages.json`), so visited pages work offline.
music/src/main/AndroidManifest.xml
diff --git a/music/src/main/AndroidManifest.xml b/music/src/main/AndroidManifest.xmlindex f2ea64d744..fe255f2a53 100644--- a/music/src/main/AndroidManifest.xml+++ b/music/src/main/AndroidManifest.xml@@ -181,6 +181,19 @@                 <action android:name="com.vayunmathur.watch.action.SYNC_TRIGGER" />             </intent-filter>         </receiver>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>+     </application>  </manifest>\ No newline at end of file
music/src/main/java/com/vayunmathur/music/sync/OpenOnPhoneReceiver.kt
diff --git a/music/src/main/java/com/vayunmathur/music/sync/OpenOnPhoneReceiver.kt b/music/src/main/java/com/vayunmathur/music/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..25a2d34554--- /dev/null+++ b/music/src/main/java/com/vayunmathur/music/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.music.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "music"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.music.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt
diff --git a/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt b/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.ktindex 102c10b0a8..4ff6ad3da4 100644--- a/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt+++ b/music/src/main/java/com/vayunmathur/music/sync/WearMusicSync.kt@@ -1,10 +1,10 @@ package com.vayunmathur.music.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import com.vayunmathur.music.data.MusicRepository import com.vayunmathur.library.wearlink.music.WearAlbum@@ -61,7 +61,7 @@ object WearMusicSync {             val listener = object : WearLinkListener {                 override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.music.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.music.MainActivity::class.java, body.decodeToString())                 return             }                     val text = body.decodeToString()
notes/AGENTS.md
diff --git a/notes/AGENTS.md b/notes/AGENTS.mdindex a9c727297d..eedac16286 100644--- a/notes/AGENTS.md+++ b/notes/AGENTS.md@@ -32,8 +32,9 @@ phones and watches alike. `platform/FormFactor.kt` reads `PackageManager.FEATURE_WATCH` at runtime: `MainActivity` (the sole launcher entry) forwards watches to `ui/WearMainActivity` before any phone state loads; phones get the list/detail UI. This module-declares one broadcast receiver, the conduit sync-trigger receiver-(`sync/ConduitSyncTriggerReceiver`, phone-side snapshot publish only);+declares two broadcast receivers: the conduit sync-trigger receiver+(`sync/ConduitSyncTriggerReceiver`, phone-side snapshot publish only) and+the open-on-phone receiver (`sync/OpenOnPhoneReceiver`, main-activity launch only); the watch activity carries no launcher filter (`exported=false`) and is reachable only through that routing, so every entry point is inert on the wrong form factor.@@ -45,6 +46,7 @@ routing, so every entry point is inert on the wrong form factor. - Sync request: conduit message (`/notes/request-sync`), watch -> phone only - **Transport: Watch conduit client** — phone side `sync/WearNotesSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `notes`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected` and on note changes. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearNotesSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first. - **Sync semantics:** phone -> watch is a bounded snapshot — 50 most recent notes, title ≤120 chars, body ≤4000 chars, ≤90_000 JSON bytes (`truncated` flags loss); the watch persists it and reads fully offline. Watch -> phone create/edit/delete ops apply on the phone only, last-writer-wins per note by `updatedAt` (ties: tombstone, then larger title/body), no text merge. Notes with image/ink blocks (`textOnly = false`) are read-only on the watch except delete; watch creates/edits become single-text-block notes on the phone. An op stays pending on the watch (persisted, resent on reconnect) until a phone snapshot reflects it, so the watch UI never claims "synced" before that.  ## Watch experience (in this module)
notes/src/main/AndroidManifest.xml
diff --git a/notes/src/main/AndroidManifest.xml b/notes/src/main/AndroidManifest.xmlindex 8d8447f99c..4de606a333 100644--- a/notes/src/main/AndroidManifest.xml+++ b/notes/src/main/AndroidManifest.xml@@ -147,6 +147,19 @@                 <action android:name="com.vayunmathur.watch.action.SYNC_TRIGGER" />             </intent-filter>         </receiver>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>+     </application>  </manifest>\ No newline at end of file
notes/src/main/java/com/vayunmathur/notes/sync/OpenOnPhoneReceiver.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/sync/OpenOnPhoneReceiver.kt b/notes/src/main/java/com/vayunmathur/notes/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..c90df64961--- /dev/null+++ b/notes/src/main/java/com/vayunmathur/notes/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.notes.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "notes"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.notes.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt b/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.ktindex fd081a8955..26b3c53932 100644--- a/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt+++ b/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt@@ -1,11 +1,11 @@ package com.vayunmathur.notes.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import com.vayunmathur.notes.data.Note import com.vayunmathur.notes.data.NoteBlock@@ -101,7 +101,7 @@ class WearNotesSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.notes.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.notes.MainActivity::class.java, body.decodeToString())                 return             }             when (path) {
todo/AGENTS.md
diff --git a/todo/AGENTS.md b/todo/AGENTS.mdindex 828bade888..829fea5e52 100644--- a/todo/AGENTS.md+++ b/todo/AGENTS.md@@ -39,6 +39,7 @@ watch, and `notifications/BootReceiver` early-returns there. - Watch-originated ops: conduit message (`/todo/op`: SET_DONE incl. repeating-task roll-forward on the phone, SNOOZE_HOUR/SNOOZE_TOMORROW, QUICK_ADD parsed by the phone's QuickAddParser, EDIT title/due/priority, DELETE with watch-side confirmation) - **Transport: Watch conduit client** — phone side `sync/WearTodoSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `todo`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; the catalog and tracked pages republish on conduit `Connected` and on todo/list changes, and pending watch ops flush on `Connected`. - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearTodoSync.triggerPush()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`) routes `ui/WearRoute` over home (the phone drawer's view index) / task pages / task detail / quick-add / edit / delete-confirm, mirroring the phone `Route` (detail routes carry the task syncId, the cross-device identity). Settings, search, sort, manual reorder, bulk selection, list/tag/section editing, recurrence and reminder-offset editing, blocked-by/estimates, and subtask creation stay on the phone; existing subtasks show and can be checked off.
todo/src/main/AndroidManifest.xml
diff --git a/todo/src/main/AndroidManifest.xml b/todo/src/main/AndroidManifest.xmlindex b160b5be2d..153407ff2f 100644--- a/todo/src/main/AndroidManifest.xml+++ b/todo/src/main/AndroidManifest.xml@@ -208,6 +208,18 @@                 android:name="androidx.wear.tiles.PREVIEW"                 android:resource="@mipmap/ic_launcher" />         </service>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application>  </manifest>
todo/src/main/java/com/vayunmathur/todo/sync/OpenOnPhoneReceiver.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/sync/OpenOnPhoneReceiver.kt b/todo/src/main/java/com/vayunmathur/todo/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..42ca753b17--- /dev/null+++ b/todo/src/main/java/com/vayunmathur/todo/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.todo.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "todo"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.todo.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
todo/src/main/java/com/vayunmathur/todo/sync/WearTodoSync.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/sync/WearTodoSync.kt b/todo/src/main/java/com/vayunmathur/todo/sync/WearTodoSync.ktindex 327e5fc762..f848c50d15 100644--- a/todo/src/main/java/com/vayunmathur/todo/sync/WearTodoSync.kt+++ b/todo/src/main/java/com/vayunmathur/todo/sync/WearTodoSync.kt@@ -1,10 +1,10 @@ package com.vayunmathur.todo.sync  import android.content.Context-import android.content.Intent import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.todo.WearTodoCatalog@@ -106,7 +106,7 @@ class WearTodoSync private constructor(context: Context) {          override fun onMessage(path: String, body: ByteArray) {             if (path.endsWith("/open-on-phone")) {-                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.todo.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.todo.MainActivity::class.java, body.decodeToString())                 return             }             when (path) {
weather/AGENTS.md
diff --git a/weather/AGENTS.md b/weather/AGENTS.mdindex 4f5c006d3b..28499bfb89 100644--- a/weather/AGENTS.md+++ b/weather/AGENTS.md@@ -40,6 +40,7 @@ receivers are a phone-only surface and early-return on a watch. - Sync request: conduit message (`/weather/request-sync`), watch -> phone only - **Transport: Watch conduit client** — phone side `sync/WearWeatherSync.kt` and watch side `sync/WearLinkBridge.kt` both use `WearLinkClientNode` (Messenger to the Watch app's `watch_conduit` service, appId `weather`); this app owns no RFCOMM link and holds no Bluetooth permission for this channel, so neither entry activity prompts for Bluetooth. With the Watch app absent the node reports `NotInstalled`/`Unavailable` and the sync stays idle; snapshots republish on conduit `Connected` and on forecast refresh. The watch renders the locally stored snapshot offline and holds no network path of its own. Protocol values stay Celsius / km/h; rendering converts to the watch's system regional preferences (`platform/WearSystemUnits`, formatting in `domain/WearWeatherFormatting`). - **Push triggers:** the publish also runs on the phone Watch app's scheduled sync-trigger intent (`sync/ConduitSyncTriggerReceiver`, exported only under the `CONDUIT` signature permission, invoking `WearWeatherSync.syncNow()` — no UI, no prompt). Data arriving while the receiving process is dead lands in the conduit host's persistent store and replays on registration.+- **Open on phone:** the watch request (`/<appId>/open-on-phone` conduit message; camera: `OPEN_ON_PHONE` op) is handled live by the sync message listener when this app is registered, and otherwise the phone conduit host broadcasts `OpenOnPhoneContract.ACTION` (package-addressed, `CONDUIT` signature permission) to `sync/OpenOnPhoneReceiver`, which launches the main activity as a new task — no phone process needs to be running first.  ## Watch experience (in this module) - `ui/WearMainActivity` (a `WearShellActivity`) routes `ui/WearRoute` over locations (`ui/WearLocationsScreen`) and one location's current/hourly/daily detail (`ui/WearLocationScreen`); snapshots arrive automatically over the conduit, with no manual sync action.
weather/src/main/AndroidManifest.xml
diff --git a/weather/src/main/AndroidManifest.xml b/weather/src/main/AndroidManifest.xmlindex ab2559a162..1b443195a6 100644--- a/weather/src/main/AndroidManifest.xml+++ b/weather/src/main/AndroidManifest.xml@@ -162,5 +162,17 @@                 android:name="androidx.wear.tiles.PREVIEW"                 android:resource="@mipmap/ic_launcher" />         </service>+        <!-- Watch "Open on phone" wake: the phone Watch conduit host fires+             OpenOnPhoneContract.ACTION (signature permission, package-addressed)+             when a watch open request arrives with no live registration in+             this app; this receiver launches the main activity. -->+        <receiver+            android:name=".sync.OpenOnPhoneReceiver"+            android:exported="true"+            android:permission="com.vayunmathur.watch.permissions.CONDUIT">+            <intent-filter>+                <action android:name="com.vayunmathur.watch.action.OPEN_ON_PHONE" />+            </intent-filter>+        </receiver>     </application> </manifest>
weather/src/main/java/com/vayunmathur/weather/sync/OpenOnPhoneReceiver.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/sync/OpenOnPhoneReceiver.kt b/weather/src/main/java/com/vayunmathur/weather/sync/OpenOnPhoneReceiver.ktnew file mode 100644index 0000000000..b629379303--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/sync/OpenOnPhoneReceiver.kt@@ -0,0 +1,56 @@+package com.vayunmathur.weather.sync++import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneContract+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher++/**+ * Decides whether an incoming intent is this app's open-on-phone wake and,+ * if so, invokes [launch]. Pure (no Android types) so the decision is+ * unit-tested at the shared seam; the receiver below supplies the values.+ */+object OpenOnPhoneHandler {+    /** Conduit appId this app opens under (first segment of its conduit paths). */+    const val APP_ID: String = "weather"++    /** True (and [launch] invoked) only for this app's open-on-phone wake. */+    fun handle(+        action: String?,+        appId: String?,+        launch: () -> Unit,+    ): Boolean {+        if (!OpenOnPhoneContract.shouldHandle(action, appId, APP_ID)) return false+        launch()+        return true+    }+}++/**+ * Manifest wake for the watch "Open on phone" button: the phone Watch+ * conduit host fires [OpenOnPhoneContract.ACTION] (signature permission+ * [OpenOnPhoneContract.PERMISSION], package-addressed to this app) when a+ * watch open request arrives while this app has no live conduit+ * registration. This receiver launches the main activity as a new task, so+ * the button works with no phone process running first. A request that+ * arrives while the app's sync is registered is handled by that sync's+ * message listener instead and never reaches this receiver.+ */+class OpenOnPhoneReceiver : BroadcastReceiver() {+    override fun onReceive(+        context: Context,+        intent: Intent,+    ) {+        OpenOnPhoneHandler.handle(+            intent.action,+            intent.getStringExtra(OpenOnPhoneContract.EXTRA_APP_ID),+        ) {+            OpenOnPhoneLauncher.launch(+                context.applicationContext,+                com.vayunmathur.weather.MainActivity::class.java,+                intent.getStringExtra(OpenOnPhoneContract.EXTRA_ENTITY_ID).orEmpty(),+            )+        }+    }+}
weather/src/main/java/com/vayunmathur/weather/sync/WearWeatherSync.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/sync/WearWeatherSync.kt b/weather/src/main/java/com/vayunmathur/weather/sync/WearWeatherSync.ktindex 53c358cc42..bb3ae1d608 100644--- a/weather/src/main/java/com/vayunmathur/weather/sync/WearWeatherSync.kt+++ b/weather/src/main/java/com/vayunmathur/weather/sync/WearWeatherSync.kt@@ -1,10 +1,10 @@ package com.vayunmathur.weather.sync import android.content.Context-import android.content.Intent import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState import com.vayunmathur.library.wearlink.conduit.ConduitProtocol+import com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher import com.vayunmathur.library.wearlink.conduit.WearLinkClientNode import com.vayunmathur.weather.data.WeatherRepository import com.vayunmathur.weather.data.weatherJson@@ -54,7 +54,7 @@ class WearWeatherSync private constructor(context:Context){   override fun onData(path:String,body:ByteArray){ if(path!=WearWeatherProtocol.WATCH_STATE_PATH)return    val ws=runCatching{WearWeatherProtocol.json.decodeFromString<WearWatchState>(body.decodeToString())}.getOrNull()?:return    _state.update{it.copy(lastWatchAppliedAtMillis=ws.appliedGeneratedAtMillis.takeIf{a->a>0L})} }-  override fun onMessage(path:String,body:ByteArray){ if(path.endsWith("/open-on-phone")){ runCatching{ appContext.startActivity(Intent(appContext, com.vayunmathur.weather.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }; return }; if(path==WearWeatherProtocol.REQUEST_SYNC_PATH) scope.launch{publishSnapshot()} }+  override fun onMessage(path:String,body:ByteArray){ if(path.endsWith("/open-on-phone")){ OpenOnPhoneLauncher.launch(appContext, com.vayunmathur.weather.MainActivity::class.java, body.decodeToString()); return }; if(path==WearWeatherProtocol.REQUEST_SYNC_PATH) scope.launch{publishSnapshot()} }  }  // Conduit appId = first path segment of the weather paths (the  // ConduitProtocol route key), not the RFCOMM handshake capability.