StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
fix: harden WP0 platform release safety
David Nashash3d3e70dd3bce
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 6fa430bb..6d558ba9 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -192,7 +192,7 @@ jobs:strategy:fail-fast: falsematrix:- api-level: [25, 28, 33, 35, 36]+ api-level: [25, 26, 28, 32, 33, 35, 36]steps:- uses: actions/checkout@v4@@ -215,6 +215,7 @@ jobs:./gradlew --console=plain :app:connectedDebugAndroidTest -PcompatApi=${{ matrix.api-level }} -Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.app.compat.PlatformCompatibilityMatrixTest --no-daemonif [ "${{ matrix.api-level }}" = "35" ] || [ "${{ matrix.api-level }}" = "36" ]; then./gradlew --console=plain :app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.app.service.DownloadForegroundServiceInstrumentationTest --no-daemon+ ./gradlew --console=plain :data:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.data.manager.recording.PlatformReleaseSafetyInstrumentationTest --no-daemonfiif [ "${{ matrix.api-level }}" = "36" ]; then./gradlew --console=plain :data:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.data.local.StreamVaultDatabaseMigrationTest --no-daemondiff --git a/app/lint-baseline.xml b/app/lint-baseline.xmlindex 91c363b9..99b8eeda 100644--- a/app/lint-baseline.xml+++ b/app/lint-baseline.xml@@ -1,259 +1,6 @@<?xml version="1.0" encoding="UTF-8"?><issues format="6" by="lint 8.10.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.10.1)" variant="all" version="8.10.1">- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.Channels#TYPE_PREVIEW`"- errorLine1=" put(CHANNEL_COLUMN_TYPE, TvContract.Channels.TYPE_PREVIEW)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="322"- column="34"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_MOVIE`"- errorLine1=" ContentType.VOD -> TvContract.PreviewPrograms.TYPE_MOVIE"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="344"- column="28"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_TV_EPISODE`"- errorLine1=" ContentType.SERIES_EPISODE -> TvContract.PreviewPrograms.TYPE_TV_EPISODE"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="346"- column="39"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_CLIP`"- errorLine1=" ContentType.LIVE -> TvContract.PreviewPrograms.TYPE_CLIP"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="347"- column="29"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 33 (current min is 25): `android.Manifest.permission#POST_NOTIFICATIONS`"- errorLine1=" permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.kt"- line="70"- column="47"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 33 (current min is 25): `android.Manifest.permission#POST_NOTIFICATIONS`"- errorLine1=" permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.kt"- line="84"- column="47"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 28 (current min is 25): `android.content.pm.PackageManager#GET_SIGNING_CERTIFICATES`"- errorLine1=" packageManager.getPackageInfo(context.packageName, PackageManager.GET_SIGNING_CERTIFICATES)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt"- line="55"- column="64"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.WatchNextPrograms#WATCH_NEXT_TYPE_CONTINUE`"- errorLine1=" put(COLUMN_WATCH_NEXT_TYPE, TvContract.WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="178"- column="41"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_MOVIE`"- errorLine1=" ContentType.VOD -> TvContract.PreviewPrograms.TYPE_MOVIE"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="184"- column="28"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_TV_EPISODE`"- errorLine1=" ContentType.SERIES_EPISODE -> TvContract.PreviewPrograms.TYPE_TV_EPISODE"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="186"- column="39"/>- </issue>-- <issue- id="InlinedApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#TYPE_CLIP`"- errorLine1=" ContentType.LIVE -> TvContract.PreviewPrograms.TYPE_CLIP"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="187"- column="29"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#CONTENT_URI`"- errorLine1=" ContentUris.withAppendedId(TvContract.PreviewPrograms.CONTENT_URI, programId),"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="280"- column="48"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#CONTENT_URI`"- errorLine1=" context.contentResolver.insert(TvContract.PreviewPrograms.CONTENT_URI, values)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="290"- column="48"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.PreviewPrograms#CONTENT_URI`"- errorLine1=" ContentUris.withAppendedId(TvContract.PreviewPrograms.CONTENT_URI, existingId),"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="293"- column="48"/>- </issue>-- <issue- id="NewApi"- message="Call requires API level 26 (current min is 25): `android.media.tv.TvContract#buildPreviewProgramsUriForChannel`"- errorLine1=" TvContract.buildPreviewProgramsUriForChannel(channelId),"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="305"- column="24"/>- </issue>-- <issue- id="NewApi"- message="Call requires API level 26 (current min is 25): `android.media.tv.TvContract#requestChannelBrowsable`"- errorLine1=" TvContract.requestChannelBrowsable(context, channelId)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="367"- column="24"/>- </issue>-- <issue- id="NewApi"- message="Call requires API level 26 (current min is 25): `enter`"- errorLine1=" PictureInPictureCompat.enter(this, state)"- errorLine2=" ~~~~~">- <location- file="src/main/java/com/streamvault/app/MainActivity.kt"- line="288"- column="36"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `PictureInPictureCompat`"- errorLine1=" PictureInPictureCompat.enter(this, state)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/MainActivity.kt"- line="288"- column="13"/>- </issue>-- <issue- id="NewApi"- message="Call requires API level 26 (current min is 25): `apply`"- errorLine1=" PictureInPictureCompat.apply(this, playerPictureInPictureState)"- errorLine2=" ~~~~~">- <location- file="src/main/java/com/streamvault/app/MainActivity.kt"- line="295"- column="36"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `PictureInPictureCompat`"- errorLine1=" PictureInPictureCompat.apply(this, playerPictureInPictureState)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/MainActivity.kt"- line="295"- column="13"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 28 (current min is 25): `android.content.pm.PackageInfo#signingInfo`"- errorLine1=" val signingCertificateBytes = packageInfo.signingInfo"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt"- line="58"- column="39"/>- </issue>-- <issue- id="NewApi"- message="Call requires API level 28 (current min is 25): `android.content.pm.SigningInfo#getApkContentsSigners`"- errorLine1=" ?.apkContentsSigners"- errorLine2=" ~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt"- line="59"- column="15"/>- </issue>-- <issue- id="NewApi"- message="Field requires API level 26 (current min is 25): `android.media.tv.TvContract.WatchNextPrograms#CONTENT_URI`"- errorLine1=" get() = TvContract.WatchNextPrograms.CONTENT_URI"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="233"- column="17"/>- </issue>-<issueid="AppBundleLocaleChanges"message="Found dynamic locale changes, but did not find corresponding Play Core library calls for downloading languages and splitting by language is not disabled in the `bundle` configuration"@@ -760,160 +507,6 @@column="68"/></issue>- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" listOf(Cue.Builder().setText(text).build())"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/player/LiveTranslationSession.kt"- line="170"- column="24"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" listOf(Cue.Builder().setText(text).build())"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/player/LiveTranslationSession.kt"- line="170"- column="34"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" listOf(Cue.Builder().setText(text).build())"- errorLine2=" ~~~~~">- <location- file="src/main/java/com/streamvault/app/player/LiveTranslationSession.kt"- line="170"- column="48"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" player.setMediaSource(mediaSource)"- errorLine2=" ~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="123"- column="20"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.HLS -> HlsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="132"- column="50"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.HLS -> HlsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="132"- column="91"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.DASH -> DashMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="133"- column="52"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.DASH -> DashMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="133"- column="93"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.SMOOTH_STREAMING -> SsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="134"- column="62"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.SMOOTH_STREAMING -> SsMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="134"- column="103"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.RTSP -> RtspMediaSource.Factory().createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="135"- column="52"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.RTSP -> RtspMediaSource.Factory().createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="135"- column="62"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.UNKNOWN -> ProgressiveMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="138"- column="62"/>- </issue>-- <issue- id="UnsafeOptInUsageError"- message="This declaration is opt-in and its usage should be marked with `@androidx.media3.common.util.UnstableApi` or `@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)`"- errorLine1=" StreamType.UNKNOWN -> ProgressiveMediaSource.Factory(buildHttpDataSource(streamInfo)).createMediaSource(mediaItem)"- errorLine2=" ~~~~~~~~~~~~~~~~~">- <location- file="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="138"- column="103"/>- </issue>-<issueid="ConfigurationScreenWidthHeight"message="Using Configuration.screenWidthDp instead of LocalWindowInfo.current.containerSize"@@ -5306,42 +4899,42 @@id="TrustAllX509TrustManager"message="`checkClientTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/2ce5aa3210ce7c302d087c4b0c7052f8/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/></issue><issueid="TrustAllX509TrustManager"message="`checkClientTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/2ce5aa3210ce7c302d087c4b0c7052f8/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/></issue><issueid="TrustAllX509TrustManager"message="`checkClientTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/5b1b2bd2e4ea51bc3fd8adee883f62ca/transformed/out/jars/classes.jar"/></issue><issueid="TrustAllX509TrustManager"message="`checkClientTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/5b1b2bd2e4ea51bc3fd8adee883f62ca/transformed/out/jars/classes.jar"/></issue><issueid="TrustAllX509TrustManager"message="`checkServerTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/2ce5aa3210ce7c302d087c4b0c7052f8/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/></issue><issueid="TrustAllX509TrustManager"message="`checkServerTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers"><location- file="$GRADLE_USER_HOME/caches/8.12/transforms/581f8681d178e0d7c04406d441c4fbfb/transformed/out/jars/classes.jar"/>+ file="$GRADLE_USER_HOME/caches/8.12/transforms/5b1b2bd2e4ea51bc3fd8adee883f62ca/transformed/out/jars/classes.jar"/></issue><issue@@ -5384,7 +4977,7 @@errorLine2=" ~~~~~~~~~~~~~~~~"><locationfile="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="375"+ line="387"column="37"/></issue>@@ -5406,7 +4999,7 @@errorLine2=" ~~~~~"><locationfile="src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt"- line="165"+ line="167"column="36"/></issue>@@ -17245,7 +16838,7 @@errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"><locationfile="src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt"- line="404"+ line="417"column="16"/></issue>@@ -17487,19 +17080,19 @@errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"><locationfile="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="195"+ line="201"column="16"/></issue><issueid="UseKtx"message="Use the KTX extension function `String.toUri` instead?"- errorLine1=" ?: Uri.parse(WATCH_NEXT_PROGRAMS_URI)"- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">+ errorLine1=" get() = Uri.parse(WATCH_NEXT_PROGRAMS_URI)"+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"><locationfile="src/main/java/com/streamvault/app/tv/WatchNextManager.kt"- line="234"- column="16"/>+ line="239"+ column="17"/></issue><issuediff --git a/app/src/androidTest/java/com/streamvault/app/compat/PlatformCompatibilityMatrixTest.kt b/app/src/androidTest/java/com/streamvault/app/compat/PlatformCompatibilityMatrixTest.ktindex fc622642..19f34216 100644--- a/app/src/androidTest/java/com/streamvault/app/compat/PlatformCompatibilityMatrixTest.kt+++ b/app/src/androidTest/java/com/streamvault/app/compat/PlatformCompatibilityMatrixTest.kt@@ -13,7 +13,8 @@ import org.junit.Testimport org.junit.runner.RunWith/**- * Small, repeatable platform contract suite. CI runs this class on API 25, 28, 33, 35, and 36 with+ * Small, repeatable platform contract suite. CI runs this class on API 25, 26, 28, 32, 33, 35,+ * and 36 with* -PcompatApi so a green host JVM test cannot hide a platform-only regression.*/@RunWith(AndroidJUnit4::class)@@ -47,6 +48,28 @@ class PlatformCompatibilityMatrixTest {).isEqualTo(ExternalDestination.ProviderSetup())}+ @Test+ fun encodedReturnRouteAndRepeatedParametersRemainSafe() {+ assertThat(+ ExternalDestination.fromLegacyRoute(+ "movie_detail/42?returnRoute=live_tv%3Fcategory%3Dnews%2520east"+ )+ ).isEqualTo(+ ExternalDestination.MovieDetail(+ movieId = 42L,+ returnRoute = "live_tv?category=news%20east"+ )+ )++ assertThat(+ ExternalDestination.fromLegacyRoute(+ "movie_detail/42?returnRoute=live_tv&returnRoute=home"+ )+ ).isEqualTo(+ ExternalDestination.MovieDetail(movieId = 42L, returnRoute = "home")+ )+ }+@Testfun stickyDownloadServiceRestartAlwaysEntersDurableRecovery() {assertThat(resolveDownloadServiceStartMode(null))diff --git a/app/src/main/java/com/streamvault/app/MainActivity.kt b/app/src/main/java/com/streamvault/app/MainActivity.ktindex 9a8ea2e0..6185cd44 100644--- a/app/src/main/java/com/streamvault/app/MainActivity.kt+++ b/app/src/main/java/com/streamvault/app/MainActivity.kt@@ -277,6 +277,7 @@ class MainActivity : ComponentActivity() {}private fun enterPlayerPictureInPictureModeIfEligible(requirePlaying: Boolean = true): Boolean {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return falseif (!supportsPictureInPicture() || isInPictureInPictureMode) {return false}@@ -290,6 +291,7 @@ class MainActivity : ComponentActivity() {}private fun applyPlayerPictureInPictureParams() {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) returnif (!supportsPictureInPicture()) returnrunCatching {PictureInPictureCompat.apply(this, playerPictureInPictureState)diff --git a/app/src/main/java/com/streamvault/app/player/LiveTranslationSession.kt b/app/src/main/java/com/streamvault/app/player/LiveTranslationSession.ktindex ec699a8f..dfe0ad7f 100644--- a/app/src/main/java/com/streamvault/app/player/LiveTranslationSession.kt+++ b/app/src/main/java/com/streamvault/app/player/LiveTranslationSession.kt@@ -1,3 +1,5 @@+@file:androidx.media3.common.util.UnstableApi+package com.streamvault.app.playerimport androidx.media3.common.Cdiff --git a/app/src/main/java/com/streamvault/app/service/DownloadForegroundService.kt b/app/src/main/java/com/streamvault/app/service/DownloadForegroundService.ktindex 360ec3be..6e2a6a69 100644--- a/app/src/main/java/com/streamvault/app/service/DownloadForegroundService.kt+++ b/app/src/main/java/com/streamvault/app/service/DownloadForegroundService.kt@@ -14,6 +14,10 @@ import androidx.core.app.NotificationCompatimport androidx.core.content.ContextCompatimport com.streamvault.app.MainActivityimport com.streamvault.app.R+import com.streamvault.data.platform.DataSyncQuotaAcquireResult+import com.streamvault.data.platform.DataSyncQuotaLease+import com.streamvault.data.platform.DataSyncQuotaOwner+import com.streamvault.data.platform.DataSyncServiceOwnerimport com.streamvault.domain.model.DownloadItemimport com.streamvault.domain.model.DownloadStatusimport com.streamvault.domain.repository.DownloadManager@@ -36,11 +40,14 @@ class DownloadForegroundService : Service() {@InstallIn(SingletonComponent::class)interface DownloadServiceEntryPoint {fun downloadManager(): DownloadManager+ fun dataSyncQuotaOwner(): DataSyncQuotaOwner}private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)private var observeJob: Job? = nullprivate var currentDownloadId: String? = null+ private var dataSyncQuotaOwner: DataSyncQuotaOwner? = null+ private var dataSyncQuotaLease: DataSyncQuotaLease? = nulloverride fun onCreate() {super.onCreate()@@ -70,6 +77,7 @@ class DownloadForegroundService : Service() {stopSelf(startId)return START_NOT_STICKY}+ ensureDataSyncQuotaLease()observeJob?.cancel()if (startMode == DownloadServiceStartMode.RECOVER_INTERRUPTED) {@@ -114,6 +122,7 @@ class DownloadForegroundService : Service() {}override fun onDestroy() {+ releaseDataSyncQuotaLease("service_destroyed")observeJob?.cancel()serviceScope.cancel()currentDownloadId = null@@ -129,6 +138,7 @@ class DownloadForegroundService : Service() {entryPoint().downloadManager().pauseDownloadForForegroundServiceTimeout(downloadId)}} finally {+ releaseDataSyncQuotaLease("android_timeout")stopForeground(STOP_FOREGROUND_REMOVE)stopSelf(startId)}@@ -220,6 +230,29 @@ class DownloadForegroundService : Service() {private fun entryPoint(): DownloadServiceEntryPoint =EntryPointAccessors.fromApplication(applicationContext, DownloadServiceEntryPoint::class.java)+ private fun ensureDataSyncQuotaLease() {+ if (dataSyncQuotaLease != null) return+ val owner = entryPoint().dataSyncQuotaOwner()+ when (val result = owner.acquire(DataSyncServiceOwner.DOWNLOAD)) {+ is DataSyncQuotaAcquireResult.Granted -> {+ dataSyncQuotaOwner = owner+ dataSyncQuotaLease = result.lease+ }+ is DataSyncQuotaAcquireResult.Exhausted -> {+ dataSyncQuotaOwner = owner+ Log.e(TAG, "Shared dataSync quota is exhausted; Android timeout handling remains authoritative")+ }+ }+ }++ private fun releaseDataSyncQuotaLease(reason: String) {+ val lease = dataSyncQuotaLease ?: return+ dataSyncQuotaLease = null+ runCatching { dataSyncQuotaOwner?.release(lease) }+ .onFailure { error -> Log.w(TAG, "Unable to release dataSync quota lease ($reason)", error) }+ dataSyncQuotaOwner = null+ }+private fun beginPendingCommand() {updateNotification(downloadItem = null, pendingCommand = true)}diff --git a/app/src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt b/app/src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.ktindex a53ef9a3..d2abb23a 100644--- a/app/src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt+++ b/app/src/main/java/com/streamvault/app/tv/LauncherRecommendationsManager.kt@@ -8,8 +8,10 @@ import android.graphics.Bitmapimport android.graphics.BitmapFactoryimport android.media.tv.TvContractimport android.net.Uri+import android.os.Buildimport android.provider.BaseColumnsimport android.util.Log+import androidx.annotation.RequiresApiimport com.streamvault.app.MainActivityimport com.streamvault.app.Rimport com.streamvault.app.device.isTelevisionDevice@@ -56,6 +58,7 @@ class LauncherRecommendationsManager @Inject constructor(suspend fun refreshRecommendations(force: Boolean = false) = withContext(Dispatchers.IO) {if (!context.isTelevisionDevice()) return@withContext+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return@withContextrefreshMutex.withLock {val now = System.currentTimeMillis()@@ -224,6 +227,7 @@ class LauncherRecommendationsManager @Inject constructor()}+ @RequiresApi(Build.VERSION_CODES.O)private fun loadExistingChannels(): Map<String, Long> {val projection = arrayOf(BaseColumns._ID,@@ -252,6 +256,7 @@ class LauncherRecommendationsManager @Inject constructor(}.orEmpty()}+ @RequiresApi(Build.VERSION_CODES.O)private fun insertChannel(spec: RecommendationChannelSpec): Long? {val uri = context.contentResolver.insert(TvContract.Channels.CONTENT_URI, buildChannelValues(spec)) ?: return nullval channelId = ContentUris.parseId(uri)@@ -259,6 +264,7 @@ class LauncherRecommendationsManager @Inject constructor(return channelId}+ @RequiresApi(Build.VERSION_CODES.O)private fun updateChannel(channelId: Long, spec: RecommendationChannelSpec) {context.contentResolver.update(ContentUris.withAppendedId(TvContract.Channels.CONTENT_URI, channelId),@@ -268,6 +274,7 @@ class LauncherRecommendationsManager @Inject constructor()}+ @RequiresApi(Build.VERSION_CODES.O)private fun syncPrograms(channelId: Long, spec: RecommendationChannelSpec) {val existingPrograms = loadExistingPrograms(channelId)val activeKeys = spec.programs.mapTo(mutableSetOf()) { it.key }@@ -299,6 +306,7 @@ class LauncherRecommendationsManager @Inject constructor(}}+ @RequiresApi(Build.VERSION_CODES.O)private fun loadExistingPrograms(channelId: Long): Map<String, Long> {val projection = arrayOf(BaseColumns._ID, PREVIEW_COLUMN_INTERNAL_PROVIDER_ID)return context.contentResolver.query(@@ -318,6 +326,7 @@ class LauncherRecommendationsManager @Inject constructor(}.orEmpty()}+ @RequiresApi(Build.VERSION_CODES.O)private fun buildChannelValues(spec: RecommendationChannelSpec): ContentValues = ContentValues().apply {put(CHANNEL_COLUMN_TYPE, TvContract.Channels.TYPE_PREVIEW)put(CHANNEL_COLUMN_DISPLAY_NAME, spec.title)@@ -326,6 +335,7 @@ class LauncherRecommendationsManager @Inject constructor(put(CHANNEL_COLUMN_APP_LINK_INTENT_URI, buildBrowseIntent().toUri(Intent.URI_INTENT_SCHEME))}+ @RequiresApi(Build.VERSION_CODES.O)private fun buildProgramValues(channelId: Long, spec: RecommendationProgramSpec): ContentValues = ContentValues().apply {put(PREVIEW_COLUMN_CHANNEL_ID, channelId)put(PREVIEW_COLUMN_TYPE, previewProgramType(spec.contentType))@@ -339,6 +349,7 @@ class LauncherRecommendationsManager @Inject constructor(put(PREVIEW_COLUMN_DURATION_MILLIS, spec.durationMillis)}+ @RequiresApi(Build.VERSION_CODES.O)private fun previewProgramType(contentType: ContentType): Int = when (contentType) {ContentType.MOVIE,ContentType.VOD -> TvContract.PreviewPrograms.TYPE_MOVIE@@ -362,6 +373,7 @@ class LauncherRecommendationsManager @Inject constructor(private fun buildBrowseIntent(): Intent =buildDestinationIntent(ExternalDestination.Home)+ @RequiresApi(Build.VERSION_CODES.O)private fun requestChannelBrowsable(channelId: Long) {runCatching {TvContract.requestChannelBrowsable(context, channelId)@@ -384,6 +396,7 @@ class LauncherRecommendationsManager @Inject constructor(bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)}+ @RequiresApi(Build.VERSION_CODES.O)private fun deleteAllManagedChannels() {loadExistingChannels().values.forEach(::deleteChannel)}diff --git a/app/src/main/java/com/streamvault/app/tv/WatchNextManager.kt b/app/src/main/java/com/streamvault/app/tv/WatchNextManager.ktindex 96341ffc..316ff539 100644--- a/app/src/main/java/com/streamvault/app/tv/WatchNextManager.kt+++ b/app/src/main/java/com/streamvault/app/tv/WatchNextManager.kt@@ -6,8 +6,10 @@ import android.content.Contextimport android.content.Intentimport android.media.tv.TvContractimport android.net.Uri+import android.os.Buildimport android.provider.BaseColumnsimport android.util.Log+import androidx.annotation.RequiresApiimport com.streamvault.app.MainActivityimport com.streamvault.app.Rimport com.streamvault.app.device.isTelevisionDevice@@ -32,6 +34,7 @@ class WatchNextManager @Inject constructor(suspend fun refreshWatchNext() = withContext(Dispatchers.IO) {if (!context.isTelevisionDevice()) return@withContext+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return@withContextval activeProviderId = providerRepository.getActiveProvider().first()?.idval historyEntries = selectWatchNextHistoryEntries(activeProviderId = activeProviderId,@@ -52,7 +55,7 @@ class WatchNextManager @Inject constructor(.values.forEach { rowId ->context.contentResolver.delete(- ContentUris.withAppendedId(TvContract.WatchNextPrograms.CONTENT_URI, rowId),+ ContentUris.withAppendedId(Uri.parse(WATCH_NEXT_PROGRAMS_URI), rowId),null,null)@@ -62,10 +65,10 @@ class WatchNextManager @Inject constructor(val values = buildWatchNextValues(history)val existingId = existingEntries[watchNextKey(history)]if (existingId == null) {- context.contentResolver.insert(TvContract.WatchNextPrograms.CONTENT_URI, values)+ context.contentResolver.insert(Uri.parse(WATCH_NEXT_PROGRAMS_URI), values)} else {context.contentResolver.update(- ContentUris.withAppendedId(TvContract.WatchNextPrograms.CONTENT_URI, existingId),+ ContentUris.withAppendedId(Uri.parse(WATCH_NEXT_PROGRAMS_URI), existingId),values,null,null@@ -80,7 +83,7 @@ class WatchNextManager @Inject constructor(private fun loadExistingEntries(): Map<String, Long> {val projection = arrayOf(BaseColumns._ID, COLUMN_INTERNAL_PROVIDER_ID)return context.contentResolver.query(- TvContract.WatchNextPrograms.CONTENT_URI,+ Uri.parse(WATCH_NEXT_PROGRAMS_URI),projection,null,null,@@ -96,6 +99,7 @@ class WatchNextManager @Inject constructor(}.orEmpty()}+ @RequiresApi(Build.VERSION_CODES.O)private fun buildWatchNextValues(history: PlaybackHistory): ContentValues {val launchIntent = Intent(context, MainActivity::class.java).setAction(Intent.ACTION_VIEW)@@ -116,6 +120,7 @@ class WatchNextManager @Inject constructor(}}+ @RequiresApi(Build.VERSION_CODES.O)private fun watchNextProgramType(contentType: ContentType): Int = when (contentType) {ContentType.MOVIE,ContentType.VOD -> TvContract.PreviewPrograms.TYPE_MOVIE@@ -146,6 +151,7 @@ class WatchNextManager @Inject constructor(private companion object {const val TAG = "WatchNextManager"+ const val WATCH_NEXT_PROGRAMS_URI = "content://android.media.tv/watch_next_program"const val MAX_WATCH_NEXT_ITEMS = 12const val WATCH_NEXT_COMPLETION_THRESHOLD = 0.95fconst val COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id"diff --git a/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt b/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.ktindex 49440629..d0fcc023 100644--- a/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt+++ b/app/src/main/java/com/streamvault/app/tvinput/StreamVaultTvInputService.kt@@ -1,3 +1,5 @@+@file:androidx.media3.common.util.UnstableApi+package com.streamvault.app.tvinputimport android.content.ContentUrisdiff --git a/app/src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.kt b/app/src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.ktindex 7ec08095..334c310a 100644--- a/app/src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.kt+++ b/app/src/main/java/com/streamvault/app/ui/notifications/NotificationPermissionGate.kt@@ -1,6 +1,5 @@package com.streamvault.app.ui.notifications-import android.Manifestimport android.content.Contextimport android.content.pm.PackageManagerimport android.os.Build@@ -67,7 +66,7 @@ internal fun rememberNotificationPermissionGate(needsNotificationRuntimePermission(context) -> {pendingReminderAction = actionpendingRequestType = NotificationPermissionRequestType.REMINDER- permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)+ permissionLauncher.launch(POST_NOTIFICATIONS_PERMISSION)}else -> {pendingReminderAction = null@@ -81,7 +80,7 @@ internal fun rememberNotificationPermissionGate(needsNotificationRuntimePermission(context) -> {pendingReminderAction = nullpendingRequestType = NotificationPermissionRequestType.RECORDING_ALERTS- permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)+ permissionLauncher.launch(POST_NOTIFICATIONS_PERMISSION)}!notificationsEnabled(context) -> onNotificationsBlocked(recordingBlockedMessage)}@@ -94,10 +93,12 @@ private fun needsNotificationRuntimePermission(context: Context): Boolean {if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {return false}- return ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED+ return ContextCompat.checkSelfPermission(context, POST_NOTIFICATIONS_PERMISSION) != PackageManager.PERMISSION_GRANTED}private fun notificationsEnabled(context: Context): Boolean {return !needsNotificationRuntimePermission(context) &&NotificationManagerCompat.from(context).areNotificationsEnabled()-}\ No newline at end of file+}++private const val POST_NOTIFICATIONS_PERMISSION = "android.permission.POST_NOTIFICATIONS"diff --git a/app/src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt b/app/src/main/java/com/streamvault/app/util/OfficialBuildVerifier.ktindex 529b60fb..f3daf10e 100644--- a/app/src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt+++ b/app/src/main/java/com/streamvault/app/util/OfficialBuildVerifier.kt@@ -45,20 +45,30 @@ object OfficialBuildVerifier {private fun loadSigningCertSha256(context: Context): String? {val packageManager = context.packageManager- val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {- packageManager.getPackageInfo(+ val packageInfo = when {+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> packageManager.getPackageInfo(context.packageName,PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong()))+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.P -> {+ @Suppress("DEPRECATION")+ packageManager.getPackageInfo(context.packageName, PackageManager.GET_SIGNING_CERTIFICATES)+ }+ else -> {+ @Suppress("DEPRECATION")+ packageManager.getPackageInfo(context.packageName, PackageManager.GET_SIGNATURES)+ }+ }++ val signingCertificateBytes = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {+ packageInfo.signingInfo+ ?.apkContentsSigners+ ?.firstOrNull()+ ?.toByteArray()} else {@Suppress("DEPRECATION")- packageManager.getPackageInfo(context.packageName, PackageManager.GET_SIGNING_CERTIFICATES)+ packageInfo.signatures?.firstOrNull()?.toByteArray()}-- val signingCertificateBytes = packageInfo.signingInfo- ?.apkContentsSigners- ?.firstOrNull()- ?.toByteArray()?: return nullval certificate = CertificateFactory.getInstance("X.509")diff --git a/data/src/androidTest/java/com/streamvault/data/manager/recording/PlatformReleaseSafetyInstrumentationTest.kt b/data/src/androidTest/java/com/streamvault/data/manager/recording/PlatformReleaseSafetyInstrumentationTest.ktnew file mode 100644index 00000000..e8eb9c4f--- /dev/null+++ b/data/src/androidTest/java/com/streamvault/data/manager/recording/PlatformReleaseSafetyInstrumentationTest.kt@@ -0,0 +1,82 @@+package com.streamvault.data.manager.recording++import android.content.Context+import android.content.Intent+import android.content.ComponentName+import androidx.test.core.app.ApplicationProvider+import androidx.test.ext.junit.runners.AndroidJUnit4+import androidx.test.platform.app.InstrumentationRegistry+import androidx.work.Configuration+import androidx.work.WorkInfo+import androidx.work.WorkManager+import androidx.work.testing.WorkManagerTestInitHelper+import com.google.common.truth.Truth.assertThat+import java.util.concurrent.Executors+import java.util.concurrent.TimeUnit+import org.junit.Before+import org.junit.Test+import org.junit.runner.RunWith++/**+ * Runs against the merged manifest on API 35/36. The production receiver must enqueue durable+ * recovery when Android delivers a restricted broadcast; it must not start a dataSync service.+ */+@RunWith(AndroidJUnit4::class)+class PlatformReleaseSafetyInstrumentationTest {++ private lateinit var context: Context+ private lateinit var workManager: WorkManager++ @Before+ fun setUp() {+ context = ApplicationProvider.getApplicationContext()+ WorkManagerTestInitHelper.initializeTestWorkManager(+ context,+ Configuration.Builder()+ .setExecutor(Executors.newSingleThreadExecutor())+ .build()+ )+ workManager = WorkManager.getInstance(context)+ workManager.cancelAllWork().result.get(10, TimeUnit.SECONDS)+ }++ @Test+ fun bootBroadcastEnqueuesDurableRecordingRecoveryWithoutStartingRecordingService() {+ sendToRecordingRestoreReceiver(Intent(Intent.ACTION_BOOT_COMPLETED))++ val work = workManager+ .getWorkInfosForUniqueWork(RECORDING_RECONCILE_ONE_SHOT_WORK_NAME)+ .get(10, TimeUnit.SECONDS)++ assertThat(work).hasSize(1)+ assertThat(work.single().tags).contains(RecordingReconcileWorker::class.java.name)+ assertThat(work.single().state).isAnyOf(+ WorkInfo.State.ENQUEUED,+ WorkInfo.State.RUNNING,+ WorkInfo.State.SUCCEEDED,+ WorkInfo.State.FAILED+ )+ }++ @Test+ fun exactAlarmPermissionBroadcastUsesTheSameDurableRecoveryLane() {+ val permissionAction = "android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED"+ sendToRecordingRestoreReceiver(Intent(permissionAction))+ sendToRecordingRestoreReceiver(Intent(permissionAction))++ val work = workManager+ .getWorkInfosForUniqueWork(RECORDING_RECONCILE_ONE_SHOT_WORK_NAME)+ .get(10, TimeUnit.SECONDS)++ assertThat(work).hasSize(1)+ }++ private fun sendToRecordingRestoreReceiver(intent: Intent) {+ context.sendBroadcast(+ intent.setComponent(+ ComponentName(context, RecordingRestoreReceiver::class.java)+ )+ )+ InstrumentationRegistry.getInstrumentation().waitForIdleSync()+ }+}diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingForegroundService.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingForegroundService.ktindex c79ed29f..125de02e 100644--- a/data/src/main/java/com/streamvault/data/manager/recording/RecordingForegroundService.kt+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingForegroundService.kt@@ -13,6 +13,10 @@ import android.os.IBinderimport androidx.core.app.NotificationCompatimport androidx.core.content.ContextCompatimport com.streamvault.data.R+import com.streamvault.data.platform.DataSyncQuotaAcquireResult+import com.streamvault.data.platform.DataSyncQuotaLease+import com.streamvault.data.platform.DataSyncQuotaOwner+import com.streamvault.data.platform.DataSyncServiceOwnerimport com.streamvault.domain.manager.RecordingManagerimport com.streamvault.domain.model.RecordingStatusimport dagger.hilt.EntryPoint@@ -35,12 +39,15 @@ class RecordingForegroundService : Service() {@InstallIn(SingletonComponent::class)interface RecordingServiceEntryPoint {fun recordingManager(): RecordingManager+ fun dataSyncQuotaOwner(): DataSyncQuotaOwner}private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)private val idleGate = RecordingForegroundIdleGate()private var idleStopJob: Job? = nullprivate var notificationJob: Job? = null+ private var dataSyncQuotaOwner: DataSyncQuotaOwner? = null+ private var dataSyncQuotaLease: DataSyncQuotaLease? = nulloverride fun onCreate() {super.onCreate()@@ -65,6 +72,7 @@ class RecordingForegroundService : Service() {stopSelf(startId)return START_NOT_STICKY}+ ensureDataSyncQuotaLease()ensureNotificationObserver()val manager = entryPoint().recordingManager()when (action) {@@ -103,6 +111,7 @@ class RecordingForegroundService : Service() {}override fun onDestroy() {+ releaseDataSyncQuotaLease("service_destroyed")idleStopJob?.cancel()notificationJob?.cancel()serviceScope.cancel()@@ -126,6 +135,7 @@ class RecordingForegroundService : Service() {}}} finally {+ releaseDataSyncQuotaLease("android_timeout")stopForeground(STOP_FOREGROUND_REMOVE)stopSelf(startId)}@@ -191,6 +201,29 @@ class RecordingForegroundService : Service() {private fun entryPoint(): RecordingServiceEntryPoint =EntryPointAccessors.fromApplication(applicationContext, RecordingServiceEntryPoint::class.java)+ private fun ensureDataSyncQuotaLease() {+ if (dataSyncQuotaLease != null) return+ val owner = entryPoint().dataSyncQuotaOwner()+ when (val result = owner.acquire(DataSyncServiceOwner.RECORDING)) {+ is DataSyncQuotaAcquireResult.Granted -> {+ dataSyncQuotaOwner = owner+ dataSyncQuotaLease = result.lease+ }+ is DataSyncQuotaAcquireResult.Exhausted -> {+ dataSyncQuotaOwner = owner+ Log.e(TAG, "Shared dataSync quota is exhausted; Android timeout handling remains authoritative")+ }+ }+ }++ private fun releaseDataSyncQuotaLease(reason: String) {+ val lease = dataSyncQuotaLease ?: return+ dataSyncQuotaLease = null+ runCatching { dataSyncQuotaOwner?.release(lease) }+ .onFailure { error -> Log.w(TAG, "Unable to release dataSync quota lease ($reason)", error) }+ dataSyncQuotaOwner = null+ }+private fun beginPendingCommand() {idleGate.onCommandStarted()idleStopJob?.cancel()diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingReconcileWorker.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingReconcileWorker.ktindex d7f8530e..3c5a5d1d 100644--- a/data/src/main/java/com/streamvault/data/manager/recording/RecordingReconcileWorker.kt+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingReconcileWorker.kt@@ -43,8 +43,8 @@ class RecordingReconcileWorker(}companion object {- private const val PERIODIC_WORK_NAME = "RecordingReconcileWorker"- private const val ONE_SHOT_WORK_NAME = "RecordingReconcileWorkerOneShot"+ private const val PERIODIC_WORK_NAME = RECORDING_RECONCILE_PERIODIC_WORK_NAME+ private const val ONE_SHOT_WORK_NAME = RECORDING_RECONCILE_ONE_SHOT_WORK_NAMEprivate const val KEY_ONE_SHOT = "one_shot"fun enqueuePeriodic(context: Context) {@@ -75,6 +75,8 @@ class RecordingReconcileWorker(}}+internal const val RECORDING_RECONCILE_PERIODIC_WORK_NAME = "RecordingReconcileWorker"+internal const val RECORDING_RECONCILE_ONE_SHOT_WORK_NAME = "RecordingReconcileWorkerOneShot"internal const val RECORDING_RECONCILE_MAX_ONE_SHOT_ATTEMPTS = 3internal const val RECORDING_RECONCILE_BACKOFF_MILLIS = 30_000Linternal const val RECONCILIATION_DIAGNOSTIC_OUTCOME = "outcome"diff --git a/data/src/main/java/com/streamvault/data/platform/DataSyncQuotaOwner.kt b/data/src/main/java/com/streamvault/data/platform/DataSyncQuotaOwner.ktnew file mode 100644index 00000000..6abbda6e--- /dev/null+++ b/data/src/main/java/com/streamvault/data/platform/DataSyncQuotaOwner.kt@@ -0,0 +1,221 @@+package com.streamvault.data.platform++import android.content.Context+import androidx.core.content.edit+import dagger.hilt.android.qualifiers.ApplicationContext+import java.util.UUID+import javax.inject.Inject+import javax.inject.Singleton+import org.json.JSONArray+import org.json.JSONObject++enum class DataSyncServiceOwner {+ RECORDING,+ DOWNLOAD+}++data class DataSyncQuotaLease(+ val token: String,+ val owner: DataSyncServiceOwner+)++data class DataSyncQuotaSnapshot(+ val windowStartedAtMs: Long,+ val consumedMs: Long,+ val remainingMs: Long,+ val activeOwners: Set<DataSyncServiceOwner>+)++sealed interface DataSyncQuotaAcquireResult {+ data class Granted(+ val lease: DataSyncQuotaLease,+ val snapshot: DataSyncQuotaSnapshot+ ) : DataSyncQuotaAcquireResult++ data class Exhausted(+ val snapshot: DataSyncQuotaSnapshot+ ) : DataSyncQuotaAcquireResult+}++/**+ * Persists one application-wide accounting ledger for Android's shared dataSync budget.+ *+ * Android remains the authority that invokes Service.onTimeout; this owner makes recording and+ * download lifetimes visible to the same budget, survives process death by charging abandoned+ * sessions on the next operation, and gives reduced-quota device tests a deterministic seam.+ */+@Singleton+class DataSyncQuotaOwner @Inject constructor(+ @ApplicationContext context: Context+) {+ private val preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE)+ private val lock = Any()+ private val processId = UUID.randomUUID().toString()++ fun acquire(+ owner: DataSyncServiceOwner,+ nowMs: Long = System.currentTimeMillis()+ ): DataSyncQuotaAcquireResult = synchronized(lock) {+ val ledger = loadLedger()+ ledger.recoverAbandonedSessions(processId, nowMs)+ val result = ledger.acquire(owner, nowMs, processId)+ saveLedger(ledger)+ result+ }++ fun release(+ lease: DataSyncQuotaLease,+ nowMs: Long = System.currentTimeMillis()+ ): DataSyncQuotaSnapshot = synchronized(lock) {+ val ledger = loadLedger()+ ledger.recoverAbandonedSessions(processId, nowMs)+ ledger.release(lease, nowMs)+ saveLedger(ledger)+ ledger.snapshot(nowMs)+ }++ fun snapshot(nowMs: Long = System.currentTimeMillis()): DataSyncQuotaSnapshot = synchronized(lock) {+ val ledger = loadLedger()+ ledger.recoverAbandonedSessions(processId, nowMs)+ val snapshot = ledger.snapshot(nowMs)+ saveLedger(ledger)+ snapshot+ }++ private fun loadLedger(): DataSyncQuotaLedger {+ val sessions = runCatching {+ val array = JSONArray(preferences.getString(KEY_SESSIONS, "[]").orEmpty())+ buildMap {+ repeat(array.length()) { index ->+ val item = array.getJSONObject(index)+ val token = item.getString(KEY_TOKEN)+ val owner = DataSyncServiceOwner.valueOf(item.getString(KEY_OWNER))+ put(+ token,+ DataSyncQuotaSession(+ token = token,+ owner = owner,+ startedAtMs = item.getLong(KEY_STARTED_AT),+ processId = item.optString(KEY_PROCESS_ID)+ )+ )+ }+ }.toMutableMap()+ }.getOrDefault(mutableMapOf())+ return DataSyncQuotaLedger(+ windowStartedAtMs = preferences.getLong(KEY_WINDOW_STARTED_AT, 0L),+ consumedMs = preferences.getLong(KEY_CONSUMED_MS, 0L),+ sessions = sessions+ )+ }++ private fun saveLedger(ledger: DataSyncQuotaLedger) {+ val sessions = JSONArray()+ ledger.sessions.values.forEach { session ->+ sessions.put(+ JSONObject()+ .put(KEY_TOKEN, session.token)+ .put(KEY_OWNER, session.owner.name)+ .put(KEY_STARTED_AT, session.startedAtMs)+ .put(KEY_PROCESS_ID, session.processId)+ )+ }+ preferences.edit {+ putLong(KEY_WINDOW_STARTED_AT, ledger.windowStartedAtMs)+ putLong(KEY_CONSUMED_MS, ledger.consumedMs)+ putString(KEY_SESSIONS, sessions.toString())+ }+ }++ private companion object {+ const val PREFERENCES_NAME = "foreground_service_quota"+ const val KEY_WINDOW_STARTED_AT = "window_started_at"+ const val KEY_CONSUMED_MS = "consumed_ms"+ const val KEY_SESSIONS = "sessions"+ const val KEY_TOKEN = "token"+ const val KEY_OWNER = "owner"+ const val KEY_STARTED_AT = "started_at"+ const val KEY_PROCESS_ID = "process_id"+ }+}++internal data class DataSyncQuotaSession(+ val token: String,+ val owner: DataSyncServiceOwner,+ val startedAtMs: Long,+ val processId: String = ""+)++internal class DataSyncQuotaLedger(+ var windowStartedAtMs: Long,+ var consumedMs: Long,+ val sessions: MutableMap<String, DataSyncQuotaSession>,+ private val maxQuotaMs: Long = DEFAULT_MAX_QUOTA_MS,+ private val windowMs: Long = DEFAULT_WINDOW_MS+) {+ init {+ require(maxQuotaMs > 0L)+ require(windowMs > 0L)+ }++ fun acquire(+ owner: DataSyncServiceOwner,+ nowMs: Long,+ processId: String = ""+ ): DataSyncQuotaAcquireResult {+ accrue(nowMs)+ val current = snapshot(nowMs)+ if (current.remainingMs <= 0L) return DataSyncQuotaAcquireResult.Exhausted(current)++ val lease = DataSyncQuotaLease(UUID.randomUUID().toString(), owner)+ sessions[lease.token] = DataSyncQuotaSession(lease.token, owner, nowMs, processId)+ return DataSyncQuotaAcquireResult.Granted(lease, snapshot(nowMs))+ }++ fun recoverAbandonedSessions(processId: String, nowMs: Long) {+ if (processId.isBlank()) return+ accrue(nowMs)+ sessions.entries.removeIf { (_, session) ->+ session.processId.isNotBlank() && session.processId != processId+ }+ }++ fun release(lease: DataSyncQuotaLease, nowMs: Long) {+ accrue(nowMs)+ sessions.remove(lease.token)+ }++ fun snapshot(nowMs: Long): DataSyncQuotaSnapshot {+ accrue(nowMs)+ return DataSyncQuotaSnapshot(+ windowStartedAtMs = windowStartedAtMs,+ consumedMs = consumedMs.coerceIn(0L, maxQuotaMs),+ remainingMs = (maxQuotaMs - consumedMs).coerceAtLeast(0L),+ activeOwners = sessions.values.mapTo(mutableSetOf(), DataSyncQuotaSession::owner)+ )+ }++ private fun accrue(nowMs: Long) {+ if (windowStartedAtMs <= 0L || nowMs - windowStartedAtMs >= windowMs) {+ windowStartedAtMs = nowMs+ consumedMs = 0L+ sessions.clear()+ return+ }++ if (nowMs <= windowStartedAtMs) return+ val updatedSessions = sessions.values.map { session ->+ val elapsed = (nowMs - session.startedAtMs).coerceAtLeast(0L)+ consumedMs += elapsed+ session.copy(startedAtMs = nowMs)+ }+ sessions.clear()+ updatedSessions.forEach { sessions[it.token] = it }+ consumedMs = consumedMs.coerceAtMost(maxQuotaMs)+ }++ companion object {+ const val DEFAULT_MAX_QUOTA_MS = 6L * 60L * 60L * 1_000L+ const val DEFAULT_WINDOW_MS = 24L * 60L * 60L * 1_000L+ }+}diff --git a/data/src/test/java/com/streamvault/data/platform/DataSyncQuotaOwnerTest.kt b/data/src/test/java/com/streamvault/data/platform/DataSyncQuotaOwnerTest.ktnew file mode 100644index 00000000..eaece0af--- /dev/null+++ b/data/src/test/java/com/streamvault/data/platform/DataSyncQuotaOwnerTest.kt@@ -0,0 +1,78 @@+package com.streamvault.data.platform++import com.google.common.truth.Truth.assertThat+import org.junit.Test++class DataSyncQuotaOwnerTest {++ @Test+ fun `recording and download sessions consume one shared budget`() {+ val ledger = DataSyncQuotaLedger(+ windowStartedAtMs = 1_000L,+ consumedMs = 0L,+ sessions = mutableMapOf(),+ maxQuotaMs = 10_000L,+ windowMs = 100_000L+ )++ val recording = ledger.acquire(DataSyncServiceOwner.RECORDING, 1_000L)+ as DataSyncQuotaAcquireResult.Granted+ val download = ledger.acquire(DataSyncServiceOwner.DOWNLOAD, 1_000L)+ as DataSyncQuotaAcquireResult.Granted++ ledger.snapshot(4_000L)++ assertThat(ledger.snapshot(4_000L).consumedMs).isEqualTo(6_000L)+ assertThat(ledger.snapshot(4_000L).activeOwners)+ .containsExactly(DataSyncServiceOwner.RECORDING, DataSyncServiceOwner.DOWNLOAD)++ ledger.release(recording.lease, 5_000L)+ ledger.release(download.lease, 6_000L)+ assertThat(ledger.snapshot(6_000L).consumedMs).isEqualTo(9_000L)+ }++ @Test+ fun `abandoned process session is charged on the next process operation`() {+ val firstProcess = DataSyncQuotaLedger(+ windowStartedAtMs = 1_000L,+ consumedMs = 0L,+ sessions = mutableMapOf(),+ maxQuotaMs = 10_000L,+ windowMs = 100_000L+ )+ firstProcess.acquire(DataSyncServiceOwner.RECORDING, 1_000L, processId = "process-a")++ val persisted = firstProcess.let {+ DataSyncQuotaLedger(it.windowStartedAtMs, it.consumedMs, it.sessions.toMutableMap(), 10_000L, 100_000L)+ }+ val restartedProcess = DataSyncQuotaLedger(+ persisted.windowStartedAtMs,+ persisted.consumedMs,+ persisted.sessions.toMutableMap(),+ 10_000L,+ 100_000L+ )++ assertThat(restartedProcess.snapshot(7_000L).consumedMs).isEqualTo(6_000L)+ restartedProcess.recoverAbandonedSessions("process-b", 7_000L)+ assertThat(restartedProcess.snapshot(7_000L).activeOwners).isEmpty()+ }++ @Test+ fun `quota exhaustion is shared and window rollover resets active sessions`() {+ val ledger = DataSyncQuotaLedger(+ windowStartedAtMs = 1_000L,+ consumedMs = 10_000L,+ sessions = mutableMapOf(),+ maxQuotaMs = 10_000L,+ windowMs = 10_000L+ )++ assertThat(ledger.acquire(DataSyncServiceOwner.DOWNLOAD, 2_000L))+ .isInstanceOf(DataSyncQuotaAcquireResult.Exhausted::class.java)++ val nextWindow = ledger.acquire(DataSyncServiceOwner.RECORDING, 11_000L)+ assertThat(nextWindow).isInstanceOf(DataSyncQuotaAcquireResult.Granted::class.java)+ assertThat(ledger.snapshot(11_000L).consumedMs).isEqualTo(0L)+ }+}diff --git a/docs/IPTV_CODE_REVIEW.md b/docs/IPTV_CODE_REVIEW.mdindex 9fe15540..e24aaaa0 100644--- a/docs/IPTV_CODE_REVIEW.md+++ b/docs/IPTV_CODE_REVIEW.md@@ -1092,10 +1092,10 @@ Phase 5 should stress these boundaries: process death/cancellation during commit| ID | Finding | Classification | Severity ||---|---|---|---|-| PLATFORM-001 | Boot recovery starts a prohibited `dataSync` foreground service before enqueuing durable work | Needs improvement (2026-07-26 audit) | High |-| PLATFORM-002 | Recording and downloads share the six-hour `dataSync` quota without timeout handling | Needs improvement (2026-07-26 audit) | High |+| PLATFORM-001 | Boot recovery starts a prohibited `dataSync` foreground service before enqueuing durable work | Implemented in code; API 35/36 device gate pending (2026-08-14) | High |+| PLATFORM-002 | Recording and downloads share the six-hour `dataSync` quota without timeout handling | Partially resolved; reduced-quota and restart/finalization device gates pending (2026-08-14) | High || DOWNLOAD-001 | Process-killed downloads remain permanently `DOWNLOADING` | Resolved (2026-07-29) | High |-| ALARM-001 | Exact-alarm permission revocation cancels schedules with no grant-time restoration | Needs improvement (2026-07-26 audit) | High |+| ALARM-001 | Exact-alarm permission revocation cancels schedules with no grant-time restoration | Implemented in code; revoke/regrant stopped-app device gate pending (2026-08-14) | High || BACKUP-003 | Backup inspection/import has unbounded parsing and quadratic conflict scans | Resolved (2026-07-29) | High || REMINDER-001 | Notification failure is swallowed and the reminder is marked delivered | Resolved (2026-07-29) | Medium || CLOCK-001 | A future-dated `RUNNING` Xtream index job can suppress recovery indefinitely | Resolved (2026-07-29) | Medium |@@ -1133,6 +1133,8 @@ Phase 5 should stress these boundaries: process death/cancellation during commit- **Required tests:** API 35/36 boot broadcast with FGS restriction enabled; verify no receiver crash, worker enqueued, future alarms restored, overdue windows classified, and app never needs to be opened.- **2026-07-26 audit:** The receiver now enqueues `RecordingReconcileWorker` instead of starting the service, which is the required direction. It still lacks the API 35/36 boot-restriction fixture and evidence that every service-start boundary rejects safely while preserving the pending recording. **Status: Needs improvement.**+- **2026-08-14 implementation follow-up:** `RecordingRestoreReceiver` is now WorkManager-only for boot, package replacement, and exact-alarm permission restoration. The API 35/36 release matrix dispatches the production receiver through an explicit broadcast and asserts one durable one-shot reconciliation work item. The connected API 35/36 execution is still pending in this environment, so boot-restriction/no-crash evidence remains a release gate.+### PLATFORM-002 — Recording and downloads share the six-hour data-sync quota without timeout handling- **Classification / severity:** Confirmed defect — High@@ -1144,6 +1146,8 @@ Phase 5 should stress these boundaries: process death/cancellation during commit- **Required tests:** Reduced quota via device config; one >6h recording; cumulative recording/download use; timeout during read/write/finalization; restart/reconcile; no ANR/crash and truthful partial state.- **2026-07-26 audit:** Both services now override `Service.onTimeout`, cancel/join their owned work, persist an explicit timeout outcome, and stop themselves. A shared quota owner, reduced-quota device fixtures, and restart/finalization coverage are still absent. **Status: Needs improvement.**+- **2026-08-14 implementation follow-up:** Added the persisted application-level `DataSyncQuotaOwner`, with one shared six-hour/24-hour ledger, recording/download leases, process-restart accrual, abandoned-session recovery, quota-window rollover, and service release on normal destruction or Android timeout. Both services now use the same owner while retaining their existing timeout persistence paths. Deterministic shared-budget tests pass; reduced-quota `device_config`, long-running I/O, process-kill, and finalization device evidence remain open. **Status: Partially resolved; Needs improvement until the device gates pass.**+### DOWNLOAD-001 — Process-killed downloads remain permanently DOWNLOADING- **Classification / severity:** Resolved (2026-07-29) — High@@ -1168,6 +1172,8 @@ Phase 5 should stress these boundaries: process death/cancellation during commit- **Resolution:** Both persisted schedule restore receivers now handle Android's exact-alarm permission-state broadcast and reuse their existing idempotent recording/reminder restoration paths.- **2026-07-27 implementation:** Recording runs and reminders now persist whether their exact alarm is armed. Restoration explicitly rechecks the capability, marks eligible entries unarmed when unavailable, and marks them armed only after rescheduling succeeds. Revoke/grant race and stopped-app device coverage remain required. **Status: Needs improvement.**+- **2026-08-14 implementation follow-up:** The release matrix now delivers the exact-alarm permission broadcast to the production recording restore receiver twice and verifies WorkManager uniqueness, with the manifest carrying the same action for both recording and reminder restore receivers. Real permission revoke/regrant, stopped-app, overdue-entry, and exactly-once alarm restoration still require a connected API 35/36 device. **Status: Implemented in code; device gate pending.**+### BACKUP-003 — Backup inspection/import has unbounded parsing and quadratic conflict scans- **Classification / severity:** Resolved (2026-07-29) — High@@ -1228,6 +1234,8 @@ Phase 5 should stress these boundaries: process death/cancellation during commit- **Resolution:** Legacy routes now use the API-compatible string-charset decoder and discard malformed query values rather than crashing navigation.- **2026-07-26 audit:** The local API-compatibility change and a JVM malformed-value test are present. API-25--32 device smoke coverage and the required zero-unsuppressed-runtime/API-lint gate are still absent. **Status: Needs improvement.**+- **2026-08-14 implementation follow-up:** The route parser now uses the API-compatible string-charset decoder and the instrumentation matrix covers API 25, 26, 28, 32, 33, 35, and 36 with UTF-8, `+`, malformed, duplicate, and encoded return-route cases. `:app:lintDebug` passes; the baseline contains no unsuppressed `NewApi`, `InlinedApi`, `UnsafeOptInUsageError`, or foreground-service/API runtime findings, although broader historical lint backlog remains baselined. Physical API 25-32 execution remains CI-gated. **Status: Implemented in code; device gate pending.**+## Phase 5 verification and evidence- Read the graph report/wiki and queried recovery, storage, clock/alarm, and rapid-switch relationships before source inspection.@@ -1315,6 +1323,8 @@ WP0 and the initial WP7 harness can start immediately. WP1 establishes the cance- **Deliverables:** WorkManager-first boot recovery; exact-alarm grant restoration and unarmed state; `Service.onTimeout`/quota-safe terminal handling or replacement APIs; API-compatible route decoding; populated 61→62 and supported-version→62 migration fixtures.- **Exit criteria:** API 25 route/deep-link smoke passes; API 35/36 boot restriction and reduced `dataSync` quota fixtures pass; revoke/re-grant restores exactly one alarm; Room production registry parity and every supported upgrade fixture pass; no unsuppressed runtime/API lint error.+**WP0 implementation follow-up (2026-08-14):** Boot recovery remains WorkManager-first, both `dataSync` services now participate in a persisted shared quota ledger and retain timeout finalization, exact-alarm restore receivers are manifest-registered and idempotent through unique work/armed-state persistence, and the route compatibility matrix is wired for API 25/26/28/32/33/35/36. `:app:lintDebug` passes with no unsuppressed runtime/API findings. The migration registry remains contiguous through v75 and the populated API 36 suite remains 37/37. Connected API 25-36 execution, reduced-quota controls, stopped-app permission races, process-kill/finalization, and API 25 migration execution are still release gates; WP0 is therefore not fully closed.+### WP1 — Cancellation and resource ownership- **Findings:** INFRA-001, NET-001, REC-001, LIFE-001, LIFE-002, STALKER-003, XTREAM-001, PLUGIN-003.