StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Remove internal dev notes, smoke scripts, and build logs
dev.salmontech3f24b74c7536
diff --git a/docs/download-feature-handoff.md b/docs/download-feature-handoff.mddeleted file mode 100644index e4a93603..00000000--- a/docs/download-feature-handoff.md+++ /dev/null@@ -1,75 +0,0 @@-# Download Feature Handoff--Date: 2026-05-26--## Current state--Download/offline playback is implemented for movies and individual series episodes. Download actions resolve an initial playable stream URL plus stable provider source metadata, enqueue a `DownloadRequest`, start the foreground notification service, capture stream bytes with OkHttp, persist progress/status in Room, and expose completed files from the Downloads tab.--LocalForge project `streamvalutfork` is back to completed with no follow-up backlog. The repair and final implementation were done manually after LocalForge completed its original 39 features.--## Key implementation paths--- `domain/src/main/java/com/streamvault/domain/model/DownloadModels.kt`-- `domain/src/main/java/com/streamvault/domain/repository/DownloadManager.kt`-- `data/src/main/java/com/streamvault/data/local/entity/DownloadEntity.kt`-- `data/src/main/java/com/streamvault/data/local/dao/DownloadDao.kt`-- `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt`-- `data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt`-- `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt`-- `app/src/main/java/com/streamvault/app/service/DownloadForegroundService.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/downloads/DownloadsScreen.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/downloads/DownloadsViewModel.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/movies/MovieDetailScreen.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/movies/MovieDetailViewModel.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.kt`-- `app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailViewModel.kt`-- `app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt`-- `app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt`-- `tools/smoke_download.ps1`--## Behavior summary--- Movie detail and series episode rows show a Download action.-- Downloads are stored in the user-selected SAF folder when configured.-- Without a selected SAF folder, downloads fall back to app external downloads storage under `Download/StreamVault`.-- `DownloadManagerImpl` captures bytes with OkHttp and updates `DownloadEntity` status/progress.-- `DownloadEntity` stores stable source metadata (`sourceStreamUrl`, `sourceStreamId`, `containerExtension`) so restarted downloads can resolve a fresh provider URL instead of reusing a stale one-time link.-- Downloads are FIFO and single-provider-stream by design.-- If provider-backed VOD playback starts during a download, the active capture coroutine and OkHttp call are cancelled, the active partial file is deleted, progress resets to zero, and the download waits until playback stops before restarting from byte 0 with a fresh URL.-- Playing a completed local download from `content://` or `file://` never pauses the queue, whether the file opens in StreamVault's internal player or an external player.-- `DownloadForegroundService` observes the active download row and updates notification text.-- Downloads tab lists rows, shows poster/status/progress/size, opens completed files via `ACTION_VIEW`, offers Resume for failed rows, and deletes both DB row and local output where possible.--## Verification completed--Commands run from repo root:--```powershell-./gradlew.bat :data:compileDebugKotlin :app:compileDebugKotlin --no-daemon --console=plain-powershell.exe -NoProfile -ExecutionPolicy Bypass -File tools/smoke_download.ps1-powershell.exe -NoProfile -ExecutionPolicy Bypass -File tools/smoke_external_playback.ps1-./gradlew.bat :app:assembleDebug --no-daemon --console=plain-```--Results:--- Data/app debug Kotlin compile: passed-- Download smoke: passed, `SUMMARY: 3/3 tests passed`-- External playback smoke: passed, `SUMMARY: 3/3 tests passed`-- Debug APK build: passed--Debug APK path:--```text-app/build/outputs/apk/debug/app-debug.apk-```--## Known gaps and next-session checks--- Manual device test still needed with a real provider stream: tap Download, verify notification/progress, verify completed item opens in an external/internal video handler, verify delete removes the file, verify provider playback pauses an active download and restarts it from 0 after playback stops.-- Process-death resume is not implemented. Active capture runs in application-scope coroutine plus foreground service observer; if Android kills the process, incomplete rows remain and should be retried or marked failed in a future feature.-- Pause UI is not implemented. Failed rows expose Resume, which deletes any partial output, resets progress, and restarts through the FIFO scheduler with fresh provider URL resolution.-- A row stuck in `DOWNLOADING` after provider playback usually indicates interruption handling failed before the active OkHttp call was cancelled. `DownloadManagerImpl` now tracks active calls and resets provider-playback interruptions back to `PAUSED` with zero bytes.-- The fallback app-external storage path is private to the app; use the Downloads screen to open files or choose a SAF folder for user-visible storage.-- Project-wide `:app:lintDebug` still fails from existing lint debt, including API-level/manifest/test/l10n issues. Compile, smoke, and debug assemble pass.diff --git a/docs/download-feature-plan.md b/docs/download-feature-plan.mddeleted file mode 100644index ffed32ef..00000000--- a/docs/download-feature-plan.md+++ /dev/null@@ -1,111 +0,0 @@-# Download Feature Plan — StreamVault--Created: 2026-05-26-Updated: 2026-05-26-Project: streamvalutfork (LocalForge project #6)-Status: implemented manually after LocalForge completion review-Features: 13 original LocalForge items (IDs 159–171), completed-Dependency chain: serial (159→160→...→171)--## User Requirements--- Download Movie/Series content to local phone storage-- Default folder: app external downloads storage under `Download/StreamVault`, user-configurable via SAF folder picker-- Download button next to Play and Copy URL on movie detail and per-episode rows-- Background download with progress tracking-- New "Downloads" top-level tab showing all downloaded content-- Downloads section: thumbnail grid, play local file, delete (removes file + DB record)-- Raw stream capture (same pattern as recording, no transcoding)--## Design Decisions--| Decision | Choice | Rationale |-|----------|--------|-----------|-| Download folder | Separate from recording | Independent config, default "Downloads" |-| Format | Raw stream (.ts) | Reuses capture engine pattern, no FFmpeg needed |-| Series scope | Per-episode only | Users download individual episodes, not full series |-| Navigation | New top-level tab | Most discoverable, consistent with Movies/Series tabs |-| Storage | Android SAF treeUri | Same proven pattern as recording folder |--## Architecture--### Data flow--```-User taps Download → ViewModel resolves URL (resolveCopyStreamUrl)- → creates DownloadRequest → DownloadManager.enqueueDownload()- → creates DownloadEntity (PENDING) → starts OkHttp capture coroutine- → streams to SAF output file or app external downloads fallback- → updates progress/status in Room → COMPLETED/FAILED/CANCELLED- → DownloadForegroundService observes Room state and shows notification-```--### New files--| Layer | File | Purpose |-|-------|------|---------|-| domain | `model/DownloadModels.kt` | DownloadStatus, DownloadContentType, DownloadItem, DownloadRequest, DownloadStorageConfig |-| domain | `repository/DownloadManager.kt` | Interface: observe, enqueue, cancel, delete, updateStorageConfig |-| data | `local/entity/DownloadEntity.kt` | Room entity for downloads table |-| data | `local/dao/DownloadDao.kt` | getAll, getById, getActive, insert, update, deleteById |-| data | `manager/DownloadManagerImpl.kt` | OkHttp stream capture to SAF/app external storage, progress tracking |-| app | `di/RepositoryModule.kt` | Hilt @Binds DownloadManager |-| app | `service/DownloadForegroundService.kt` | Background download with notification |-| app | `ui/screens/downloads/DownloadsScreen.kt` | Thumbnail grid, play, delete, folder picker |-| app | `ui/screens/downloads/DownloadsViewModel.kt` | State management, play/delete/folder actions |-| app | `ui/screens/downloads/DownloadsUiState.kt` | UI state model |-| tools | `smoke_download.ps1` | Compile verification script |--### Modified files--| File | Changes |-|------|---------|-| `StreamVaultDatabase.kt` | Add DownloadEntity, DownloadDao, bump v57→v58, migration |-| `DatabaseModule.kt` (or DI module) | Register migration |-| `PreferencesRepository.kt` | Add downloadTreeUri preference |-| `AndroidManifest.xml` | Register service, add permissions |-| `strings.xml` | 16 new string resources |-| `MovieDetailScreen.kt` | Add Download button in hero Row |-| `MovieDetailViewModel.kt` | Add downloadMovie() |-| `SeriesDetailScreen.kt` | Add Download button per EpisodeItem |-| `SeriesDetailViewModel.kt` | Add downloadEpisode() |-| `AppNavigation.kt` | Add DOWNLOADS route |-| `AppShell.kt` | Add Downloads tab to navigation |--## Feature breakdown--### Batch 1 — Data layer (159–163)--| ID | Title | Files |-|----|-------|-------|-| 159 | Download domain model + interface | `DownloadModels.kt` + `DownloadManager.kt` |-| 160 | Room entity + DAO | `DownloadEntity.kt` + `DownloadDao.kt` |-| 161 | DB registration + migration v57→v58 | `StreamVaultDatabase.kt` + DI module |-| 162 | DownloadManagerImpl + Hilt module | `DownloadManagerImpl.kt` + `DownloadModule.kt` |-| 163 | Download folder preference | `PreferencesRepository.kt` |--### Batch 2 — Service + UI integration (164–167)--| ID | Title | Files |-|----|-------|-------|-| 164 | String resources | `strings.xml` |-| 165 | ForegroundService + manifest | `DownloadForegroundService.kt` + `AndroidManifest.xml` |-| 166 | Download button on MovieDetailScreen | `MovieDetailScreen.kt` + `MovieDetailViewModel.kt` |-| 167 | Download button on SeriesDetailScreen | `SeriesDetailScreen.kt` + `SeriesDetailViewModel.kt` |--### Batch 3 — Downloads section (168–171)--| ID | Title | Files |-|----|-------|-------|-| 168 | Downloads tab + route | `AppNavigation.kt` + `AppShell.kt` |-| 169 | DownloadsViewModel + state | `DownloadsViewModel.kt` + `DownloadsUiState.kt` |-| 170 | DownloadsScreen composable | `DownloadsScreen.kt` |-| 171 | Smoke test script | `smoke_download.ps1` |--## Dependencies--```-159 → 160 → 161 → 162 → 163 → 164 → 165 → 166 → 167 → 168 → 169 → 170 → 171-```--Serial chain ensures each LocalForge session starts from a known-complete state.diff --git a/docs/downloads-polish-handoff.md b/docs/downloads-polish-handoff.mddeleted file mode 100644index 66fcf211..00000000--- a/docs/downloads-polish-handoff.md+++ /dev/null@@ -1,334 +0,0 @@-# Downloads Polish - Handoff Document--Created: 2026-05-27-Project: StreamVault (Android TV-first IPTV app)-Stack: Kotlin, Jetpack Compose, Hilt, Room, OkHttp, Media3-Base: current Downloads feature working baseline--## Overview--This handoff defines the next Downloads polish work. Scope has three features:--1. Show current download folder path in Downloads section.-2. Stack Download and Copy URL buttons vertically in Series episode rows.-3. Add smart download concurrency with resumable partial downloads.--Execution must be phased. Complete Phase 1 first, compile APK, commit, then proceed to Phase 2.--## Phase 1 - UI Polish--### Feature 1 - Show Current Download Folder Path--Goal: Downloads screen must show the currently active download folder path under the Change download folder button. When user changes folder with the SAF picker, displayed path must update without app restart.--Files:--| File | Purpose |-|------|---------|-| `app/src/main/java/com/streamvault/app/ui/screens/downloads/DownloadsScreen.kt` | Add folder path UI below button |--Current state:--- `DownloadsScreen.kt` has Change download folder button in the top area.-- `DownloadsViewModel` already observes `downloadManager.observeStorageState()`.-- `uiState.storageConfig` already contains `displayName` and `treeUri`.-- `observeStorageState()` updates after `onFolderSelected()` persists new SAF tree URI.--Implementation steps:--1. In `DownloadsScreen`, replace the top button-only row with a layout that can show button plus path text.-2. Keep Change download folder button visible in the same area.-3. Add text directly below the button.-4. Display text priority: `uiState.storageConfig.displayName`, then `uiState.storageConfig.treeUri`, then default folder label.-5. Use restrained styling: small body/label typography, tertiary text color, max 2 lines, ellipsis overflow.-6. Do not add new persistence for this feature. Existing storage state flow is enough.--Acceptance criteria:--- Downloads tab shows current folder path under Change download folder.-- If no folder has been selected, UI shows a default folder label instead of blank text.-- Selecting a new folder updates the displayed path immediately.-- Restarting app still shows persisted selected folder.--### Feature 2 - Stack Series Episode Buttons Vertically--Goal: In Series detail episode rows, Download and Copy URL buttons must remain on the right side of each episode row, but be stacked vertically. Download is on top. Copy URL is below.--Files:--| File | Purpose |-|------|---------|-| `app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.kt` | Update `EpisodeItem` button layout |--Current state:--- `EpisodeItem` uses a horizontal `Row`.-- Episode card takes `Modifier.weight(1f)`.-- Copy URL and Download buttons are currently siblings in the same `Row`, so they appear side-by-side.--Implementation steps:--1. In `EpisodeItem`, keep episode card unchanged.-2. Replace the two trailing button siblings with a `Column`.-3. Place Download button first in the column.-4. Place Copy URL button second in the column.-5. Preserve existing button click handlers.-6. Preserve existing button styling, especially Download button emphasis colors.-7. Keep the column in the same right-side slot of the existing row.--Acceptance criteria:--- Series episode row shows Download above Copy URL.-- Buttons remain right of the episode card.-- Download button still starts download.-- Copy URL button still copies episode URL.-- Layout works on compact and wide screens.--### Phase 1 Completion Gate--Do not proceed to Phase 2 until all items below are complete.--- [x] Feature 1 implemented.-- [x] Feature 2 implemented.-- [x] `./gradlew assembleDebug` succeeds from `projects/streamvalutfork`.-- [x] APK installs or smoke test passes if device/emulator is available. Skipped by user for this coding phase.-- [x] Commit created with message: `Polish Downloads UI`.--## Phase 2 - Smart Download Concurrency + Resumable Downloads--Feature 3 includes resumable partial downloads, queueing, provider concurrency auto-detection, playback coordination, and retry on connectivity restore.--### Feature 3a - Resumable Partial Downloads--Goal: Partial downloads are preserved on transient failure. When network or server connection resumes, download continues from last written byte instead of restarting. User can delete partial downloads from Downloads section with existing delete action.--Files:--| File | Purpose |-|------|---------|-| `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt` | Resume logic, Range headers, append mode, error classification |-| `data/src/main/java/com/streamvault/data/local/entity/DownloadEntity.kt` | Add resumability/retry fields |-| `data/src/main/java/com/streamvault/data/local/dao/DownloadDao.kt` | Queries for paused/retryable downloads |-| `domain/src/main/java/com/streamvault/domain/model/DownloadModels.kt` | Expose resumability/retry state in domain model |-| `domain/src/main/java/com/streamvault/domain/repository/DownloadManager.kt` | Add resume API |-| `data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt` | Room migration for new fields |--Current state:--- `DownloadManagerImpl.captureDownload()` starts each HTTP request from byte 0.-- On any non-cancellation error, entity becomes `FAILED`.-- Partial output file may remain on disk, but no code reuses it.-- Existing delete action deletes output and DB row; preserve this behavior.--Implementation steps:--1. Add `supportsResume: Boolean` to download entity and domain item.-2. Add `retryCount: Int` to download entity and domain item.-3. Add Room migration with default values: `supportsResume = false`, `retryCount = 0`.-4. Add `resumeDownload(id: String)` to `DownloadManager`.-5. In initial download response, detect `Accept-Ranges: bytes` and store `supportsResume`.-6. When resuming and `bytesWritten > 0`, add HTTP header `Range: bytes=<bytesWritten>-`.-7. When resuming and output URI exists, append to existing output instead of creating a new file.-8. For SAF output, use append mode: `contentResolver.openOutputStream(uri, "wa")`.-9. For regular file output, use append mode file stream.-10. If server replies `206 Partial Content`, continue append resume.-11. If server replies `200 OK` to a range request, treat server as non-resumable and restart from byte 0 safely.-12. On transient error, mark download `PAUSED`, preserve output URI/path and `bytesWritten`.-13. On permanent error, mark download `FAILED`.-14. On delete, keep current behavior: remove partial output file and DB row.--Transient errors:--- Network unavailable.-- Socket disconnect.-- Socket timeout.-- HTTP 5xx.-- VOD contention detected by scheduler.--Permanent errors:--- HTTP 400.-- HTTP 404.-- Invalid URL.-- Unrecoverable output creation failure.--Acceptance criteria:--- Network drop during download changes status to `PAUSED`, not `FAILED`.-- Partial file remains present.-- Resume continues from saved byte offset when server supports ranges.-- Resume safely restarts when server does not support ranges.-- Delete removes partial file and DB row.--### Feature 3b - Concurrency-Aware Download Scheduler--Goal: Downloads run through a scheduler that respects learned/provider stream capacity. Excess downloads queue instead of all starting immediately.--Files:--| File | Purpose |-|------|---------|-| `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt` | Queue, active stream tracking, slot management |-| `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt` | Persist max concurrent streams |-| `domain/src/main/java/com/streamvault/domain/repository/DownloadManager.kt` | Expose scheduler controls if needed |--Implementation steps:--1. Add persisted `maxConcurrentStreams` preference. Default: `2`.-2. Clamp `maxConcurrentStreams` to range `1..4`.-3. Track active stream count in `DownloadManagerImpl`. Count includes active downloads and active playback.-4. Replace direct fire-and-forget launch in `enqueueDownload()` with scheduler entry point.-5. If active count is below max, start download immediately.-6. If active count is at max, keep item `PENDING` and queue it.-7. When a download completes, pauses, fails permanently, or cancels, free its slot.-8. After freeing a slot, start next queued `PENDING` or `PAUSED` item.--Acceptance criteria:--- With max stream count 1, three downloads run serially.-- With max stream count 2, first two downloads run and third waits.-- Queued downloads show existing pending/paused status in Downloads screen.-- Cancelling or deleting active download starts next queued item.--### Feature 3c - Auto-Detect Provider Concurrency--Goal: App learns whether VOD provider allows parallel streams. It downgrades when contention is detected and upgrades after stable parallel success.--Files:--| File | Purpose |-|------|---------|-| `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt` | Collision detection, downgrade/upgrade logic |-| `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt` | Persist learned limit |--Implementation steps:--1. Start optimistic with `maxConcurrentStreams = 2` unless persisted value exists.-2. Treat HTTP 403 or HTTP 429 while another stream is active as probable VOD concurrency collision.-3. Treat connection reset during parallel activity as possible VOD concurrency collision only if network is otherwise available.-4. On collision, decrement `maxConcurrentStreams` by 1, minimum 1.-5. Persist downgraded value.-6. Mark failed/collided download `PAUSED` or `PENDING`, not `FAILED`.-7. If active downloads exceed new limit, pause most recently started downloads until active count fits limit.-8. Track consecutive successful parallel downloads.-9. After enough parallel success, increment `maxConcurrentStreams` by 1, maximum 4.-10. Reset success counter after any downgrade.--Acceptance criteria:--- Provider allowing one stream causes downgrade to 1 after collision.-- Collided download queues/resumes instead of failing permanently.-- Provider allowing multiple streams keeps or increases parallel limit after successful runs.-- Learned limit survives app restart.--### Feature 3d - Playback-Aware Coordination--Goal: Playback counts as an active VOD stream. If playback starts and provider limit would be exceeded, downloads pause and later resume automatically.--Files:--| File | Purpose |-|------|---------|-| `domain/src/main/java/com/streamvault/domain/repository/DownloadManager.kt` | Add playback lifecycle methods |-| `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt` | React to playback start/stop |-| Player screen/ViewModel integration point | Call playback lifecycle methods |--Implementation steps:--1. Add `onPlaybackStarted()` to `DownloadManager`.-2. Add `onPlaybackStopped()` to `DownloadManager`.-3. On playback start, increment active stream count.-4. If active count exceeds learned max, pause most recently started active download.-5. Paused download must keep partial file and byte offset.-6. On playback stop, decrement active stream count.-7. After playback stop, resume next queued/paused download if slot is available.-8. Wire calls from player lifecycle where playback actually starts/stops, not merely screen navigation.--Acceptance criteria:--- With max stream count 1, active download pauses when playback starts.-- Download resumes automatically when playback stops.-- With max stream count 2, one download plus one playback can run together.-- With max stream count 2 and two active downloads, starting playback pauses one download.--### Feature 3e - Auto-Retry On Connectivity Restore--Goal: Downloads paused due to network/server transient errors retry automatically when connection returns, with backoff for repeated failures.--Files:--| File | Purpose |-|------|---------|-| `data/src/main/java/com/streamvault/data/manager/DownloadManagerImpl.kt` | Connectivity callback and retry scheduling |-| `data/src/main/java/com/streamvault/data/local/entity/DownloadEntity.kt` | Retry count field |-| `data/src/main/java/com/streamvault/data/local/dao/DownloadDao.kt` | Query retryable paused downloads |--Implementation steps:--1. Register `ConnectivityManager.NetworkCallback` in `DownloadManagerImpl`.-2. On network available, query paused retryable downloads.-3. Resume retryable paused downloads through scheduler, not directly.-4. On transient error, increment `retryCount` and schedule exponential backoff.-5. Suggested backoff: 5s, 15s, 45s, then cap around 5 minutes.-6. On successful completion, reset `retryCount` to 0.-7. After max retries, mark `FAILED` and stop automatic retries.-8. Keep VOD contention separate from network retry. Contention waits for stream slot, not network callback.--Acceptance criteria:--- Airplane mode during download pauses download.-- Turning network back on resumes download automatically.-- Repeated failures increase retry delay.-- After max retry threshold, download becomes `FAILED`.-- User can delete failed or paused partial downloads.--## Phase 2 Completion Gate--Do not commit Phase 2 until all items below are complete.--- [x] Partial file preserved on transient failure.-- [x] Resume uses HTTP Range when supported.-- [x] Resume safely restarts if server does not support ranges.-- [x] Delete removes partial output and DB row.-- [x] Queue respects learned `maxConcurrentStreams`.-- [x] Provider contention downgrades concurrency.-- [x] Stable parallel success can upgrade concurrency.-- [x] Playback start pauses downloads when limit would be exceeded.-- [x] Playback stop resumes queued/paused downloads.-- [x] Connectivity restore resumes network-paused downloads.-- [x] `./gradlew assembleDebug` succeeds from `projects/streamvalutfork`.-- [x] APK installs or smoke test passes if device/emulator is available. Skipped by user for this coding phase.-- [x] Commit created with message: `Add smart resumable download scheduler`.--## Work Order--Use this exact sequence in the next session:--1. Implement Feature 1.-2. Implement Feature 2.-3. Run `./gradlew assembleDebug` from `projects/streamvalutfork`.-4. If build passes, commit Phase 1.-5. Implement Feature 3a.-6. Implement Feature 3b.-7. Implement Feature 3c.-8. Implement Feature 3d.-9. Implement Feature 3e.-10. Run `./gradlew assembleDebug` from `projects/streamvalutfork`.-11. Smoke test if device/emulator is available.-12. Commit Phase 2.--## Important Implementation Notes--- Do not mark transient download errors as `FAILED` unless retry budget is exhausted or error is clearly permanent.-- Do not delete partial files on pause, retry, or provider collision.-- Use existing delete button as the user-controlled cleanup path for partial files.-- All resume/retry work must go through scheduler so concurrency rules stay consistent.-- Playback stream and download streams must share the same active stream accounting.-- Keep UI changes in Phase 1 small and separate from scheduler work.--## Known Risks--- SAF append mode (`"wa"`) may vary by provider. Implement safe fallback: restart full download if append/resume cannot be guaranteed.-- Some VOD providers may return 403/429 for auth expiration, not concurrency. Error classification should check whether another stream is active before treating as contention.-- Some servers omit `Accept-Ranges` but still support ranges. Prefer response behavior (`206 Partial Content`) over header alone when deciding if resume works.-- Player lifecycle wiring must use actual playback start/stop signals, not only screen enter/exit, to avoid pausing downloads unnecessarily.diff --git a/final_narrow_compile.log b/final_narrow_compile.logdeleted file mode 100644index e4ceda26..00000000Binary files a/final_narrow_compile.log and /dev/null differdiff --git a/final_narrow_test1.log b/final_narrow_test1.logdeleted file mode 100644index 6ed07701..00000000Binary files a/final_narrow_test1.log and /dev/null differdiff --git a/final_narrow_test2.log b/final_narrow_test2.logdeleted file mode 100644index c3226aef..00000000Binary files a/final_narrow_test2.log and /dev/null differdiff --git a/gradle_runner_regression_rerun.log b/gradle_runner_regression_rerun.logdeleted file mode 100644index 44529686..00000000Binary files a/gradle_runner_regression_rerun.log and /dev/null differdiff --git a/gradle_runner_regression_test.log b/gradle_runner_regression_test.logdeleted file mode 100644index 32ebaa47..00000000Binary files a/gradle_runner_regression_test.log and /dev/null differdiff --git a/gradle_stalker_overlap_rerun.log b/gradle_stalker_overlap_rerun.logdeleted file mode 100644index 85f86c77..00000000Binary files a/gradle_stalker_overlap_rerun.log and /dev/null differdiff --git a/gradle_stalker_overlap_test.log b/gradle_stalker_overlap_test.logdeleted file mode 100644index 8c21d22b..00000000Binary files a/gradle_stalker_overlap_test.log and /dev/null differdiff --git a/gradle_sync_fix_test1.log b/gradle_sync_fix_test1.logdeleted file mode 100644index d53c666a..00000000Binary files a/gradle_sync_fix_test1.log and /dev/null differdiff --git a/gradle_sync_fix_test2.log b/gradle_sync_fix_test2.logdeleted file mode 100644index 8f437ba8..00000000Binary files a/gradle_sync_fix_test2.log and /dev/null differdiff --git a/gradle_test1.log b/gradle_test1.logdeleted file mode 100644index 5d7ac171..00000000Binary files a/gradle_test1.log and /dev/null differdiff --git a/gradle_test2.log b/gradle_test2.logdeleted file mode 100644index c7ae3f12..00000000Binary files a/gradle_test2.log and /dev/null differdiff --git a/tools/smoke_download.ps1 b/tools/smoke_download.ps1deleted file mode 100644index 17a006ed..00000000--- a/tools/smoke_download.ps1+++ /dev/null@@ -1,93 +0,0 @@-# smoke_download.ps1-# Bounded download feature smoke script for StreamVault.-# Runs exactly three bounded Gradle commands and reports X/3 results.--Set-StrictMode -Version Latest-$ErrorActionPreference = "Continue"--$Passed = 0-$Failed = 0--function Run-Command {- param(- [string]$Cmd,- [string]$Description- )-- Write-Host ""- Write-Host "========================================" -ForegroundColor Cyan- Write-Host "Running: $Description" -ForegroundColor Cyan- Write-Host "Command: $Cmd" -ForegroundColor Yellow- Write-Host "----------------------------------------" -ForegroundColor Cyan-- # Run via cmd /c and capture full stdout + stderr into a temp file.- $tmpFile = [System.IO.Path]::Combine(- [System.IO.Path]::GetTempPath(),- "smoke_cmd_$((Get-Date -Format 'yyyyMMdd_HHmmss_ffff').ToString().Replace(':','_')).txt"- )-- # Redirect both stdout and stderr to the temp file via cmd,- # then read it back so we can display the full output.- $cmdLine = "/c $Cmd >`"$tmpFile`" 2>&1"- $process = Start-Process `- -FilePath "cmd.exe" `- -ArgumentList $cmdLine `- -WorkingDirectory (Get-Location).Path `- -NoNewWindow `- -PassThru `- -Wait-- $exitCode = $process.ExitCode-- # Print full captured output (stdout + stderr merged)- $output = Get-Content -Path $tmpFile -Raw -ErrorAction SilentlyContinue- if ($output) {- Write-Host $output- }-- # Clean up temp file- Remove-Item -Path $tmpFile -ErrorAction SilentlyContinue-- Write-Host "----------------------------------------" -ForegroundColor Cyan- Write-Host "Exit code: $exitCode" -ForegroundColor Cyan-- if ($exitCode -eq 0) {- Write-Host "PASS: $Cmd" -ForegroundColor Green- $script:Passed++- }- else {- Write-Host "FAIL: $Cmd" -ForegroundColor Red- $script:Failed++- }-- Write-Host "========================================" -ForegroundColor Cyan-}--# Command 1: Build domain module (DownloadModels compiles)-Run-Command `- -Cmd ".\gradlew.bat :domain:build --no-daemon --console=plain" `- -Description "Build domain module (DownloadModels)"--# Command 2: Compile data module (DownloadEntity, DownloadDao, DownloadManagerImpl)-Run-Command `- -Cmd ".\gradlew.bat :data:compileDebugKotlin --no-daemon --console=plain" `- -Description "Compile data module (DownloadEntity, DownloadDao, DownloadManagerImpl)"--# Command 3: Compile app module (DownloadForegroundService, download buttons, DownloadsScreen)-Run-Command `- -Cmd ".\gradlew.bat :app:compileDebugKotlin --no-daemon --console=plain" `- -Description "Compile app module (DownloadForegroundService, downloads UI)"--# Final summary-Write-Host ""-Write-Host "========================================" -ForegroundColor Cyan-Write-Host "SUMMARY: $Passed/3 tests passed" -ForegroundColor Cyan-Write-Host "========================================" -ForegroundColor Cyan--if ($Failed -gt 0) {- Write-Host "ONE OR MORE COMMANDS FAILED" -ForegroundColor Red- exit 1-}--Write-Host "ALL COMMANDS PASSED" -ForegroundColor Green-exit 0diff --git a/tools/smoke_external_playback.ps1 b/tools/smoke_external_playback.ps1deleted file mode 100644index 3c2de773..00000000--- a/tools/smoke_external_playback.ps1+++ /dev/null@@ -1,96 +0,0 @@-# smoke_external_playback.ps1-# Bounded external playback smoke script for StreamVault.-# Runs at most three bounded Gradle commands and reports X/Y results.--Set-StrictMode -Version Latest-$ErrorActionPreference = "Continue"--$Passed = 0-$Failed = 0--function Run-Command {- param(- [string]$Cmd,- [string]$Description- )-- Write-Host ""- Write-Host "========================================" -ForegroundColor Cyan- Write-Host "Running: $Description" -ForegroundColor Cyan- Write-Host "Command: $Cmd" -ForegroundColor Yellow- Write-Host "----------------------------------------" -ForegroundColor Cyan-- # Run via cmd /c and capture full stdout + stderr into a temp file.- $tmpFile = [System.IO.Path]::Combine(- [System.IO.Path]::GetTempPath(),- "smoke_cmd_$((Get-Date -Format 'yyyyMMdd_HHmmss_ffff').ToString().Replace(':','_')).txt"- )-- # Redirect both stdout and stderr to the temp file via cmd,- # then read it back so we can display the full output.- $cmdLine = "/c $Cmd >`"$tmpFile`" 2>&1"- $process = Start-Process `- -FilePath "cmd.exe" `- -ArgumentList $cmdLine `- -WorkingDirectory (Get-Location).Path `- -NoNewWindow `- -PassThru `- -Wait-- $exitCode = $process.ExitCode-- # Print full captured output (stdout + stderr merged)- $output = Get-Content -Path $tmpFile -Raw -ErrorAction SilentlyContinue- if ($output) {- Write-Host $output- }-- # Clean up temp file- Remove-Item -Path $tmpFile -ErrorAction SilentlyContinue-- Write-Host "----------------------------------------" -ForegroundColor Cyan- Write-Host "Exit code: $exitCode" -ForegroundColor Cyan-- if ($exitCode -eq 0) {- Write-Host "PASS: $Cmd" -ForegroundColor Green- $script:Passed++- }- else {- Write-Host "FAIL: $Cmd" -ForegroundColor Red- $script:Failed++- }-- Write-Host "========================================" -ForegroundColor Cyan-}--# Command 1: Domain tests for ExternalPlaybackMode-Run-Command `- -Cmd ".\gradlew.bat :domain:test --tests com.streamvault.domain.model.ExternalPlaybackModeTest" `- -Description "Domain tests for ExternalPlaybackMode"--# Command 2: App unit tests for external player launcher/result classes-Run-Command `- -Cmd ".\gradlew.bat :app:testDebugUnitTest --tests com.streamvault.app.player.external.*" `- -Description "App unit tests for external player launcher/result classes"--# Command 3: Compile app Kotlin (only if gradlew.bat exists)-$gradlewBat = "./gradlew.bat"-if (Test-Path $gradlewBat) {- Run-Command `- -Cmd ".\gradlew.bat :app:compileDebugKotlin" `- -Description "Compile app Kotlin sources"-}--# Final summary-Write-Host ""-Write-Host "========================================" -ForegroundColor Cyan-Write-Host "SUMMARY: $Passed/$($Passed + $Failed) tests passed" -ForegroundColor Cyan-Write-Host "========================================" -ForegroundColor Cyan--if ($Failed -gt 0) {- Write-Host "ONE OR MORE COMMANDS FAILED" -ForegroundColor Red- exit 1-}--Write-Host "ALL COMMANDS PASSED" -ForegroundColor Green-exit 0