StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat(ui): wire mute toggle & in-stream metadata to player controls
Davidona2472a4ef591e
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.ktindex 130fe0eb..7383070e 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt@@ -144,6 +144,8 @@ fun PlayerScreen(val duration by viewModel.playerEngine.duration.collectAsState()val playerNotice by viewModel.playerNotice.collectAsState()val currentChannelRecording by viewModel.currentChannelRecording.collectAsState()+ val isMuted by viewModel.isMuted.collectAsState()+ val mediaTitle by viewModel.mediaTitle.collectAsState()var showTrackSelection by remember { mutableStateOf<TrackType?>(null) }var showProgramHistory by remember { mutableStateOf(false) }@@ -582,6 +584,8 @@ fun PlayerScreen(audioTrackCount = availableAudioTracks.size,videoQualityCount = availableVideoQualities.size,currentRecordingStatus = currentChannelRecording?.status,+ isMuted = isMuted,+ mediaTitle = mediaTitle,playButtonFocusRequester = playButtonFocusRequester,modifier = Modifier.fillMaxSize(),onClose = onBack,@@ -597,7 +601,8 @@ fun PlayerScreen(onOpenSubtitleTracks = { showTrackSelection = TrackType.TEXT },onOpenAudioTracks = { showTrackSelection = TrackType.AUDIO },onOpenVideoTracks = { showTrackSelection = TrackType.VIDEO },- onOpenSplitScreen = { showSplitDialog = true }+ onOpenSplitScreen = { showSplitDialog = true },+ onToggleMute = viewModel::toggleMute)PlayerNumericInputOverlay(diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex 95972467..3bcf0806 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -410,6 +410,8 @@ class PlayerViewModel @Inject constructor(val playerStats = playerEngine.playerStatsval availableAudioTracks = playerEngine.availableAudioTracksval availableSubtitleTracks = playerEngine.availableSubtitleTracks+ val isMuted: StateFlow<Boolean> = playerEngine.isMuted+ val mediaTitle: StateFlow<String?> = playerEngine.mediaTitleprivate val _availableVideoQualities = MutableStateFlow<List<com.streamvault.player.PlayerTrack>>(emptyList())val availableVideoQualities: StateFlow<List<com.streamvault.player.PlayerTrack>> = _availableVideoQualities.asStateFlow()@@ -1302,6 +1304,7 @@ class PlayerViewModel @Inject constructor(fun pause() = playerEngine.pause()fun seekForward() = playerEngine.seekForward()fun seekBackward() = playerEngine.seekBackward()+ fun toggleMute() = playerEngine.toggleMute()fun toggleControls() {closeChannelInfoOverlay()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.ktindex 85d46791..ba41acb1 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt@@ -86,6 +86,8 @@ fun PlayerControlsOverlay(audioTrackCount: Int,videoQualityCount: Int,currentRecordingStatus: RecordingStatus?,+ isMuted: Boolean,+ mediaTitle: String?,playButtonFocusRequester: FocusRequester,onClose: () -> Unit,onTogglePlayPause: () -> Unit,@@ -101,6 +103,7 @@ fun PlayerControlsOverlay(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenSplitScreen: () -> Unit,+ onToggleMute: () -> Unit,clockLabelOverride: String? = null,modifier: Modifier = Modifier) {@@ -132,6 +135,8 @@ fun PlayerControlsOverlay(audioTrackCount = audioTrackCount,videoQualityCount = videoQualityCount,currentRecordingStatus = currentRecordingStatus,+ isMuted = isMuted,+ mediaTitle = mediaTitle,modifier = Modifier.align(Alignment.BottomCenter),onRestartProgram = onRestartProgram,onOpenArchive = onOpenArchive,@@ -142,7 +147,8 @@ fun PlayerControlsOverlay(onOpenSubtitleTracks = onOpenSubtitleTracks,onOpenAudioTracks = onOpenAudioTracks,onOpenVideoTracks = onOpenVideoTracks,- onOpenSplitScreen = onOpenSplitScreen+ onOpenSplitScreen = onOpenSplitScreen,+ onToggleMute = onToggleMute)if (contentType != "LIVE") {@@ -421,6 +427,8 @@ private fun PlayerBottomBar(audioTrackCount: Int,videoQualityCount: Int,currentRecordingStatus: RecordingStatus?,+ isMuted: Boolean,+ mediaTitle: String?,onRestartProgram: () -> Unit,onOpenArchive: () -> Unit,onStartRecording: () -> Unit,@@ -431,6 +439,7 @@ private fun PlayerBottomBar(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenSplitScreen: () -> Unit,+ onToggleMute: () -> Unit,modifier: Modifier = Modifier) {Box(@@ -472,6 +481,8 @@ private fun PlayerBottomBar(audioTrackCount = audioTrackCount,videoQualityCount = videoQualityCount,currentRecordingStatus = currentRecordingStatus,+ isMuted = isMuted,+ mediaTitle = mediaTitle,onRestartProgram = onRestartProgram,onOpenArchive = onOpenArchive,onStartRecording = onStartRecording,@@ -481,7 +492,8 @@ private fun PlayerBottomBar(onOpenSubtitleTracks = onOpenSubtitleTracks,onOpenAudioTracks = onOpenAudioTracks,onOpenVideoTracks = onOpenVideoTracks,- onOpenSplitScreen = onOpenSplitScreen+ onOpenSplitScreen = onOpenSplitScreen,+ onToggleMute = onToggleMute)} else if (contentType != "LIVE") {PlayerVodInfo(@@ -492,10 +504,12 @@ private fun PlayerBottomBar(subtitleTrackCount = subtitleTrackCount,audioTrackCount = audioTrackCount,videoQualityCount = videoQualityCount,+ isMuted = isMuted,onToggleAspectRatio = onToggleAspectRatio,onOpenSubtitleTracks = onOpenSubtitleTracks,onOpenAudioTracks = onOpenAudioTracks,- onOpenVideoTracks = onOpenVideoTracks+ onOpenVideoTracks = onOpenVideoTracks,+ onToggleMute = onToggleMute)}}@@ -513,6 +527,8 @@ private fun PlayerLiveInfo(audioTrackCount: Int,videoQualityCount: Int,currentRecordingStatus: RecordingStatus?,+ isMuted: Boolean,+ mediaTitle: String?,onRestartProgram: () -> Unit,onOpenArchive: () -> Unit,onStartRecording: () -> Unit,@@ -522,7 +538,8 @@ private fun PlayerLiveInfo(onOpenSubtitleTracks: () -> Unit,onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,- onOpenSplitScreen: () -> Unit+ onOpenSplitScreen: () -> Unit,+ onToggleMute: () -> Unit) {val primaryActions = buildList {if (currentProgram?.hasArchive == true) {@@ -538,6 +555,10 @@ private fun PlayerLiveInfo(}val secondaryActions = buildList {add(PlayerActionSpec(stringResource(R.string.player_aspect_ratio_label, aspectRatioLabel), onToggleAspectRatio))+ add(PlayerActionSpec(+ stringResource(if (isMuted) R.string.player_unmute else R.string.player_mute),+ onToggleMute+ ))if (subtitleTrackCount > 0) {add(PlayerActionSpec(stringResource(R.string.player_subs), onOpenSubtitleTracks))}@@ -563,7 +584,7 @@ private fun PlayerLiveInfo(}}Text(- text = currentProgram?.title ?: currentChannelName.orEmpty(),+ text = currentProgram?.title ?: mediaTitle ?: currentChannelName.orEmpty(),style = MaterialTheme.typography.headlineSmall,color = Color.White,maxLines = 1@@ -632,13 +653,19 @@ private fun PlayerVodInfo(subtitleTrackCount: Int,audioTrackCount: Int,videoQualityCount: Int,+ isMuted: Boolean,onToggleAspectRatio: () -> Unit,onOpenSubtitleTracks: () -> Unit,onOpenAudioTracks: () -> Unit,- onOpenVideoTracks: () -> Unit+ onOpenVideoTracks: () -> Unit,+ onToggleMute: () -> Unit) {val actions = buildList {add(PlayerActionSpec(stringResource(R.string.player_aspect_ratio_label, aspectRatioLabel), onToggleAspectRatio))+ add(PlayerActionSpec(+ stringResource(if (isMuted) R.string.player_unmute else R.string.player_mute),+ onToggleMute+ ))if (subtitleTrackCount > 0) {add(PlayerActionSpec(stringResource(R.string.player_subs), onOpenSubtitleTracks))}diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 63cc0d27..9cee7a1c 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -520,6 +520,8 @@<string name="player_recording_missing_context">Recording needs a valid live channel context.</string><string name="player_subs">Subs</string><string name="player_audio">Audio</string>+ <string name="player_mute">Mute</string>+ <string name="player_unmute">Unmute</string><string name="player_resume_title">Resume Playback</string><string name="player_resume_desc">Do you want to resume %1$s from where you left off?</string><string name="player_resume_start_over">Start Over</string>diff --git a/docs/audit/00_EXECUTIVE_SUMMARY.md b/docs/audit/00_EXECUTIVE_SUMMARY.mddeleted file mode 100644index 10f9d6a7..00000000--- a/docs/audit/00_EXECUTIVE_SUMMARY.md+++ /dev/null@@ -1,110 +0,0 @@-# StreamVault Pre-Release Audit: Executive Summary & Action Plan--> **Audit Date:** March 17, 2026-> **Audited Modules:** app, data, domain, player (full codebase)-> **Total Files Reviewed:** ~100+ Kotlin source files, build configs, CI/CD, tests, security-------## Overall Assessment--StreamVault is a **well-engineered Android TV IPTV player** with clean multi-module architecture, modern Kotlin/Compose stack, and several strong security implementations. The codebase demonstrates thoughtful design decisions and consistent patterns across most areas.--**However, the app is not ready for a premium production release.** There are 5 critical issues that must be fixed, 8 high-priority issues, and numerous medium/low items. The most impactful problems are: dead code in two major screens, thread safety bugs, race conditions, missing Android TV platform integration, and insufficient test coverage.-------## Issue Count by Severity--| Severity | Count | Description |-|----------|-------|-------------|-| π΄ **CRITICAL** | 5 | Must fix before any release β broken features, data corruption risk |-| π **HIGH** | 8 | Should fix before production β UX issues, security gaps, race conditions |-| π‘ **MEDIUM** | 12 | Fix within first release cycle β quality, consistency, accessibility |-| π’ **LOW** | 15+ | Track for future improvements β nice-to-haves, optimizations |-------## Critical Issues (Must Fix)--| ID | Issue | File(s) | Details |-|----|-------|---------|---------|-| **C-1** | ~2,300 lines of dead code (unreachable after `return`) | MoviesScreen.kt, SeriesScreen.kt | Category sidebar browsing is completely non-functional |-| **C-2** | 8 empty `onClick = { }` handlers on visible chips | MoviesScreen.kt, SeriesScreen.kt | Interactive-looking UI elements that do nothing |-| **C-3** | `SimpleDateFormat` race condition in XmltvParser | XmltvParser.kt | Shared mutable instances used across threads |-| **C-4** | Concurrent EPG sync can corrupt data | EpgRepositoryImpl.kt | Same staging ID used by parallel syncs |-| **C-5** | Favorite position collision (non-atomic insert) | FavoriteRepositoryImpl.kt | Check-then-act without transaction wrapping |-------## High Priority Issues--| ID | Issue | Category |-|----|-------|----------|-| **H-1** | Hardcoded colors bypass theme system (MultiView + Dashboard) | UI Consistency |-| **H-2** | Missing Android TV platform features (Watch Next, Voice Search) | Platform Integration |-| **H-3** | Parental control state β in-memory only, no brute-force protection | Security / UX |-| **H-4** | ConcurrentHashMap check-then-act race in SeriesRepository | Thread Safety |-| **H-5** | Multi-provider sync state overwrites in SyncManager | Data Integrity |-| **H-6** | CredentialCrypto silent failure β empty string on decryption error | UX / Security |-| **H-7** | Network error types not classified (auth vs network vs parsing) | Error Handling |-| **H-8** | Test coverage ~15-20% β missing security, error path, and integration tests | Quality Assurance |-------## Detailed Audit Documents--| Document | Focus Area |-|----------|-----------|-| [01_CRITICAL_ISSUES.md](01_CRITICAL_ISSUES.md) | Critical & High priority issues with code details |-| [02_SECURITY_REVIEW.md](02_SECURITY_REVIEW.md) | OWASP-relevant security analysis |-| [03_ARCHITECTURE_QUALITY_PERFORMANCE.md](03_ARCHITECTURE_QUALITY_PERFORMANCE.md) | Patterns, magic numbers, performance, accessibility |-| [04_MISSING_FEATURES_COMPLETENESS.md](04_MISSING_FEATURES_COMPLETENESS.md) | Feature gaps, missing implementations, test coverage |-------## Recommended Fix Order--### Phase 1: Release Blockers (Before Any Release)-1. Fix or remove dead code in MoviesScreen/SeriesScreen (C-1)-2. Implement or remove empty onClick handlers (C-2)-3. Fix XmltvParser SimpleDateFormat thread safety (C-3)-4. Add per-provider EPG sync lock (C-4)-5. Make favorite position insert atomic (C-5)--### Phase 2: Production Hardening (Before Public Release)-6. Replace hardcoded colors with theme tokens (H-1)-7. Fix ConcurrentHashMap race in SeriesRepository (H-4)-8. Fix SyncManager multi-provider state tracking (H-5)-9. Surface CredentialCrypto decryption failures to user (H-6)-10. Classify network errors properly (H-7)-11. Persist parental control unlock state with TTL (H-3)-12. Add security test suite (H-8)-13. Add error path tests for critical flows--### Phase 3: Premium Polish (For Premium Positioning)-14. Implement Watch Next / recommendation channels (H-2)-15. Add voice search integration-16. Add quality selection UI in player-17. Implement stream failover using alternativeStreams-18. Add playback speed control-19. Add more use cases in domain layer-20. Improve accessibility (high contrast, reduced motion, text sizing)-------## What's Working Well β--| Area | Assessment |-|------|-----------|-| **Architecture** | Clean multi-module design (app/data/domain/player) with proper dependency direction |-| **Credential Security** | AES-GCM with Android Keystore, PBKDF2 PIN hashing β industry standard |-| **Input Validation** | Comprehensive sanitization and URL security policy |-| **SQL Security** | All Room queries parameterized; FTS search properly escaped |-| **Localization** | 25+ languages, full RTL support, all strings externalized |-| **Streaming Protocol** | HLS, DASH, RTSP, MPEG-TS, Progressive all supported |-| **UI Foundation** | Netflix-style design with hero banners, shimmer loading, focus management |-| **Sync System** | WorkManager-based, exponential backoff retry, batch processing |-| **Database Migrations** | 13 versioned migrations with no destructive fallback |-| **PiP Support** | Picture-in-picture properly integrated with lifecycle |-| **Multi-View** | Thermal-aware multi-stream playback with performance monitoring |diff --git a/docs/audit/01_CRITICAL_ISSUES.md b/docs/audit/01_CRITICAL_ISSUES.mddeleted file mode 100644index 46aa3e51..00000000--- a/docs/audit/01_CRITICAL_ISSUES.md+++ /dev/null@@ -1,241 +0,0 @@-# StreamVault Pre-Release Audit: Critical & High Issues--> **Audit Date:** March 17, 2026-> **Scope:** Full codebase review across all 4 modules (app, data, domain, player)-> **Verdict:** App has a strong architectural foundation but has several critical items that must be resolved before production release.-------## CRITICAL-1: Dead Code β ~2,300 Lines of Unreachable Code in Movies & Series Screens--**Files:**-- `app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt` (Line 192)-- `app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt` (Line 192)--**Description:**-Both `MoviesScreen.kt` (1,342 lines) and `SeriesScreen.kt` (1,364 lines) contain a `return@AppScreenScaffold` at line 192, making everything after that line completely unreachable. This means:-- The full category sidebar with search/filter/reorder functionality (~300+ lines each) is dead code-- Category browsing, library lens navigation (top-rated, fresh, continue-watching), and reorder features are non-functional-- Approximately **1,150 + 1,172 = 2,322 lines** of dead code--**Impact:** Major feature set (VOD category management) is silently broken. Users cannot browse movies/series by category through the sidebar.--**Action:** Either remove the `return@AppScreenScaffold` to restore the feature, or delete the dead code if the new approach (before the return) fully replaces it.-------## CRITICAL-2: Non-Functional UI Elements β 8 Empty onClick Handlers--**Files:**-- `MoviesScreen.kt` β Lines 951, 961, 971, 1152-- `SeriesScreen.kt` β Lines 983, 993, 1003, 1174--**Description:**-Eight `VodActionChip` components display data (counts, labels) but have `onClick = { }` β they do nothing when clicked. These include:-- "Continue Watching" lens chips (show item count but don't navigate)-- "Top Rated" lens chips (show pick count but don't filter)-- "Fresh Movies/Series" lens chips (show count but don't filter)-- Selected category display chips (show title count but don't open category)--**Impact:** Users see interactive-looking chips that respond visually to focus but perform no action. This is a broken UX for a premium app.--**Action:** Implement the lens navigation logic (scroll to section, filter content, etc.) or remove the chips entirely.-------## CRITICAL-3: Thread Safety β XmltvParser SimpleDateFormat Race Condition--**File:** `data/src/main/java/com/streamvault/data/parser/XmltvParser.kt` (Line ~30)--**Description:**-```kotlin-private val dateFormats = listOf(- SimpleDateFormat("yyyyMMddHHmmss Z", Locale.US),- SimpleDateFormat("yyyyMMddHHmmss", Locale.US),-).onEach { it.timeZone = TimeZone.getTimeZone("UTC") }-```-`SimpleDateFormat` is not thread-safe. These shared instances are reused across parsing calls without cloning. If concurrent EPG parsing triggers simultaneous date parsing, data corruption or crashes can occur.--**Impact:** Potential crashes, corrupted EPG data, or wrong program times under concurrent load.--**Action:** Clone each `SimpleDateFormat` before use, or migrate to `java.time.format.DateTimeFormatter` (thread-safe by design).-------## CRITICAL-4: Race Condition β Concurrent EPG Sync Can Corrupt Data--**File:** `data/src/main/java/com/streamvault/data/repository/EpgRepositoryImpl.kt` (Lines 113-149)--**Description:**-EPG sync uses a staging provider ID (`-providerId`) for temporary storage during download. If two syncs run concurrently for the same provider:-1. Both use the same staging ID (`-providerId`)-2. Second sync overwrites the first sync's staged data-3. Final transaction can commit mixed/incomplete data--EPG parsing can take 30+ seconds, creating a large timing window.--**Impact:** Corrupted EPG data β wrong programs displayed for channels.--**Action:** Add a per-provider sync mutex/lock, or use unique staging IDs per sync operation.-------## CRITICAL-5: Race Condition β Favorite Position Collision--**File:** `data/src/main/java/com/streamvault/data/repository/FavoriteRepositoryImpl.kt` (Line ~102)--**Description:**-```kotlin-val maxPos = favoriteDao.getMaxPosition(groupId) ?: -1-val favorite = Favorite(position = maxPos + 1, ...)-```-Position lookup and insert are not atomic. Two concurrent `addFavorite()` calls can get the same `maxPos` value, resulting in duplicate positions.--**Impact:** Favorites list ordering breaks; items overlap in display.--**Action:** Wrap in a Room `@Transaction`, or use `INSERT ... SELECT MAX(position)+1`.-------## HIGH-1: Hardcoded Colors Outside Theme System β MultiViewScreen--**File:** `app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.kt`--**Description:**-8+ hardcoded hex color values bypass the `AppColors` theme system:-- `Color(0xFF555555)` β Gray placeholder (Γ2)-- `Color(0xFFFF5252)` β Red error (Γ2)-- `Color(0xFFFFC107)` β Amber blocked (Γ1)-- `Color(0xFFFFE082)` β Light amber reason (Γ1)-- `Color(0xFF4CAF50)` β Green status (referenced)-- `Color.Black.copy(alpha=...)` β Semi-transparent overlays (Γ2)--**Impact:** Theming/rebranding is inconsistent; these colors won't adapt to any future light/dark theme changes.--**Action:** Replace with `AppColors` semantic tokens (e.g., `AppColors.ErrorColor`, `AppColors.Warning`, `AppColors.TextSecondary`).-------## HIGH-2: Hardcoded Colors β DashboardScreen Shortcuts--**File:** `app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt` (Lines ~351-353)--**Description:**-`DashboardShortcutType` uses hardcoded colors:-- `0xFFFFC857` (Favorites)-- `0xFF4FD1C5` (Recent)-- `0xFF60A5FA` (Last Group)--**Action:** Map to `AppColors` tokens.-------## HIGH-3: Missing Android TV Platform Integration--**Description:**-Several expected Android TV platform features are completely absent:--| Feature | Status | Impact |-|---------|--------|--------|-| **Voice Search** (SearchManager / ACTION_ASSIST) | β Not implemented | Users can't search by voice on the home screen |-| **Watch Next** (TvProvider integration) | β Not implemented | App doesn't appear in the TV home screen's "Watch Next" row |-| **Recommendation Channels** | β Not implemented | No content surfaces on the Android TV launcher |-| **TV Input Framework** (TvInputService) | β Not implemented | App can't integrate with the system TV guide |-| **Chromecast/Cast Support** | β Not implemented | Can't cast to other devices |--**Impact:** These are differentiators for a premium TV app. Watch Next and recommendations especially drive engagement by surfacing content on the Android TV home screen.--**Action:** Prioritize Watch Next integration and voice search as minimum requirements for a premium TV experience.-------## HIGH-4: Parental Control β In-Memory Only, No Persistence--**File:** `domain/src/main/java/com/streamvault/domain/manager/ParentalControlManager.kt`--**Description:**-`ParentalControlManager` stores unlocked categories in memory only:-- State is lost on app restart, process kill, or activity recreation-- No integration with a repository for persistence-- No unlock expiration/timeout (once unlocked, stays unlocked until process dies)-- No brute-force protection (no attempt tracking or lockout)--**Impact:** Users must re-enter PIN on every app launch for every locked category. No protection against PIN guessing.--**Action:**-1. Add session-scoped persistence (encrypted preferences with TTL)-2. Implement attempt tracking with lockout (e.g., 5 attempts β 15 min lockout)-3. Add configurable unlock timeout (e.g., 30 min auto-relock)-------## HIGH-5: ConcurrentHashMap Check-Then-Act Race in SeriesRepository--**File:** `data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt` (Lines ~32-39)--**Description:**-```kotlin-private val xtreamProviderCache = ConcurrentHashMap<Long, CachedXtreamProvider>()--private fun getOrCreateXtreamProvider(...): XtreamProvider {- val cached = xtreamProviderCache[providerId]- if (cached != null && cached.signature == signature) return cached.provider- // Both threads can reach here simultaneously- return XtreamProvider(...).also {- xtreamProviderCache[providerId] = CachedXtreamProvider(...)- }-}-```-The check-then-act pattern is not atomic despite using `ConcurrentHashMap`.--**Impact:** Multiple unnecessary XtreamProvider creations; wasted CPU on password decryption.--**Action:** Use `ConcurrentHashMap.computeIfAbsent()` or add a synchronized block.-------## HIGH-6: SyncManager State Race β Multi-Provider Sync Overwrites Status--**File:** `data/src/main/java/com/streamvault/data/sync/SyncManager.kt` (Line ~64)--**Description:**-A single `_syncState` StateFlow is shared across all provider syncs. When syncing multiple providers concurrently:-1. Provider A starts β state = `Syncing("Live TV...")`-2. Provider B starts β state = `Syncing("Movies...")` (overwrites A's status)-3. Provider A finishes β state = `Success` (but B is still running)--**Impact:** UI shows incorrect sync status; user thinks sync is complete when it isn't.--**Action:** Track per-provider sync state, or serialize provider syncs.-------## HIGH-7: CredentialCrypto Silent Failure on Decryption--**File:** `data/src/main/java/com/streamvault/data/security/CredentialCrypto.kt`--**Description:**-When decryption fails (corrupted data, key rotation, device factory reset), the method returns an empty string silently. No warning is shown to the user that their credentials need re-entry.--**Impact:** User experiences mysterious login failures without understanding the cause.--**Action:** Return a `Result` type or throw a specific exception that the UI can translate to "Please re-enter your credentials."-------## HIGH-8: Network Error Classification β JSON vs Network vs Auth Errors--**File:** `data/src/main/java/com/streamvault/data/remote/xtream/OkHttpXtreamApiService.kt` (Line ~36)--**Description:**-```kotlin-private suspend inline fun <reified T> get(endpoint: String): T {- // ...- json.decodeFromString<T>(body) // Could throw JsonException-}-```-All failures (network timeout, HTTP 401/403 auth errors, malformed JSON) are treated as generic `IOException`. The retry logic (`SyncManager.retryTransient`) then retries non-retryable errors like authentication failures.--**Impact:** Wasted retries on auth errors; wrong error messages shown to users.--**Action:** Catch and classify errors separately: network (retryable), auth (non-retryable), parsing (non-retryable).diff --git a/docs/audit/02_SECURITY_REVIEW.md b/docs/audit/02_SECURITY_REVIEW.mddeleted file mode 100644index fbf7981a..00000000--- a/docs/audit/02_SECURITY_REVIEW.md+++ /dev/null@@ -1,149 +0,0 @@-# StreamVault Pre-Release Audit: Security Review--> **Audit Date:** March 17, 2026-> **Focus:** OWASP Top 10, credential handling, network security, data protection-------## Overview--The app demonstrates strong security fundamentals (AES-GCM credential encryption, PBKDF2 PIN hashing, input sanitization). However, several gaps must be addressed for production hardening.-------## SEC-1: No Certificate Pinning [MEDIUM-HIGH]--**Location:** `app/src/main/java/com/streamvault/app/di/NetworkModule.kt`--**Description:**-OkHttp client accepts any CA-signed certificate. No certificate pinning is configured for any connections.--**Risk:** Man-in-the-middle attacks on Xtream API login requests could intercept credentials even over HTTPS.--**Recommendation:**-Certificate pinning for IPTV providers is complex (providers use many different servers/domains) but at minimum the app should:-1. Log certificate fingerprints on first connection-2. Warn users if a certificate changes unexpectedly-3. Consider Trust-on-First-Use (TOFU) model-------## SEC-2: Global Cleartext HTTP Permitted [MEDIUM]--**Location:** `app/src/main/res/xml/network_security_config.xml`--```xml-<base-config cleartextTrafficPermitted="true">-```--**Description:**-HTTP traffic is permitted globally. While necessary for IPTV stream URLs (many providers use HTTP), this means API/control traffic could also use HTTP in edge cases.--**Current Mitigation:** `UrlSecurityPolicy.validateXtreamServerUrl()` enforces HTTPS for Xtream API URLs.--**Recommendation:**-The mitigation is adequate for Xtream, but document clearly why cleartext is globally enabled and ensure all non-stream network calls enforce HTTPS at the code level.-------## SEC-3: Database Not Encrypted at Rest [MEDIUM]--**Location:** `data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt`--**Description:**-Room database is stored as plaintext SQLite. While credentials are encrypted separately via `CredentialCrypto`, the database still contains:-- Provider server URLs and usernames (in the providers table)-- Complete channel/movie/series catalogs-- Viewing history and favorites-- Parental control category flags--**Recommendation:**-Consider SQLCipher integration for database-level encryption. Evaluate trade-off against performance impact (SQLCipher adds ~5-15% overhead).-------## SEC-4: PIN Stored as String in Memory [LOW]--**Location:** `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt`--**Description:**-Parental control PIN is received as `String` parameter and processed through PBKDF2. While hashing is correct (120k iterations, random salt), the PIN string itself remains in JVM heap memory until garbage collected.--**Recommendation:**-Accept `CharArray` instead of `String`, zero it after hashing. Low risk on Android TV (physical access needed), but best practice.-------## SEC-5: No Key Rotation Mechanism [LOW]--**Location:** `data/src/main/java/com/streamvault/data/security/CredentialCrypto.kt`--**Description:**-The encryption key (`KEY_ALIAS = "streamvault_credentials"`) has no rotation mechanism. If the Android Keystore is compromised, all stored credentials remain exposed until the user manually re-enters them.--**Recommendation:**-Add a key rotation function that re-encrypts all credentials with a new key, triggered periodically or on security events.-------## SEC-6: GSON Reflection Still in Use [LOW]--**Location:** `gradle/libs.versions.toml`, various DTO classes--**Description:**-GSON uses runtime reflection for (de)serialization, which:-1. Can bypass ProGuard obfuscation if rules aren't perfectly configured-2. Exposes class structure at runtime-3. Conflicts with the app's shift to `kotlinx.serialization` (used in `OkHttpXtreamApiService`)--**Recommendation:**-Complete migration from GSON to `kotlinx.serialization` for consistency and better obfuscation support.-------## SEC-7: HTTP Logging Could Leak Sensitive Data [LOW]--**Location:** `app/src/main/java/com/streamvault/app/di/NetworkModule.kt`--**Description:**-`HttpLoggingInterceptor` is configured at `BASIC` level in releases, which logs URLs. Xtream API URLs contain credentials in query parameters (`username`, `password`).--**Current Mitigation:** `XtreamUrlFactory.sanitizeLogMessage()` is used. Verify it covers all code paths.--**Recommendation:**-Ensure `sanitizeLogMessage()` is applied to ALL OkHttp logging, not just explicit calls. Consider stripping query parameters entirely from logs.-------## SEC-8: Missing CI/CD Security Pipeline [MEDIUM]--**Location:** `.github/workflows/android.yml`--**Description:**-The CI/CD pipeline runs only `assembleDebug` and unit tests. Missing:-- Secret scanning (TruffleHog or similar)-- Dependency vulnerability scanning (OWASP dependency-check)-- Lint security checks-- Release build validation with ProGuard-- Code coverage reporting--**Recommendation:**-Add security-focused CI steps before first production release.-------## Security Strengths β--The following security practices are well-implemented:--| Feature | Implementation | Assessment |-|---------|---------------|------------|-| **Credential Encryption** | AES-256-GCM with Android Keystore, randomized 12-byte IV | Excellent |-| **PIN Hashing** | PBKDF2-SHA256, 120k iterations, 16-byte random salt | Industry standard |-| **Legacy PIN Migration** | Auto-migrates plaintext PIN to hashed on next verify | Good hygiene |-| **Input Sanitization** | `ProviderInputSanitizer` enforces length limits, removes control chars | Solid |-| **URL Validation** | `UrlSecurityPolicy` validates scheme, checks CRLF injection | Comprehensive |-| **SQL Injection Prevention** | Room parameterized queries throughout; FTS queries properly escaped | Excellent |-| **Manifest Permissions** | Minimal: INTERNET + NETWORK_STATE only | Best practice |-| **Backup Prevention** | `android:allowBackup="false"` | Correct for security-sensitive app |-| **Xtream URL Sanitization** | Credentials stripped from log output | Good practice |diff --git a/docs/audit/03_ARCHITECTURE_QUALITY_PERFORMANCE.md b/docs/audit/03_ARCHITECTURE_QUALITY_PERFORMANCE.mddeleted file mode 100644index d1922fb0..00000000--- a/docs/audit/03_ARCHITECTURE_QUALITY_PERFORMANCE.md+++ /dev/null@@ -1,281 +0,0 @@-# StreamVault Pre-Release Audit: Architecture, Code Quality & Performance--> **Audit Date:** March 17, 2026-> **Focus:** Patterns, redundancy, performance, magic numbers, architectural inconsistencies-------## 1. Magic Numbers β No Centralized Configuration--**Severity:** MEDIUM-**Scope:** Entire codebase--Dozens of numeric constants are scattered inline across files with no centralized configuration. This makes tuning and debugging difficult.--### Player Module-| Value | File | Purpose |-|-------|------|---------|-| `30,000 ms` | Media3PlayerEngine.kt | Min buffer duration |-| `60,000 ms` | Media3PlayerEngine.kt | Max buffer duration |-| `2,500 ms` | Media3PlayerEngine.kt | Playback buffer |-| `5,000 ms` | Media3PlayerEngine.kt | Rebuffer buffer |-| `10 s` | Media3PlayerEngine.kt | OkHttp connect timeout |-| `15 s` | Media3PlayerEngine.kt | OkHttp read timeout |-| `250 ms` | Media3PlayerEngine.kt | Position polling interval |-| `1,500 ms` | Media3PlayerEngine.kt | Bandwidth stats interval |-| `MAX_RETRIES = 3` | Media3PlayerEngine.kt | Retry limit |-| `2,000 ms` | Media3PlayerEngine.kt | Retry base delay |-| `0.2f` | Media3PlayerEngine.kt | Audio ducking ratio (20%) |-| `1280Γ720` | Media3PlayerEngine.kt | Multi-view resolution cap |--### Data Module-| Value | File | Purpose |-|-------|------|---------|-| `30 s` | NetworkTimeoutConfig.kt | Connect/read/write timeout |-| `200 MB` | EpgRepositoryImpl.kt | Max EPG file size |-| `1 hour` | EpgRepositoryImpl.kt | EPG lookback window |-| `2 hours` | EpgRepositoryImpl.kt | EPG lookahead window |-| `60 s` | EpgRepositoryImpl.kt | EPG refresh interval |-| `1,000` | SyncManager.kt | M3U batch size |-| `500` | EpgRepositoryImpl.kt | EPG batch size |-| `3 / 700ms` | SyncManager.kt | Retry attempts / initial delay |-| `120,000` | PreferencesRepository.kt | PBKDF2 iterations |--### App Module-| Value | File | Purpose |-|-------|------|---------|-| `0.15` | StreamVaultApp.kt | Image cache memory ratio |-| `100 MB` | StreamVaultApp.kt | Image disk cache size |-| `6` / `4` | StreamVaultApp.kt | Coroutine parallelism limits |-| `64` / `10` | NetworkModule.kt | OkHttp max requests / per-host |-| `120 ms` | HomeViewModel.kt | Debounce interval |-| `150 ms` / `200 ms` / `500 ms` | Various dialogs | Focus delay magic numbers |-| `30 s` | Cards.kt | EPG progress bar tick rate |-| `1,000 ms` | SkeletonLoader.kt | Shimmer animation duration |--### Recommendation-Create a `ConfigConstants.kt` object in each module or a shared config:-```kotlin-object PlayerConfig {- const val MIN_BUFFER_MS = 30_000L- const val MAX_BUFFER_MS = 60_000L- const val PLAYBACK_BUFFER_MS = 2_500L- // ...-}-```-------## 2. State Management Fragmentation in UI Screens--**Severity:** MEDIUM-**Files:** HomeScreen.kt, SettingsScreen.kt, MoviesScreen.kt, SeriesScreen.kt--**Description:**-Dialog state management uses multiple independent boolean flags instead of a sealed class:-```kotlin-// Current pattern (HomeScreen):-uiState.showPinDialog-uiState.showDeleteGroupDialog-uiState.showRenameGroupDialog-uiState.showCategoryOptionsDialog-uiState.showMultiViewPlannerDialog-uiState.selectedCategoryForOptions-```--This leads to:-- Risk of multiple dialogs being open simultaneously-- Complex conditional logic to manage transitions-- Difficult to trace dialog state flow--**Recommendation:**-Use a sealed class for dialog state:-```kotlin-sealed class DialogState {- object None : DialogState()- data class PinEntry(val pendingAction: PendingAction) : DialogState()- data class CategoryOptions(val categoryId: Long) : DialogState()- data class RenameGroup(val groupId: Long, val currentName: String) : DialogState()- // ...-}-```-------## 3. Focus Management β Brittle Exception Swallowing--**Severity:** MEDIUM-**Files:** PlayerScreen.kt, PlayerControlsChrome.kt, RenameGroupDialog.kt, PinDialog.kt--**Description:**-Multiple locations use the pattern:-```kotlin-try { focusRequester.requestFocus() } catch (_: Exception) {}-```--This silently swallows all exceptions including unexpected ones. At least 8 instances across the codebase.--**Recommendation:**-1. Catch only `IllegalStateException` (the expected failure when FocusRequester isn't attached)-2. Log at debug level for diagnostics:-```kotlin-try {- focusRequester.requestFocus()-} catch (e: IllegalStateException) {- Log.d(TAG, "Focus request failed: ${e.message}")-}-```-------## 4. Inconsistent Error Handling Patterns Across Repositories--**Severity:** MEDIUM-**Scope:** `domain/src/main/java/com/streamvault/domain/repository/`--**Description:**-Repository interfaces are inconsistent about whether methods return `Result<T>` or throw exceptions:--| Repository | Returns Result | Throws Exceptions | Returns Flow |-|-----------|---------------|-------------------|-------------|-| ProviderRepository | `addProvider`, `deleteProvider` | - | `getProviders` |-| ChannelRepository | `refreshChannels` | - | `getChannels`, `searchChannels` |-| EpgRepository | `refreshEpg` | - | `getProgramsForChannel` |-| PlaybackHistoryRepository | - | `recordPlayback` (suspend) | `getRecentlyWatched` |-| CategoryRepository | - | `setCategoryProtection` (suspend) | `getCategories` |--Some suspend functions return `Result<T>`, others return raw values and rely on callers to catch exceptions.--**Recommendation:**-Standardize: all mutation operations return `Result<T>`, all query operations return `Flow<T>`.-------## 5. Deprecated Methods Not Cleaned Up--**Severity:** LOW-**Files:** ChannelRepository.kt, MovieRepository.kt, SeriesRepository.kt--**Description:**-`getStreamUrl()` is deprecated in favor of `getStreamInfo()` but still exists with a default implementation that wraps the new method. These deprecated methods add confusion and code surface area.--**Recommendation:**-Remove deprecated methods in a release cleanup since all callers should be using `getStreamInfo()` by now.-------## 6. Performance β Offset-Based Pagination--**Severity:** LOW-**Files:** MovieRepositoryImpl.kt, SeriesRepositoryImpl.kt (DAO queries)--**Description:**-Paginated queries use `LIMIT/OFFSET`, which requires scanning all prior rows for each page:-- Page 1: Scans 0 rows, returns 50-- Page 100: Scans 4,950 rows, returns 50--With providers offering 50k-100k movies, deep pagination becomes increasingly slow.--**Current Reality:** Users rarely browse past page 10-20. Not a blocking issue.--**Future Optimization:** Consider keyset/cursor-based pagination for large catalogs.-------## 7. Performance β EPG Progress Bar Tick Rate--**Severity:** LOW-**File:** `app/src/main/java/com/streamvault/app/ui/components/Cards.kt`--**Description:**-Channel cards update EPG progress every 30 seconds via `delay(30_000)`. With many visible channels, this creates periodic recomposition waves.--**Recommendation:**-Only run the timer for visible cards (LazyList already helps with this, but verify with profiling).-------## 8. Performance β Channel Grouping In-Memory--**Severity:** LOW-**File:** `data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt`--**Description:**-Channel grouping creates full in-memory maps:-```kotlin-entities.groupBy { channelGroupKey(it) }- .values.map { group ->- group.sortedWith(compareBy({ it.errorCount }, { it.name.length }))- }-```--With 10k+ channels per provider, this creates significant temporary allocations.--**Recommendation:**-Accept for now; optimize with database-side grouping if profiling shows issues.-------## 9. Missing Database Indexes--**Severity:** LOW-**File:** `data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt`--**Missing indexes that could improve query performance:**--| Table | Missing Index | Affected Query |-|-------|--------------|----------------|-| Programs | `(provider_id, start_time, end_time)` | Broad EPG time-window queries |-| Categories | `(provider_id, type)` | Category type filtering |-| Virtual Groups | `content_type` | Favorites by content type |--**Recommendation:**-Add these indexes in the next database migration.-------## 10. ProGuard β Incomplete Protection Rules--**Severity:** LOW-**File:** `app/proguard-rules.pro`--**Description:**-ProGuard rules are well-written but missing explicit protection for:-- `CredentialCrypto` internal class names (could break Keystore alias lookup if reflection used)-- OkHttp certificate validator implementations--**Current Reality:** This likely works fine with standard R8-defaults. Test a release APK to verify.-------## 11. Compose TV Alpha Dependency--**Severity:** MEDIUM-**File:** `gradle/libs.versions.toml`--**Description:**-`androidx.tv:tv-material` is at version `1.0.0-alpha12` β still in alpha. Breaking API changes are possible with updates.--**Risk:** Future updates may require migration effort. Alpha APIs may have bugs or performance issues.--**Recommendation:**-Pin the version and only update after thorough testing. Document which specific alpha APIs are in use for future migration planning.-------## 12. Accessibility Gaps for Android TV--**Severity:** MEDIUM-**Scope:** Entire UI layer--| Feature | Status | Impact |-|---------|--------|--------|-| **Content descriptions** | β Good coverage | Most interactive elements labeled |-| **High contrast mode** | β Not implemented | Low-vision users can't distinguish focus |-| **Reduced motion** | β Not implemented | Shimmer animations can be problematic |-| **Text size configuration** | β Not implemented | Fixed text sizes throughout |-| **Screen reader navigation** | β οΈ Partial | Focus system works but no TalkBack testing documented |-| **Focus ring visibility** | β οΈ Borderline | 3dp border may be too faint on large displays |--**Recommendation:**-At minimum, respect `Settings.Global.ANIMATOR_DURATION_SCALE` for reduced motion, and test with TalkBack enabled.diff --git a/docs/audit/04_MISSING_FEATURES_COMPLETENESS.md b/docs/audit/04_MISSING_FEATURES_COMPLETENESS.mddeleted file mode 100644index f1c42092..00000000--- a/docs/audit/04_MISSING_FEATURES_COMPLETENESS.md+++ /dev/null@@ -1,271 +0,0 @@-# StreamVault Pre-Release Audit: Missing Features & Completeness--> **Audit Date:** March 17, 2026-> **Focus:** Missing functionality, partial implementations, feature gaps for a premium IPTV player-------## 1. Player Module β Missing Premium Features--### 1.1 No Quality/Bitrate Selection [HIGH]--**Current:** Player uses Media3's default adaptive bitrate selection with no user control.-**Expected:** Premium IPTV players allow users to:-- View available quality options (Auto, 1080p, 720p, 480p, etc.)-- Lock to a specific quality-- Set quality preferences per network type (WiFi vs Ethernet)--**Implementation Path:** Use `DefaultTrackSelector.parameters.setMaxVideoSize()` with user preference. The `constrainResolutionForMultiView` boolean already demonstrates this capability.--### 1.2 No Playback Speed Control [MEDIUM]--**Current:** No speed controls exposed.-**Expected:** 0.5x, 0.75x, 1x, 1.25x, 1.5x, 2x for VOD content.-**Implementation Path:** `ExoPlayer.setPlaybackParameters(PlaybackParameters(speed))` β trivial to add.--### 1.3 No Audio Track Language Auto-Selection [MEDIUM]--**Current:** Audio track can be selected manually but doesn't default to user's locale.-**Expected:** Auto-select audio track matching device/app language.-**Implementation Path:** Use `DefaultTrackSelector.Parameters.setPreferredAudioLanguage()`.--### 1.4 No Subtitle Styling [LOW]--**Current:** Subtitle track can be toggled but styling (size, color, background) is not configurable.-**Expected:** Standard TV apps allow subtitle customization per accessibility requirements.--### 1.5 No Stream Failover [MEDIUM]--**Current:** `Channel.alternativeStreams` exists as `List<String>` but the player doesn't use it.-**Expected:** When primary stream fails, automatically try alternative stream URLs.-**Implementation Path:** On `PlayerError.NetworkError`, try next URL from `alternativeStreams` before showing error.--### 1.6 No Seek Thumbnails / Trick Play [LOW]--**Current:** Seek bar shows position but no visual preview.-**Expected:** Premium players show thumbnails while scrubbing for VOD content.--### 1.7 No DRM Support [LOW for IPTV]--**Current:** No Widevine, PlayReady, or ClearKey DRM scaffolding.-**Expected:** Some premium IPTV providers use DRM-protected streams.-**Note:** Most IPTV providers don't use DRM. Lower priority unless targeting premium content providers.-------## 2. Domain Module β Severely Underdeveloped Use Case Layer--### 2.1 Only 1 Use Case Exists [HIGH]--**Current:** `GetCustomCategories` is the only use case in the entire domain layer.-**Expected:** A well-architected app should have 15-25+ use cases encapsulating business logic.--**Critical missing use cases:**--| Use Case | Purpose |-|----------|---------|-| `SearchContent` | Cross-provider, cross-content-type search |-| `GetContinueWatching` | Smart resume list with series awareness |-| `MarkAsWatched` | Explicit watched marking with progress threshold |-| `ValidateAndAddProvider` | Full validation β login β sync orchestration |-| `SyncProvider` | Orchestrated sync with progress and error handling |-| `GetRecommendations` | Based on watch history and favorites |-| `ScheduleRecording` | With conflict detection and storage checks |-| `ExportBackup` / `ImportBackup` | With encryption and conflict resolution |-| `UnlockParentalCategory` | PIN validation with attempt tracking |--**Impact:** Business logic is spread across ViewModels and repositories instead of being centralized in testable use cases.--### 2.2 Domain Models Missing Fields [MEDIUM]--| Model | Missing Field | Purpose |-|-------|--------------|---------|-| `Program` | `rating` | Content rating (PG-13, R, etc.) |-| `Program` | `imageUrl` | Program thumbnail for EPG grid |-| `Program` | `genre` / `category` | EPG filtering by genre |-| `Channel` | `qualityOptions` | Available stream qualities |-| `StreamInfo` | `expirationTime` | Token-based stream URL expiry |-| `StreamInfo` | `drmInfo` | DRM license/config |-| `PlaybackHistory` | `watchedStatus` | Explicit watched vs auto-detected |-| `Provider` | `apiVersion` | Xtream API version compatibility |--### 2.3 Backup Data Incomplete [MEDIUM]--**File:** `domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt`--`BackupData` is missing:-- Parental control PIN (critical β lost on restore)-- Recording schedules-- Blocked channels/categories-- Playback preferences (quality, subtitle language)--### 2.4 Repository Interface Gaps--**Missing methods across repositories:**--| Repository | Missing Method | Purpose |-|-----------|---------------|---------|-| ChannelRepository | `getChannelsByNumber()` | EPG guides organize by channel number |-| ChannelRepository | `getChannelsWithoutErrors()` | Skip problematic streams |-| EpgRepository | `searchPrograms()` | Find programs across all channels |-| EpgRepository | `getProgramsByCategory()` | Category-based EPG browsing |-| MovieRepository | `getRecommendations()` | Based on watch history |-| MovieRepository | `getRelatedContent()` | Similar genre/cast |-| PlaybackHistoryRepository | `markAsWatched()` | Explicit watched marking |-| PlaybackHistoryRepository | `getUnwatchedCount()` | For series tracking |-| LibraryBrowseQuery | `sortBy` field | Name, date, rating, watch count |-| LibraryBrowseQuery | `filterBy` field | Unwatched, incomplete, language |-| LibraryBrowseQuery | `searchQuery` field | Combined search + browse |-------## 3. Data Module β Implementation Gaps--### 3.1 Watch Progress Inconsistency [MEDIUM]--**Description:**-Movie watch progress is duplicated between two locations:-- `movies.watch_progress` column (updated via `movieDao.updateWatchProgress()`)-- `playback_history.resume_position_ms` (updated during playback)--These can get out of sync. Episode watch progress in particular may show `watch_progress=0` in the episodes table while `playback_history` has a valid resume position.--**Action:** Single source of truth β either use playback_history exclusively, or add a sync mechanism.--### 3.2 Stale Favorite Cleanup Not Automated [MEDIUM]--**Description:**-`FavoriteRepositoryImpl` has methods to clean up favorites for deleted content:-- `deleteMissingLiveFavorites()`-- `deleteMissingMovieFavorites()`-- `deleteMissingSeriesFavorites()`--But these are **never called** by any visible code path. The `SyncWorker` β `DatabaseMaintenanceManager` chain doesn't seem to invoke them.--**Impact:** Favorites for deleted channels/movies/series remain in the database forever as orphaned entries.--**Action:** Wire cleanup methods into the maintenance worker or post-sync hook.--### 3.3 Xtream Expiration Date β Limited Format Support [LOW]--**File:** `data/src/main/java/com/streamvault/data/remote/xtream/XtreamProvider.kt`--Only 2 date formats are tried (`yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd`). Some Xtream providers use additional formats. Also missing timezone handling (assumes local time instead of UTC).--### 3.4 Search Results Not Ranked [LOW]--**Description:**-FTS4 search queries return results in arbitrary order. Room FTS4 doesn't provide ranking by default.--**Impact:** Search for "Sports" may show "Sports Bar" before "Sports Channel" with no relevance ordering.--**Recommendation:**-Consider adding a simple relevance heuristic (exact match first, prefix match second, contains match third).-------## 4. Test Coverage Gaps--### 4.1 Current Test Inventory--| Module | Unit Tests | Android Tests | Coverage Estimate |-|--------|-----------|---------------|-------------------|-| **domain** | 3 files (25 tests) | 0 | ~10% |-| **data** | 6 files | 3 files | ~25% |-| **app** | 4 files | 4 files | ~15% |-| **player** | 1 file (18 tests) | 0 | ~20% |-| **TOTAL** | **14 files** | **7 files** | **~15-20%** |--### 4.2 Critical Missing Tests--| Test Category | What's Missing | Priority |-|--------------|----------------|----------|-| **Security** | CredentialCrypto encrypt/decrypt, UrlSecurityPolicy validation, ProviderInputSanitizer bounds | HIGH |-| **Database Migrations** | Full v1βv13 data integrity verification | HIGH |-| **Error Paths** | Network failure handling, malformed data recovery, timeout behavior | HIGH |-| **Player Engine** | Playback lifecycle, error recovery, audio focus, track selection | MEDIUM |-| **ViewModels** | MoviesViewModel, SeriesViewModel, SettingsViewModel, PlayerViewModel | MEDIUM |-| **Repositories** | Full CRUD operations with edge cases | MEDIUM |-| **Integration** | Provider login β sync β display β playback end-to-end flow | LOW |-| **UI/Golden** | More composable snapshot tests for visual regression | LOW |--### 4.3 CI/CD Test Pipeline Issues--- `--continue` flag masks individual test failures-- No code coverage reporting (Jacoco)-- No release build testing-- No ProGuard/R8 validation for release APK-------## 5. Recording System β Interface vs Implementation Gaps--### 5.1 RecordingManager Implementation Exists β--The `RecordingManagerImpl` is fully implemented with:-- Manual recording start/stop-- Scheduled recording-- Storage state monitoring-- Active job management--### 5.2 Missing Recording Features [LOW]--| Feature | Status |-|---------|--------|-| Recurring recordings (daily/weekly) | β Not implemented |-| Recording conflict detection | β Not implemented |-| Automatic storage cleanup | β Not implemented |-| Pause/resume recording | β Not implemented |-| Series recording rules | β Not implemented |-------## 6. Backup System β Interface vs Implementation Gaps--### 6.1 BackupManager Implementation Exists β--The `BackupManagerImpl` is fully implemented with:-- Export with checksum verification-- Import with conflict detection-- Version handling--### 6.2 Missing Backup Features [LOW]--| Feature | Status |-|---------|--------|-| Encrypted backup | β Not implemented |-| Cloud backup (Google Drive) | β Not implemented |-| Automatic scheduled backup | β Not implemented |-| Selective restore (only favorites, only providers, etc.) | β Not implemented |-------## 7. Localization Completeness--**Status:** β Well-implemented β 25+ languages supported via translation scripts.--All user-facing strings use `stringResource(R.string.*)`. Only non-localizable symbols (`+`, `!`, `β’`) are hardcoded.--**Note:** RTL support (Hebrew, Arabic) was implemented in Phase 5 with proper mirroring.-------## 8. Summary: Feature Readiness Matrix--| Feature Area | Readiness | Blocking? |-|-------------|-----------|-----------|-| Live TV Playback | 90% | No |-| VOD (Movies/Series) | 80% | **Yes** β dead code in category browsing |-| EPG Guide | 85% | No |-| Provider Management | 90% | No |-| Favorites & Groups | 85% | No |-| Parental Controls | 70% | **Yes** β in-memory only |-| Search | 75% | No |-| Multi-View | 80% | No |-| Settings | 85% | No |-| Player Controls | 75% | No β but missing quality selection |-| Recording | 60% | No β functional but basic |-| Backup/Restore | 70% | No β functional but missing PIN backup |-| Android TV Platform | 50% | **Yes** β missing Watch Next, voice search |-| Accessibility | 60% | No β functional but gaps |-| Test Coverage | 20% | **Yes** β too low for production confidence |