wearlink: declare no Bluetooth permissions (conduit Stage C)
- Commit
425530ae3e053d0a5cb6bcb6289f448ffe876724- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-04 19:50 UTC (1 day ago)
- Parents
967c7e5
All 13 app pairs now sync through the Watch conduit client (WearLinkClientNode), so library/wearlink's manifest drops BLUETOOTH_CONNECT / BLUETOOTH / BLUETOOTH_ADMIN: only :watch and :watch:wear declare Bluetooth and own the real RFCOMM node. WearShellActivity no longer requests BLUETOOTH_CONNECT at onCreate. Verified: :library:wearlink:lint and :library:wearlink:testDebugUnitTest green.
Diff
library/wearlink/AGENTS.md
diff --git a/library/wearlink/AGENTS.md b/library/wearlink/AGENTS.mdindex 3933be2333..d4dc7eabfa 100644--- a/library/wearlink/AGENTS.md+++ b/library/wearlink/AGENTS.md@@ -9,10 +9,10 @@ `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>` (permission request,- `createStore()` warm-up, Wear Material theme + route state held in the- shell); each wear module keeps its concrete activity name, route type- and screen `when`.+ 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@@ -35,8 +35,8 @@ unregistered apps, status fan-out, counters), `WearLinkClientNode` `NotInstalled`/`Unavailable` when the Watch app is absent), and `ConduitHost`/`ConduitRuntime` used by the two Watch apps' `ConduitService`s. Merged phone/watch pairs ship as single APKs whose phone and watch-experiences pick their side at runtime; the remaining app pairs still own their `WearLinkNode`s, and-this module's manifest Bluetooth permissions stay until they migrate.+experiences pick their side at runtime. This module declares no+Bluetooth permissions; only the Watch apps (:watch, :watch:wear) do. ## Verify ```
library/wearlink/src/main/AndroidManifest.xml
diff --git a/library/wearlink/src/main/AndroidManifest.xml b/library/wearlink/src/main/AndroidManifest.xmlindex ab4e32708c..536f531174 100644--- a/library/wearlink/src/main/AndroidManifest.xml+++ b/library/wearlink/src/main/AndroidManifest.xml@@ -1,17 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android">- <!-- WearLink is RFCOMM-over-bonded-Bluetooth only: no discovery scan and- no BLE advertising, so BLUETOOTH_SCAN / BLUETOOTH_ADVERTISE are- deliberately NOT declared (declaring them would ask the user for- permissions the transport never exercises) and no location permission- or neverForLocation workaround is needed. Connecting to / accepting- on a bonded device needs BLUETOOTH_CONNECT on API 31+. -->- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />- <!-- Pre-API-31 equivalents, capped so they are not requested on 31+. -->- <uses-permission- android:name="android.permission.BLUETOOTH"- android:maxSdkVersion="30" />- <uses-permission- android:name="android.permission.BLUETOOTH_ADMIN"- android:maxSdkVersion="30" />+ <!-- No Bluetooth permissions here: every app pair syncs through the+ Watch conduit (WearLinkClientNode), so only the Watch apps+ (:watch, :watch:wear) declare BLUETOOTH_CONNECT and own the real+ RFCOMM WearLinkNode. Declaring the permissions in this library+ would inject them into every consuming app. --> </manifest>
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/WearShellActivity.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/WearShellActivity.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/WearShellActivity.ktindex 476daac3e7..a1109267cb 100644--- a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/WearShellActivity.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/WearShellActivity.kt@@ -11,13 +11,14 @@ import androidx.compose.runtime.setValue import androidx.wear.compose.material.MaterialTheme /**- * Shared shell for every wear companion's main activity: request the- * WearLink Bluetooth permission, create the app's store (whose factory- * also gets/bridges/publishes as that app's warm-up), then compose the- * app's route screen inside the Wear Material theme with the route state- * held here. Concrete activities keep their manifest names, their own- * route type and their own `when` over it; apps with no route or store- * of their own use [Unit].+ * Shared shell for every wear companion's main activity: create the+ * app's store (whose factory also bridges/publishes as that app's+ * warm-up), then compose the app's route screen inside the Wear Material+ * theme with the route state held here. No Bluetooth permission is+ * requested: sync runs over the Watch conduit client, and the Watch app+ * owns the Bluetooth grant. Concrete activities keep their manifest+ * names, their own route type and their own `when` over it; apps with+ * no route or store of their own use [Unit]. */ abstract class WearShellActivity<R, S : Any>(private val initialRoute: R) : ComponentActivity() { @@ -26,7 +27,6 @@ abstract class WearShellActivity<R, S : Any>(private val initialRoute: R) : Comp override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)- WearLinkPermissions.requestIfNeeded(this) store = createStore() setContent { MaterialTheme {
watch/AGENTS.md
diff --git a/watch/AGENTS.md b/watch/AGENTS.mdindex 1910b8d68e..7608a36889 100644--- a/watch/AGENTS.md+++ b/watch/AGENTS.md@@ -32,9 +32,8 @@ permission grant. with `:watch:wear` on purpose: the handshake token and the `com.vayunmathur.watch.permissions.CONDUIT` signature permission both require one identity.-- Do not add Bluetooth permissions anywhere else; do not strip- wearlink's manifest permissions until every app pair has migrated- to the client node (a later stage).+- Do not add Bluetooth permissions anywhere else. wearlink declares+ none; this app and :watch:wear are the only Bluetooth holders. ## Key files ### Root โ entry + navigation