music: declare the Cast permission the picker is guarded by
- Commit
e8d957c1268a0b89f9e078a601bc3e319b12fb0c- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-23 18:55 UTC (3 months ago)
- Parents
8c1bc59
Diff
music/src/main/AndroidManifest.xml
diff --git a/music/src/main/AndroidManifest.xml b/music/src/main/AndroidManifest.xmlindex fece410329..a74d87449d 100644--- a/music/src/main/AndroidManifest.xml+++ b/music/src/main/AndroidManifest.xml@@ -5,6 +5,10 @@ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />+ <!-- Cast guards its picker Activity and its content service with this, so a consumer that omits+ it does not degrade: launching the picker throws a SecurityException outright. Signature+ level, so it grants nothing to anyone outside this repo. -->+ <uses-permission android:name="com.vayunmathur.cast.permission.STREAM_CONTENT" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
sdk/cast/src/main/java/com/vayunmathur/sdk/cast/CastPickerContract.kt
diff --git a/sdk/cast/src/main/java/com/vayunmathur/sdk/cast/CastPickerContract.kt b/sdk/cast/src/main/java/com/vayunmathur/sdk/cast/CastPickerContract.ktindex b55fd3dddb..f13a62bc3a 100644--- a/sdk/cast/src/main/java/com/vayunmathur/sdk/cast/CastPickerContract.kt+++ b/sdk/cast/src/main/java/com/vayunmathur/sdk/cast/CastPickerContract.kt@@ -18,6 +18,12 @@ import androidx.activity.result.contract.ActivityResultContract * * `true` means a TV is connected and [CastClient.openSession] will work; `false` means the user * backed out, or pairing failed, and nothing should change in the calling app.+ *+ * **The calling app must declare `com.vayunmathur.cast.permission.STREAM_CONTENT` in its manifest.**+ * Cast guards this Activity with it, so an app that omits it does not degrade to "no casting" - the+ * launch throws a `SecurityException` from `startActivityForResult`, which is a crash in the caller+ * rather than something [parseResult] could report. It is signature level, so declaring it grants+ * nothing to anything outside this repo. */ class CastPickerContract : ActivityResultContract<Unit, Boolean>() {