wearlink: declare CONDUIT uses-permission for conduit clients
- Commit
30be4a93ad1e1bb013d7f51bccbc3074eb6fe98d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-04 21:08 UTC (1 day ago)
- Parents
cc0382a
Watch-side conduit clients (e.g. contacts on Pixel Watch 5) were refused binds to com.vayunmathur.watch/.wear.service.ConduitService with 'Permission Denial: ... requires com.vayunmathur.watch.permissions.CONDUIT' because the service is gated by that signature permission but no client app declared <uses-permission> for it, so no pair synced. Both Watch apps (:watch phone and :watch:wear watch) declare the same <permission protectionLevel=signature> and gate their ConduitService with android:permission=com.vayunmathur.watch.permissions.CONDUIT (verified statically in both manifests); the phone-side service works identically, so a single declaration in the shared :library:wearlink library manifest covers every consumer on both sides via manifest merger. Signature protection grants it automatically to same-signed apps with no user prompt or runtime request. No Bluetooth permission is added: only the Watch apps hold BLUETOOTH_CONNECT and own the RFCOMM WearLinkNode, as before. Verified: ./gradlew :library:wearlink:lint :library:wearlink:testDebugUnitTest green and :contacts:assembleRelease green; the merged contacts release manifest (contacts/build/intermediates/merged_manifest/release/processReleaseMainManifest/AndroidManifest.xml and packaged manifest) contains <uses-permission android:name="com.vayunmathur.watch.permissions.CONDUIT" /> and no Bluetooth permission.
Diff
library/wearlink/src/main/AndroidManifest.xml
diff --git a/library/wearlink/src/main/AndroidManifest.xml b/library/wearlink/src/main/AndroidManifest.xmlindex 31e128421a..8d0137d7f4 100644--- a/library/wearlink/src/main/AndroidManifest.xml+++ b/library/wearlink/src/main/AndroidManifest.xml@@ -6,6 +6,18 @@ RFCOMM WearLinkNode. Declaring the permissions in this library would inject them into every consuming app. --> + <!-- Conduit access: both Watch apps' ConduitService (phone :watch and+ watch :watch:wear, same permission string) are gated by the+ signature permission com.vayunmathur.watch.permissions.CONDUIT,+ declared <permission protectionLevel="signature"> in their+ manifests. A client that has not declared <uses-permission> for+ it is refused the bind ("requires+ com.vayunmathur.watch.permissions.CONDUIT"), so this library+ declares it and manifest merger injects it into every consuming+ app on both sides. Signature protection grants it automatically+ to same-signed apps: no user prompt, no runtime request. -->+ <uses-permission android:name="com.vayunmathur.watch.permissions.CONDUIT" />+ <!-- Package visibility for the conduit client: WearLinkClientNode probes com.vayunmathur.watch with getPackageInfo and binds its ConduitService implicitly by the CONDUIT action scoped to that