StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat(live): add feature module boundary
David Nashash712751b79e5b
diff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 4ad0a11e..26d03612 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -452,6 +452,7 @@ dependencies {implementation(project(":feature:playback"))implementation(project(":feature:provider"))implementation(project(":feature:settings"))+ implementation(project(":feature:live"))implementation(libs.profileinstaller)baselineProfile(project(":benchmark"))diff --git a/feature/live/build.gradle.kts b/feature/live/build.gradle.ktsnew file mode 100644index 00000000..76e3f14a--- /dev/null+++ b/feature/live/build.gradle.kts@@ -0,0 +1,197 @@+import org.gradle.api.artifacts.ProjectDependency++plugins {+ alias(libs.plugins.android.library)+ alias(libs.plugins.kotlin.android)+ alias(libs.plugins.kotlin.compose)+ alias(libs.plugins.ksp)+ alias(libs.plugins.hilt)+ alias(libs.plugins.kover)+}++android {+ namespace = "com.streamvault.feature.live"+ compileSdk = 36++ defaultConfig {+ minSdk = 25+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"+ }++ compileOptions {+ isCoreLibraryDesugaringEnabled = true+ sourceCompatibility = JavaVersion.VERSION_17+ targetCompatibility = JavaVersion.VERSION_17+ }++ buildFeatures {+ compose = true+ }+}++kotlin {+ compilerOptions {+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)+ }+}++kover {+ currentProject {+ createVariant("ci") {+ add("debug")+ }+ }+}++val allowedProjectDependencies = setOf(+ ":core:navigation",+ ":core:ui",+ ":domain",+ ":data",+ ":player",+)++val forbiddenFeatureLiveSourceTokens = listOf(+ "import com.streamvault.app",+ "com.streamvault.app",+ "import com.streamvault.feature.provider",+ "com.streamvault.feature.provider",+ "import com.streamvault.feature.playback",+ "com.streamvault.feature.playback",+ "MainActivity",+ "NavHostController",+ "NavController",+)++fun findForbiddenFeatureLiveSourceReferences(sourceRoot: java.io.File): List<String> = sourceRoot+ .walkTopDown()+ .filter { it.isFile && it.extension in setOf("kt", "java") }+ .flatMap { file ->+ file.readLines().flatMapIndexed { index, line ->+ forbiddenFeatureLiveSourceTokens.filter(line::contains).map { token ->+ "${file.relativeTo(sourceRoot)}:${index + 1}: ${token}"+ }+ }+ }+ .toList()++val featureLiveBoundaryReport = layout.buildDirectory.file(+ "reports/feature-live-boundary/report.txt"+)++val verifyFeatureLiveBoundary = tasks.register("verifyFeatureLiveBoundary") {+ group = "verification"+ description = "Verifies that the live feature source and dependencies remain app-independent."+ outputs.file(featureLiveBoundaryReport)+ outputs.upToDateWhen { false }+ notCompatibleWithConfigurationCache(+ "The boundary scan reads resolved Gradle model state at execution time."+ )++ doLast {+ val projectDependencyPaths = configurations+ .flatMap { configuration ->+ configuration.dependencies+ .withType<ProjectDependency>()+ .filter { dependency -> dependency.path != project.path }+ .map { dependency -> dependency.path }+ }+ .toSet()++ check(projectDependencyPaths == allowedProjectDependencies) {+ ":feature:live project dependencies must be exactly " ++ "${allowedProjectDependencies.sorted()}; found ${projectDependencyPaths.sorted()}"+ }++ val sourceRoot = layout.projectDirectory.asFile.resolve("src/main")+ val violations = findForbiddenFeatureLiveSourceReferences(sourceRoot)+ check(violations.isEmpty()) {+ ":feature:live contains forbidden app, feature, or root navigation references:\n" ++ violations.joinToString("\n")+ }++ val fixtureRoot = layout.projectDirectory.asFile.resolve("src/test/resources/boundary-fixtures")+ val fixtureViolations = findForbiddenFeatureLiveSourceReferences(fixtureRoot)+ val requiredFixtureViolations = setOf(+ "AppPackageImport.kt:3: import com.streamvault.app",+ "FullyQualifiedAppReference.kt:3: com.streamvault.app",+ "MainActivityReference.java:4: MainActivity",+ "RootNavigation.kt:3: NavHostController",+ "RootNavigation.java:4: NavController",+ "ProviderFeatureImport.kt:3: import com.streamvault.feature.provider",+ "PlaybackFeatureImport.java:3: import com.streamvault.feature.playback"+ )+ check(fixtureViolations.containsAll(requiredFixtureViolations)) {+ ":feature:live boundary fixtures are not detected: " ++ "${requiredFixtureViolations - fixtureViolations.toSet()}"+ }++ val reportFile = featureLiveBoundaryReport.get().asFile+ reportFile.parentFile.mkdirs()+ reportFile.writeText(+ listOf(+ "projectDependencies=${projectDependencyPaths.sorted().joinToString(",")}",+ "mainSourceViolations=${violations.joinToString("|")}",+ "fixtureViolations=${fixtureViolations.joinToString("|")}"+ ).joinToString("\n")+ )++ println(+ "Verified :feature:live boundary: approved dependencies, no forbidden source references, " ++ "and Kotlin/Java fixture coverage."+ )+ }+}++tasks.named("check") {+ dependsOn(verifyFeatureLiveBoundary)+}++tasks.withType<org.gradle.api.tasks.testing.Test>().configureEach {+ dependsOn(verifyFeatureLiveBoundary)+}++dependencies {+ coreLibraryDesugaring(libs.desugar.jdk.libs)++ implementation(project(":core:navigation"))+ implementation(project(":core:ui"))+ implementation(project(":domain"))+ implementation(project(":data"))+ implementation(project(":player"))++ implementation(platform(libs.compose.bom))+ implementation(libs.compose.ui)+ implementation(libs.compose.material3)+ implementation(libs.compose.material.icons.extended)+ implementation(libs.compose.tv.foundation)+ implementation(libs.compose.tv.material)+ implementation(libs.activity.compose)+ implementation(libs.lifecycle.runtime.ktx)+ implementation(libs.lifecycle.runtime.compose)+ implementation(libs.lifecycle.viewmodel.compose)+ implementation(libs.navigation.compose)+ implementation(libs.hilt.android)+ ksp(libs.hilt.compiler)+ implementation(libs.hilt.navigation.compose)+ implementation(libs.coroutines.core)+ implementation(libs.coroutines.android)+ implementation(libs.core.ktx)+ implementation(libs.documentfile)+ implementation(libs.okhttp)+ implementation(libs.okhttp.logging)+ implementation(libs.zxing.core)++ testImplementation(libs.junit)+ testImplementation(libs.truth)+ testImplementation(libs.coroutines.test)+ testImplementation(libs.robolectric)+ testImplementation(libs.mockito.kotlin)++ androidTestImplementation(platform(libs.compose.bom))+ androidTestImplementation("androidx.compose.ui:ui-test-junit4")+ androidTestImplementation(libs.navigation.testing)+ androidTestImplementation(libs.androidx.test.ext.junit)+ androidTestImplementation(libs.androidx.test.runner)+ androidTestImplementation(libs.truth)+}diff --git a/feature/live/src/main/AndroidManifest.xml b/feature/live/src/main/AndroidManifest.xmlnew file mode 100644index 00000000..7425a54c--- /dev/null+++ b/feature/live/src/main/AndroidManifest.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<manifest xmlns:android="http://schemas.android.com/apk/res/android">+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />+</manifest>diff --git a/feature/live/src/test/resources/boundary-fixtures/AppPackageImport.kt b/feature/live/src/test/resources/boundary-fixtures/AppPackageImport.ktnew file mode 100644index 00000000..7b5100b7--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/AppPackageImport.kt@@ -0,0 +1,3 @@+package fixture++import com.streamvault.app.Appdiff --git a/feature/live/src/test/resources/boundary-fixtures/FullyQualifiedAppReference.kt b/feature/live/src/test/resources/boundary-fixtures/FullyQualifiedAppReference.ktnew file mode 100644index 00000000..5c6df572--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/FullyQualifiedAppReference.kt@@ -0,0 +1,3 @@+package fixture++val appType = com.streamvault.app.App::classdiff --git a/feature/live/src/test/resources/boundary-fixtures/MainActivityReference.java b/feature/live/src/test/resources/boundary-fixtures/MainActivityReference.javanew file mode 100644index 00000000..68c49472--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/MainActivityReference.java@@ -0,0 +1,5 @@+package fixture;++final class MainActivityReference {+ Class<?> activity = MainActivity.class;+}diff --git a/feature/live/src/test/resources/boundary-fixtures/PlaybackFeatureImport.java b/feature/live/src/test/resources/boundary-fixtures/PlaybackFeatureImport.javanew file mode 100644index 00000000..e4202286--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/PlaybackFeatureImport.java@@ -0,0 +1,7 @@+package fixture;++import com.streamvault.feature.playback.PlaybackFeature;++final class PlaybackFeatureImport {+ Class<?> playback = PlaybackFeature.class;+}diff --git a/feature/live/src/test/resources/boundary-fixtures/ProviderFeatureImport.kt b/feature/live/src/test/resources/boundary-fixtures/ProviderFeatureImport.ktnew file mode 100644index 00000000..8c13c912--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/ProviderFeatureImport.kt@@ -0,0 +1,3 @@+package fixture++import com.streamvault.feature.provider.ProviderFeaturediff --git a/feature/live/src/test/resources/boundary-fixtures/RootNavigation.java b/feature/live/src/test/resources/boundary-fixtures/RootNavigation.javanew file mode 100644index 00000000..1c3c9939--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/RootNavigation.java@@ -0,0 +1,5 @@+package fixture;++final class RootNavigation {+ Class<?> controller = NavController.class;+}diff --git a/feature/live/src/test/resources/boundary-fixtures/RootNavigation.kt b/feature/live/src/test/resources/boundary-fixtures/RootNavigation.ktnew file mode 100644index 00000000..69a5e8d5--- /dev/null+++ b/feature/live/src/test/resources/boundary-fixtures/RootNavigation.kt@@ -0,0 +1,5 @@+package fixture++import androidx.navigation.NavHostController++fun nav(controller: NavHostController) = controllerdiff --git a/settings.gradle.kts b/settings.gradle.ktsindex 559ef592..c2348383 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -26,3 +26,4 @@ include(":player")include(":feature:playback")include(":feature:provider")include(":feature:settings")+include(":feature:live")diff --git a/validation/phase5_live/performance-before.md b/validation/phase5_live/performance-before.mdnew file mode 100644index 00000000..7dc637f4--- /dev/null+++ b/validation/phase5_live/performance-before.md@@ -0,0 +1,52 @@+# Phase 5 Live pre-extraction performance samples++Date: 2026-08-28++The required pre-extraction comparison uses the current app-owned Home/EPG+source and test compilation tasks. The focused behavioral baseline completed+successfully in `validation/phase5_live/task0-inventory.md`.++The five paired incremental samples are being collected before the first Live+module source move. Each sample records the Gradle profile path, wall time,+executed/up-to-date/from-cache task counts, and whether another Java/Gradle+process was active. A sample is comparable only when the same SDK, Gradle,+storage paths, cache state, and source edit are used after extraction.++## Source scenario++Command:++```text+./gradlew.bat :app:compileDebugKotlin --no-daemon --console=plain --warning-mode=none --profile+```++| Run | Wall time | Profile | Notes |+|---:|---:|---|---|+| 1 | 89.260 s | `profile-2026-08-28-18-08-05.html` | no-change warm sample; first daemon/configuration cost |+| 2 | 12.104 s | `profile-2026-08-28-18-08-45.html` | no-change sample |+| 3 | 14.100 s | `profile-2026-08-28-18-08-58.html` | no-change sample |+| 4 | 11.960 s | `profile-2026-08-28-18-09-09.html` | no-change sample |+| 5 | 10.968 s | `profile-2026-08-28-18-09-19.html` | no-change sample |++## Test compilation scenario++Command:++```text+./gradlew.bat :app:compileDebugUnitTestKotlin --no-daemon --console=plain --warning-mode=none --profile+```++| Run | Wall time | Profile | Notes |+|---:|---:|---|---|+| 1 | 36.420 s | `profile-2026-08-28-18-11-30.html` | no-change warm sample; first daemon/configuration cost |+| 2 | 13.267 s | `profile-2026-08-28-18-11-53.html` | no-change sample |+| 3 | 11.850 s | `profile-2026-08-28-18-12-06.html` | no-change sample |+| 4 | 10.980 s | `profile-2026-08-28-18-12-20.html` | no-change sample |+| 5 | 11.244 s | `profile-2026-08-28-18-12-33.html` | no-change sample |++## Interpretation++These timings are real no-change baseline samples from the current checkout;+they establish the warm task-cost envelope but do not simulate an edited source+file. No performance target is claimed until post-extraction commands are run+from a comparable committed snapshot with the same environment.diff --git a/validation/phase5_live/task0-inventory.md b/validation/phase5_live/task0-inventory.mdnew file mode 100644index 00000000..54b16166--- /dev/null+++ b/validation/phase5_live/task0-inventory.md@@ -0,0 +1,147 @@+# Phase 5 Live extraction inventory++Date: 2026-08-28++## Scope and rollback point++The live slice is the fourth Phase 5 module extraction: Home Live TV,+categories/channels, EPG/guide, preview presentation, and the required app+composition seams. Catalog and System are explicitly out of scope. Settings,+Provider, and Playback remain governed by their existing reports and open gates.++Rollback point before implementation: `ea349d83dceb8baa45ef1a18b7a45fa295a264f5`+(`docs(live): plan phase 5 feature extraction`). The working tree was clean+when this inventory began.++## Move unit++The current production move unit contains 13 Kotlin files and 10,156 lines:++```text+app/src/main/java/com/streamvault/app/ui/screens/home/HomePreviewUiState.kt+app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt+app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt+app/src/main/java/com/streamvault/app/ui/screens/home/HomeSidebarComponents.kt+app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/GuideDateTime.kt+app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt+```++Focused tests are:++```text+app/src/test/java/com/streamvault/app/ui/screens/home/HomeViewModelTest.kt+app/src/test/java/com/streamvault/app/ui/screens/epg/EpgViewModelTest.kt+app/src/test/java/com/streamvault/app/ui/screens/epg/GuideDateTimeTest.kt+app/src/test/java/com/streamvault/app/ui/screens/epg/ProgramReminderIssueMessageTest.kt+```++`PlayerTransparentGuideOverlay.kt` is currently unreferenced and was deferred+from Playback by the accepted Phase 5 design. It moves with EPG but is not+registered as a new route.++## Current coupling++The move unit has 140 distinct project imports. App implementation imports are:++```text+com.streamvault.app.R+com.streamvault.app.device.rememberIsTelevisionDevice+com.streamvault.app.navigation.Routes+com.streamvault.app.plugins.StreamVaultPluginManager+com.streamvault.app.tvinput.TvInputChannelSyncManager+com.streamvault.app.ui.components.*+com.streamvault.app.ui.components.dialogs.*+com.streamvault.app.ui.components.shell.*+com.streamvault.app.ui.model.guideLookupKey+com.streamvault.app.ui.remote.*+com.streamvault.app.ui.screens.epg.*+com.streamvault.app.ui.time.*+```++Direct implementation dependencies that need an ownership seam are:++| Type | Current use | Planned treatment |+|---|---|---|+| `PreferencesRepository` | Home/EPG preference flows and preview engine configuration | Retain as temporary ledgered `:data` dependency |+| `ProviderSyncStateSource` | Home provider-sync state | Retain as temporary ledgered `:data` dependency |+| `StreamVaultPluginManager` | Preview stream preparation | `LivePreviewStreamPreparer` port + app adapter |+| `TvInputChannelSyncManager` | TV-input refresh after Home data refresh | `LiveSurfaceRefreshPort` + app adapter |+| `LivePreviewHandoffManager` | Fullscreen/reverse preview handoff | `LivePreviewHandoffPort` + app adapter |+| `MultiViewManager` | Home slot count/capacity | `LiveMultiViewStatusPort` + app adapter |+| `MultiViewViewModel` / `MultiViewPlannerDialog` | Home planner UI | app-composed `LiveMultiViewPlannerContent` callback |++The feature remains allowed to depend on `:player` for `PlayerEngine`, render+surfaces, and player API values. It must not depend on `:feature:playback`.++## Shared presentation ownership++These current app components are used outside the live slice and cannot be+moved into Live without making Catalog depend on Live:++```text+CategoryRow, ChannelCard, ChannelProgressTicker, ReorderTopBar,+SelectionChipRow, CategoryOptionsDialog+```++Live receives behavior-preserving, distinctly named local equivalents while+the existing app implementations remain for Dashboard, Movies, Series,+Favorites, Search, and VOD. Core UI is used for app-independent shell, focus,+button, image, time, device, notification, and empty-state primitives.++Live-only app components such as source switching, Home category dialogs,+guide lookup identity, and live remote-shortcut dispatch move into the feature.++## Resources++The initial scan found 196 unique resource references across Home and EPG. They+cover Home/category/channel/quick-filter/group UI, preview states, EPG grid and+controls, archive/reminder/recording conflict, notification permission, and+shared action labels. Resource migration is locale-by-locale; an app resource+is removed only after repository-wide consumer search proves it is no longer+needed. Shared keys may be duplicated temporarily with identical values.++## Routes and consumers++Current route patterns are:++```text+live_tv?categoryId={categoryId}+epg?categoryId={categoryId}&anchorTime={anchorTime}&favoritesOnly={favoritesOnly}+```++`AppNavHost` calls `app.navigation.graph.LiveGraph.registerLiveGraph`; that+graph calls `HomeScreen` and `FullEpgScreen`. `AppRouteCodec` remains the+compatibility encoder/decoder and currently builds the exact `LiveTv` and+`Guide` typed destinations. The new feature graph will receive typed callbacks;+the app will continue constructing `PlayerNavigationRequest` values.++## Baseline verification++The focused pre-extraction command completed successfully with exit code 0:++```text+./gradlew.bat :app:testDebugUnitTest --tests "com.streamvault.app.ui.screens.home.HomeViewModelTest" --tests "com.streamvault.app.ui.screens.epg.EpgViewModelTest" --tests "com.streamvault.app.ui.screens.epg.GuideDateTimeTest" --tests "com.streamvault.app.ui.screens.epg.ProgramReminderIssueMessageTest" :app:compileDebugKotlin --no-daemon --console=plain --warning-mode=none++BUILD SUCCESSFUL in 3m 38s+136 actionable tasks: 3 executed, 133 up-to-date+```++The source/test performance samples are captured separately in+`validation/phase5_live/performance-before.md`. Because this workstation has+other Java/Gradle processes active, samples must record cache/setup state and+must not be treated as a steady-state target closure without comparable+post-extraction runs.++## Existing open gates carried forward++- Playback long-duration two-channel stability, manual coverage, and performance gates remain open under `docs/COMPOSE_REDUCTION_PHASE5_PLAYBACK_REPORT.md`.+- Provider full completion journeys and paired incremental measurements remain open under `docs/COMPOSE_REDUCTION_PHASE5_PROVIDER_REPORT.md`.+- Settings DAO cleanup, steady-state performance comparison, fixture-dependent flows, and full-shell coverage remain open under `docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md`.+- Live extraction must add its own preview handoff, EPG navigation, and two-channel long-duration validation. None of these gates is closed by the baseline command above.