Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

feat(settings): Enhance runtime validation and performance for Settings feature

David Nashashd36005a78788
diff --git a/app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt b/app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt
index d94d0544..8dcb5ce7 100644
--- a/app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt
+++ b/app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt
@@ -4,7 +4,7 @@ import com.streamvault.app.update.AppUpdateDownloadStatus
import com.streamvault.app.update.AppUpdateInstaller
import com.streamvault.app.update.GitHubReleaseChecker
import com.streamvault.app.update.GitHubReleaseInfo
-import com.streamvault.app.update.isRemoteVersionNewer
+import com.streamvault.app.update.isRemoteVersionNewer as isRemoteVersionNewerForCurrentBuild
import com.streamvault.app.update.AppUpdateCheckPolicy
import com.streamvault.domain.model.Result
import com.streamvault.feature.settings.api.SettingsAppUpdatePort
@@ -51,7 +51,7 @@ class AppSettingsUpdateAdapter @Inject constructor(
remoteVersionCode: Int?,
remoteVersionName: String,
remotePublishedAt: String?,
- ): Boolean = isRemoteVersionNewer(remoteVersionCode, remoteVersionName, remotePublishedAt)
+ ): Boolean = isRemoteVersionNewerForCurrentBuild(remoteVersionCode, remoteVersionName, remotePublishedAt)
override suspend fun fetchLatestRelease(): Result<SettingsReleaseInfo> =
releaseChecker.fetchLatestRelease().map(::mapRelease)
diff --git a/app/src/test/java/com/streamvault/app/settings/AppSettingsUpdateAdapterTest.kt b/app/src/test/java/com/streamvault/app/settings/AppSettingsUpdateAdapterTest.kt
new file mode 100644
index 00000000..538e0be3
--- /dev/null
+++ b/app/src/test/java/com/streamvault/app/settings/AppSettingsUpdateAdapterTest.kt
@@ -0,0 +1,29 @@
+package com.streamvault.app.settings
+
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.app.update.AppUpdateDownloadState
+import com.streamvault.app.update.AppUpdateInstaller
+import com.streamvault.app.update.GitHubReleaseChecker
+import kotlinx.coroutines.flow.MutableStateFlow
+import org.junit.Test
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.whenever
+
+class AppSettingsUpdateAdapterTest {
+
+ @Test
+ fun isRemoteVersionNewer_delegatesToCurrentBuildPolicy() {
+ val releaseChecker = mock<GitHubReleaseChecker>()
+ val updateInstaller = mock<AppUpdateInstaller>()
+ whenever(updateInstaller.downloadState).thenReturn(MutableStateFlow(AppUpdateDownloadState()))
+ val adapter = AppSettingsUpdateAdapter(releaseChecker, updateInstaller)
+
+ assertThat(
+ adapter.isRemoteVersionNewer(
+ remoteVersionCode = Int.MAX_VALUE,
+ remoteVersionName = "999.0.0",
+ remotePublishedAt = null
+ )
+ ).isTrue()
+ }
+}
diff --git a/core/ui/src/main/java/com/streamvault/core/ui/components/dialogs/PremiumDialog.kt b/core/ui/src/main/java/com/streamvault/core/ui/components/dialogs/PremiumDialog.kt
index 24689061..e430cd8c 100644
--- a/core/ui/src/main/java/com/streamvault/core/ui/components/dialogs/PremiumDialog.kt
+++ b/core/ui/src/main/java/com/streamvault/core/ui/components/dialogs/PremiumDialog.kt
@@ -1,6 +1,7 @@
package com.streamvault.core.ui.components.dialogs
import android.view.KeyEvent as AndroidKeyEvent
+import androidx.activity.compose.BackHandler
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
@@ -85,6 +86,7 @@ fun PremiumDialog(
val isTelevisionDevice = rememberIsTelevisionDevice()
val blockOpenGesture = rememberDialogOpenGestureBlocker(canInteract)
LaunchedEffect(Unit) { delay(500); canInteract = true }
+ BackHandler(enabled = canInteract, onBack = onDismissRequest)
Dialog(
onDismissRequest = onDismissRequest,
properties = DialogProperties(
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md
index 6f18cad6..0fc9258b 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md
@@ -37,6 +37,11 @@ runtime gates remain open under their respective reports.
`docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md`; the separate
`AudioCompatibilityMemoryStore` audit is recorded there as a non-`:data`
dependency.
+- The 2026-08-28 audit enumerated exact Settings source sites for all nine
+ `:data` types and the separate `AudioCompatibilityMemoryStore` dependency.
+ None has a complete domain-facing replacement, so no dependency was removed
+ in this slice; exact locations and replacement readiness are recorded in the
+ transitional dependency ledger.
- Graphify was refreshed after the locale and test ownership moves; the current
corpus has 15,325 nodes, 29,893 edges, and 378 communities. `SettingsViewModel` remains
a high-connectivity coordination node while moved presentation nodes now
@@ -789,6 +794,167 @@ round-trip schema, and three PlayerSmoke focus/track cases). These failures are
outside `:feature:settings`; they remain open under the neighboring acceptance
gates and are not being counted as settings failures.
+## Expanded behavior-focused connected evidence (2026-08-28)
+
+The Settings connected suite now includes ten new behavior-focused cases plus
+the two existing feature cases. It passed on the API 36
+`Television_1080p(AVD)` emulator with `E:\androidSdk`:
+
+```text
+gradlew.bat :feature:settings:connectedDebugAndroidTest \
+ --no-daemon --console=plain --warning-mode=none
+BUILD SUCCESSFUL in 1m 43s
+12 tests, 0 failures, 0 errors, 0 skipped
+```
+
+The result XML is
+`feature/settings/build/outputs/androidTest-results/connected/debug/TEST-Television_1080p(AVD) - 16-_feature_settings-.xml`
+(`tests=12`, `failures=0`, `errors=0`, `skipped=0`, `time=62.167`). Coverage
+now includes section navigation, D-pad focus restoration, dialog open/dismiss
+and Back behavior, parental/PIN state, backup/restore callbacks and state,
+route argument compatibility, accessibility semantics, and RTL navigation.
+The shared `PremiumDialog` host also registers a guarded activity Back callback
+so Back dismisses a Settings dialog instead of finishing the host activity.
+
+Exact failures in the accepted run: none. The captured artifacts are:
+
+The connected suite was rerun after the workstation Gradle path change. A
+first attempt hit the emulator's boot/service race (`emulator-5554` was not
+visible to ADB and installation reported `cmd: Can't find service: package`).
+After the existing emulator reported boot completion and the package service
+was available, the same command passed without clearing or uninstalling app
+data:
+
+```text
+BUILD SUCCESSFUL in 58s
+12 tests, 0 failures, 0 errors, 0 skipped
+```
+
+The refreshed XML at the same path reports `tests=12`, `failures=0`,
+`errors=0`, `skipped=0`, `time=23.957`, timestamp
+`2026-08-28T17:45:10`. The earlier XML timing remains historical evidence;
+the latest rerun is the current connected gate result.
+
+- `validation/phase5_settings/task11_screenshots/settings_navigation_dpad.png`
+- `validation/phase5_settings/task11_screenshots/settings_navigation_rtl.png`
+- `validation/phase5_settings/task11_screenshots/settings_backup_preview.png`
+
+Full runtime evidence, dimensions, hashes, and the exact XML path are in
+`validation/phase5_settings/task11-runtime-validation.md`.
+
+## Production-shell manual journey evidence (2026-08-28)
+
+Safe TV journeys were run on the API 36 `AOSP_TV_on_x86` emulator
+(`emulator-5554`) after installing `:app:installDebug`. The app was launched
+through `com.streamvault.app.debug/com.streamvault.app.MainActivity` and its
+existing data was preserved. Settings entry, section navigation, Playback,
+Privacy, Recording, Backup & Restore, EPG Sources, and About all rendered in
+the production shell. The protection-level dialog opened and platform Back
+dismissed it while leaving `MainActivity` foregrounded. Enter New PIN opened
+without entering a value. Manage local backups and Import Data followed their
+no-fixture safe paths; no restore, external account, credential, USB/Drive, or
+destructive operation was used. EPG Sources correctly reported no configured
+external sources.
+
+The first About → Check now action found a real app-owned seam defect:
+
+```text
+08-28 14:15:31.963 FATAL EXCEPTION: main
+java.lang.StackOverflowError: stack size 8188KB
+at com.streamvault.app.settings.AppSettingsUpdateAdapter.isRemoteVersionNewer(AppSettingsUpdateAdapter.kt:54)
+(the adapter frame repeated recursively)
+```
+
+The adapter's unqualified policy call resolved to its own override. The minimal
+fix aliases the top-level policy import in
+`app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt`.
+`app/src/test/java/com/streamvault/app/settings/AppSettingsUpdateAdapterTest.kt`
+reproduces the delegation contract and passed after the fix. The patched APK
+was reinstalled without clearing data; the same D-pad route then kept the
+activity alive, advanced `Last checked` to `Aug 28, 2026 2:29 PM`, and left
+`Update status` as `Up to date`. The screen still shows the saved pre-fix crash
+report, which is expected with preserved data. Screenshots and the detailed
+failure/log evidence are recorded in
+`validation/phase5_settings/task11-runtime-validation.md`, including
+`manual_journeys/update-check-post-fix.png`.
+
+The seeded public `iptv-org US validation` provider was synced without
+credentials. The M3U request returned HTTP 200 with a 327,094-byte body and
+1,467 Live channels were staged. The final UI status was `ERROR` only because
+the fixture had no movie entries and no EPG URL:
+
+```text
+Section retry failed ... [MOVIES]: Playlist contains no movie entries
+Section retry failed ... [EPG]: No EPG URL configured for this provider
+```
+
+This is recorded as provider fixture evidence, not attributed to the Settings
+extraction. A focus attempt for Provider Diagnostics opened Add a provider;
+no credentials were entered. Recording storage was inspected without starting
+a recording or player handoff.
+
+The remaining safe TV pass then exercised the Settings shell again from a
+fresh direct launch. Providers, parental controls, and Backup & Restore were
+entered with the D-pad. Opening parental controls showed the existing
+`Unlocked` category state without changing it; Back returned to the Providers
+section with the Settings rail focus restored. The Backup & Restore section
+opened its export and local-backup paths. On this TV the Export Data action
+used the picker-free Downloads path and reported:
+
+```text
+Backup saved locally. On supported TVs it is in Downloads/StreamVault; open it with a file manager.
+```
+
+Manage local backups then listed the generated files without selecting Delete
+or Restore:
+
+```text
+streamvault_backup_20260828_150353_675.json
+streamvault_backup_20260828_150322_143.json
+```
+
+The paired screenshots are under
+`validation/phase5_settings/manual_journeys/`: `remaining-settings-screen.png`,
+`remaining-parental-screen.png`, `remaining-settings-return.png`,
+`remaining-backup-screen.png`, `remaining-export-result.png`, and
+`remaining-local-backups.png`. They are 1920x1080 captures from
+`com.streamvault.app.debug/com.streamvault.app.MainActivity`; SHA-256 hashes
+are recorded in the validation report. No picker location, external account,
+credential, USB/Drive flow, import, restore, or delete action was used.
+
+## Incremental build performance evidence
+
+The required five-pair measurements were captured in isolated detached
+snapshots at pre-extraction ref `e12f816f` and post-extraction ref `cf468d3e`,
+using the same repository wrapper, `E:\androidSdk`, dedicated E: Gradle/temp
+paths, and command flags. Full raw samples and every profile path are in
+`validation/phase5_settings/performance-samples-2026-08-28.md`.
+
+The source-edit commands were `:app:compileDebugKotlin` before extraction and
+`:feature:settings:compileDebugKotlin` after extraction. The five-sample median
+was `16926 ms` before versus `8858 ms` after (47.7% faster), but a one-time
+feature/KSP setup outlier made the five-sample averages `19032 ms` versus
+`19432 ms` and the p95 `34946 ms` versus `60017 ms`. Excluding that first setup
+sample, the four-sample averages were `15053 ms` versus `9286 ms` (38.3%
+faster).
+
+The moved-test commands were `:app:compileDebugUnitTestKotlin` before and
+`:feature:settings:compileDebugUnitTestKotlin` after. Five-sample averages were
+`22852 ms` versus `14915 ms` (34.7% faster), while medians were `11324 ms`
+versus `9889 ms` (12.7% faster) and p95 values were `60069 ms` versus
+`35141 ms` (41.5% faster). These mixed cache/setup states do not support a
+formal claim that the 20% steady-state test target is closed.
+
+The clean guardrail passed in both snapshots: pre `9m27s` (154 actionable;
+123 executed; 31 cached) and post `4m55s` (176 actionable; 119 executed; 57
+cached). Warm no-change runs also passed: pre `10s` and post `12s`, each with
+one executed task and the remainder up to date. The Phase 0 clean reference
+(`2m15.47s`) was recorded under a different cache/storage state, so it is not
+a comparable clean baseline; the observed post clean value is above it. The
+warm post value is below the Phase 0 warm reference (`36.264s`). Accordingly,
+the Settings performance gate remains open pending a comparable clean baseline
+and steadier test-compile comparison; no target closure is claimed.
+
## Open work and gates
- The resource-usage audit and confirmed-obsolete app locale/default cleanup
@@ -803,15 +969,20 @@ gates and are not being counted as settings failures.
longer needs them.
- Complete the DAO/concrete dependency audit and remove each ledger entry only
after a domain-facing replacement exists.
-- Capture the five paired before/after incremental build samples; the profile
- descriptors have been regenerated, but paired performance samples remain
- open.
-- The focused settings connected checks pass; perform manual TV journeys
- for parental controls, backup/restore, update, diagnostics, sync, and focus
- restoration when the required emulator/accounts/files are available.
+- The five paired incremental source/test samples and clean/warm guardrails are
+ recorded in `validation/phase5_settings/performance-samples-2026-08-28.md`.
+ Steady-state source compilation improved, but setup outliers and the
+ non-comparable Phase 0 clean reference keep the formal performance gate open.
+- Safe manual TV journeys for Settings navigation, parental PIN dialogs,
+ backup export/local listing and no-fixture import, EPG Sources, update
+ checking, and provider sync have evidence. Fixture-dependent restore,
+ diagnostics action routing, credentialed provider flows, recording/player
+ handoff, and the remaining full-shell accessibility/reduced-motion coverage
+ remain open.
- The focused connected settings result, plus the neighboring provider/app
result and failure inventory, are recorded in
- `validation/phase5_settings/task11-runtime-validation.md`. The full manual
- settings journey remains open until suitable fixtures and time are available.
+ `validation/phase5_settings/task11-runtime-validation.md`. The safe
+ Settings shell journey is evidenced; fixture-dependent and full-shell gates
+ remain open until suitable fixtures and time are available.
- Do not treat the still-open playback/provider acceptance and performance
gates as closed by this settings report.
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 1fa029fa..41fcb93e 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -87,3 +87,24 @@ still imports exactly the nine ledgered `:data` types listed above, plus
Settings/parental state, observer, action, and formatting orchestration; no
additional DAO or concrete implementation types were found. Replacing them
requires domain-facing contracts and remains a Phase 7 task.
+
+### Exact source sites and contract readiness (2026-08-28)
+
+The second audit enumerated the concrete references rather than counting only
+distinct type names:
+
+| Implementation | Exact Settings source sites | Use classification | Replacement readiness |
+|---|---|---|---|
+| `ProgramDao` | `SettingsDerivedStateObservers.kt:36,50`; `SettingsObserverRegistrations.kt:5,161,177`; `SettingsViewModel.kt:16,106` | Provider program-count observation for diagnostics and parental/settings state wiring | No domain query port exists; keep until a provider-scoped program-count contract is introduced |
+| `XtreamIndexJobDao` | `SettingsViewModel.kt:17,115,311` | Xtream indexing-job observation | No domain indexing-status port exists; keep until the job state is modeled in `domain` |
+| `XtreamLiveOnboardingDao` | `SettingsViewModel.kt:18,116,362` | Xtream live-onboarding state observation | No domain onboarding-status port exists; keep until the onboarding state is modeled in `domain` |
+| `XtreamIndexJobEntity` | `SettingsViewModel.kt:19,378` | Diagnostics warning formatting from the persistence entity | No domain indexing-status model exists; keep the entity-to-message conversion in the transitional feature boundary |
+| `XtreamLiveOnboardingStateEntity` | `SettingsOperationalModels.kt:3,92` | Persistence entity to Settings UI-model mapping | No domain onboarding-status model exists; keep the mapper transitional |
+| `DatabaseMaintenanceSnapshot` | `SettingsOperationalModels.kt:4,128` | Database-health snapshot to maintenance UI-model mapping | No domain maintenance snapshot exists; keep the mapper transitional |
+| `PreferencesRepository` | `ParentalControlGroupViewModel.kt:6,48`; `SettingsAppUpdateActions.kt:10,16`; `SettingsDerivedStateObservers.kt:9,94,119,136`; `SettingsGuideDefaultCategoryBindings.kt:4,23`; `SettingsObserverRegistrations.kt:6,28,103,140,163`; `SettingsProviderActions.kt:19,37`; `SettingsStateBindings.kt:11,35`; `SettingsViewModel.kt:20,107` | Preference flows and writes for parental, update, provider, EPG, recording, playback, and presentation state | The repository is still the concrete implementation of a broad preference surface; no complete domain preference contract exists |
+| `ProviderSyncCommands` | `SettingsProviderActions.kt:18,39`; `SettingsSyncActions.kt:6,19`; `SettingsViewModel.kt:21,114` | Provider sync, retry, background EPG, and index command dispatch | No domain sync-command contract covering these commands exists; keep until command ownership is moved |
+| `SyncRepairSection` | `SettingsSyncActions.kt:7,112-114,197-200`; `SettingsViewModel.kt:22` | Sync-warning and selected-section mapping | No domain repair-section model exists; keep until sync repair semantics are domain-owned |
+| `AudioCompatibilityMemoryStore` | `SettingsViewModel.kt:85,125,872` | Clears player compatibility memory when the related preference is changed | Separate concrete `:player` dependency; no feature-to-feature replacement or Settings port exists |
+
+No row is removal-ready in this slice. The audit therefore produces no source
+or Gradle dependency changes; each row remains explicitly owned by Phase 7.
diff --git a/docs/superpowers/plans/2026-08-28-settings-runtime-and-performance-completion.md b/docs/superpowers/plans/2026-08-28-settings-runtime-and-performance-completion.md
new file mode 100644
index 00000000..4eaaae46
--- /dev/null
+++ b/docs/superpowers/plans/2026-08-28-settings-runtime-and-performance-completion.md
@@ -0,0 +1,182 @@
+# Settings Runtime and Performance Completion Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Close every Settings-slice gate that can be completed safely in the current development environment while preserving the existing checkout and keeping Phase 7 and later feature slices out of scope.
+
+**Architecture:** Keep `:feature:settings` as the presentation owner and `:app` as the composition root for platform adapters, route decoding, launchers, lifecycle, and external callbacks. Complete remaining evidence through isolated committed snapshots for performance and non-destructive TV journeys; add deterministic coverage only for a confirmed Settings behavior gap.
+
+**Tech Stack:** Kotlin, Jetpack Compose for TV, Android instrumentation, Gradle 8.12, PowerShell, `E:\androidSdk`, Graphify, Git committed snapshots.
+
+**Spec:** `docs/superpowers/specs/2026-08-27-phase-5-settings-feature-extraction-design.md`
+
+## Global Constraints
+
+- Preserve the current working tree; do not reset, clean, delete, or mix unrelated changes.
+- Do not start the later live, catalog, or system extraction slices.
+- Do not remove the nine temporary `:data` dependencies or `player.AudioCompatibilityMemoryStore` without domain-facing replacements.
+- Do not use credentials, accounts, USB/Drive, or destructive restore operations without explicit fixtures and authority.
+- Use `E:\androidSdk` for connected validation and keep existing playback/provider failures separately attributed.
+- Use TDD for any production behavior change: failing test first, then minimal implementation, then green verification.
+- After code changes, run `graphify update .`; finish with `git diff --check` and `git status --short`.
+
+### Task 1: Complete the Settings dependency audit
+
+**Files:**
+- Modify: `docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md`
+- Modify: `docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md`
+- Read: `feature/settings/src/main/java/com/streamvault/feature/settings`
+
+**Interfaces:**
+- Consumes: the existing nine-entry `:data` ledger and the concrete `AudioCompatibilityMemoryStore` audit candidate.
+- Produces: exact source locations, current presentation responsibility, and a contract-ready removal direction for every temporary dependency.
+
+- [x] **Step 1: Enumerate exact imports and source locations**
+
+```powershell
+rg -n "data\.local\.dao|data\.local\.entity|data\.preferences\.DatabaseMaintenanceSnapshot|data\.preferences\.PreferencesRepository|data\.sync\.ProviderSyncCommands|data\.sync\.SyncRepairSection|player\.AudioCompatibilityMemoryStore" feature/settings/src/main/java
+```
+
+Expected: exactly the nine ledgered `:data` types plus `player.AudioCompatibilityMemoryStore`, with no new implementation dependencies.
+
+- [x] **Step 2: Classify each use without changing production code**
+
+For every result, record the owning Settings file, whether the use is state observation, action dispatch, formatting, or playback compatibility, and the domain-facing contract/model needed before removal. Confirm no `:feature:provider`, `:feature:playback`, or app-package import is introduced.
+
+- [x] **Step 3: Update and verify the ledger**
+
+Add source locations and explicit “contract not present; removal remains Phase 7” status to the existing table. Re-run the enumeration and inspect the diff. Expected: the same ten implementation references, documentation only, and no dependency removal.
+
+### Task 2: Run safe remaining TV journeys
+
+**Files:**
+- Create or update: `validation/phase5_settings/manual_journeys/` artifacts
+- Modify: `validation/phase5_settings/task11-runtime-validation.md`
+- Modify: `docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md`
+
+**Interfaces:**
+- Consumes: installed `com.streamvault.app.debug`, seeded public provider fixture, `emulator-5554`, and existing Settings route.
+- Produces: screenshots, exact UI/log outcomes, and explicit blockers for operations requiring authority or missing fixtures.
+
+- [x] **Step 1: Launch without clearing app data**
+
+```powershell
+$env:ANDROID_HOME = 'E:\androidSdk'
+& 'E:\androidSdk\platform-tools\adb.exe' -s emulator-5554 shell am start -W -n com.streamvault.app.debug/com.streamvault.app.MainActivity
+```
+
+Expected: `com.streamvault.app.debug/com.streamvault.app.MainActivity` is foregrounded and prior seeded state remains.
+
+- [x] **Step 2: Exercise parental controls without changing protected state**
+
+Navigate to Privacy and the parental-control entry with the D-pad. Open protection-level and PIN dialogs, inspect focus and Back dismissal, and do not enter a new PIN, save, reset, or hide content. Capture a binary-safe screenshot and record the focused UI node plus foreground activity.
+
+- [x] **Step 3: Create one local export fixture only if the UI offers a picker-free safe export**
+
+Use Settings backup export only when it writes an app-owned local export without credentials or external storage. Inspect the local-backup listing and preview. Do not import, restore, delete, or overwrite state. If export requires a picker or external authority, record the exact blocker.
+
+- [x] **Step 4: Exercise diagnostics, recording, and EPG presentation callbacks safely**
+
+Open the provider diagnostics panel, recording storage/browser controls, and EPG source/assignment dialogs. Do not add credentials, create recordings, select an external file, or invoke a player handoff. Record whether each action is reachable and capture screenshots for reachable states.
+
+- [x] **Step 5: Verify runtime evidence and record blockers**
+
+Use `uiautomator dump`, `dumpsys activity`, and bounded logcat extracts for each journey. Add exact outcomes to both reports. Keep credentialed provider flows, USB/Drive, destructive restore, and unavailable diagnostics actions open when they cannot be safely exercised.
+
+### Task 3: Add deterministic coverage for any confirmed Settings gap
+
+**Files:**
+- Test: `feature/settings/src/androidTest/java/com/streamvault/feature/settings/presentation/SettingsConnectedBehaviorTest.kt`
+- Modify: production Settings source only if a new test demonstrates a defect
+
+**Interfaces:**
+- Consumes: the confirmed behavior gap from Task 2 and existing feature test fixtures.
+- Produces: one focused regression test per confirmed gap, with no unrelated refactor.
+
+- [x] **Step 1: Write the smallest regression test first**
+
+Use the existing `SettingsConnectedBehaviorTest` fixture style. Assert user-visible semantics or callback/state behavior rather than implementation details. If the manual journey finds no defect, add no production code and record that existing coverage is sufficient.
+
+- [x] **Step 2: Run the focused test**
+
+```powershell
+$env:ANDROID_HOME = 'E:\androidSdk'
+.\gradlew.bat :feature:settings:connectedDebugAndroidTest --tests "com.streamvault.feature.settings.presentation.SettingsConnectedBehaviorTest" --no-daemon --console=plain --warning-mode=none
+```
+
+Expected: the focused test suite passes, or a new regression case fails for the confirmed defect before implementation.
+
+- [x] **Step 3: Implement the minimal fix only for a real failing behavior**
+
+Follow the TDD red-green cycle, preserve existing route/callback contracts, and avoid Phase 7 dependency changes.
+
+- [x] **Step 4: Run the focused Settings gates**
+
+```powershell
+.\gradlew.bat :feature:settings:verifyFeatureSettingsBoundary :feature:settings:testDebugUnitTest :feature:settings:lintDebug :feature:settings:compileDebugAndroidTestKotlin :feature:settings:connectedDebugAndroidTest --no-daemon --console=plain --warning-mode=none
+```
+
+Expected: all Settings-specific tasks pass; unrelated app/player/provider failures remain separately documented.
+
+### Task 4: Capture comparable incremental-build samples
+
+**Files:**
+- Create: `validation/phase5_settings/performance-samples-2026-08-28.md`
+- Modify: `docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md`
+
+**Interfaces:**
+- Consumes: committed pre-extraction ref `e12f816f`, committed post-extraction ref `cf468d3e`, identical host/SDK/Gradle settings, and `validation/phase5_settings/performance-protocol.md`.
+- Produces: five comparable source-edit pairs, five comparable test-edit pairs, clean/warm guardrails, task sets, profile paths, medians, p95 values, and an honest target result.
+
+- [x] **Step 1: Create isolated committed snapshots outside the checkout**
+
+Use two detached Git worktrees under a unique system temporary directory. Do not change the current checkout, do not reset it, and leave the measurement snapshots intact rather than deleting them. Verify each snapshot is clean before building.
+
+- [x] **Step 2: Establish identical SDK, Gradle, daemon, and warm-cache state**
+
+In each snapshot set `ANDROID_HOME=E:\androidSdk`, use the repository Gradle wrapper, keep worker/cache settings unchanged, and run the protocol's clean and warm `:app:assembleDebug --profile` guardrails. Record command output, wall time, and profile path.
+
+- [x] **Step 3: Run five source-edit pairs**
+
+Add the same comment-only edit to the pre-ref app Settings production file and the post-ref feature Settings production file. Run the protocol's compile command five times on each ref, recording wall time, executed/up-to-date tasks, Kotlin/KSP tasks, and profile path. Revert only the temporary snapshot edit after its five runs.
+
+- [x] **Step 4: Run five test-edit pairs**
+
+Add the same comment-only edit to the pre-ref Settings unit test and the post-ref moved Settings unit test. Run the protocol's unit-test compilation command five times on each ref and record the same evidence. Revert only the temporary snapshot edit after its five runs.
+
+- [x] **Step 5: Summarize results without overstating targets**
+
+Compute median and p95 for each side and scenario. Demonstrate the 25% source-edit and 20% test-compile targets only if the clean committed pairs support them; otherwise keep the gate open and state why.
+
+### Task 5: Final verification and reporting
+
+**Files:**
+- Modify: `validation/phase5_settings/task11-runtime-validation.md`
+- Modify: `docs/COMPOSE_REDUCTION_PHASE5_SETTINGS_REPORT.md`
+- Update: `graphify-out/` through `graphify update .`
+
+**Interfaces:**
+- Consumes: all task artifacts and command results.
+- Produces: final Settings-slice status with no false completion claim.
+
+- [x] **Step 1: Run the focused final verification**
+
+```powershell
+$env:ANDROID_HOME = 'E:\androidSdk'
+.\gradlew.bat :feature:settings:verifyFeatureSettingsBoundary :feature:settings:testDebugUnitTest :feature:settings:lintDebug :feature:settings:compileDebugAndroidTestKotlin :app:compileDebugKotlin :app:testDebugUnitTest --no-daemon --console=plain --warning-mode=none
+```
+
+- [x] **Step 2: Refresh Graphify after source changes**
+
+```powershell
+graphify update .
+```
+
+- [x] **Step 3: Check diff hygiene and status**
+
+```powershell
+git diff --check
+git status --short
+```
+
+Expected: no whitespace errors, only intentional Settings-slice/source-seam/report artifacts, and no current-checkout reset or cleanup.
diff --git a/feature/settings/src/androidTest/java/com/streamvault/feature/settings/navigation/SettingsRouteGraphBehaviorTest.kt b/feature/settings/src/androidTest/java/com/streamvault/feature/settings/navigation/SettingsRouteGraphBehaviorTest.kt
new file mode 100644
index 00000000..d53635d1
--- /dev/null
+++ b/feature/settings/src/androidTest/java/com/streamvault/feature/settings/navigation/SettingsRouteGraphBehaviorTest.kt
@@ -0,0 +1,156 @@
+package com.streamvault.feature.settings.navigation
+
+import android.net.Uri
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.navigation.compose.ComposeNavigator
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.testing.TestNavHostController
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.core.navigation.AppDestination
+import com.streamvault.core.navigation.NavigationActions
+import com.streamvault.core.navigation.NavigationOptions
+import com.streamvault.core.navigation.PlayerNavigationRequest
+import com.streamvault.core.ui.components.shell.UiDestination
+import com.streamvault.domain.model.Result
+import com.streamvault.feature.settings.api.SettingsBackupFileCandidate
+import com.streamvault.feature.settings.api.SettingsBackupFileHost
+import com.streamvault.feature.settings.api.SettingsBuildInfo
+import com.streamvault.feature.settings.api.SettingsOfficialBuildStatus
+import com.streamvault.feature.settings.api.SettingsPlatformHost
+import com.streamvault.feature.settings.api.SettingsRecordingPlaybackRequest
+import java.io.File
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class SettingsRouteGraphBehaviorTest {
+
+ @get:Rule
+ val composeRule = createComposeRule()
+
+ @Test
+ fun settingsRoute_decodesEncodedBackupUriThroughFeatureGraph() {
+ lateinit var navController: TestNavHostController
+ var receivedBackupUri: String? = null
+ val backupUri = "content://backups/fixture backup.json?slot=1"
+
+ composeRule.setContent {
+ navController = rememberTestNavController()
+ NavHost(navController = navController, startDestination = "host") {
+ composable("host") {}
+ registerSettingsGraph(
+ actions = NoOpNavigationActions,
+ platformHost = EmptySettingsPlatformHost,
+ navigationDestinations = emptyList(),
+ settingsContent = { uri, _, _ ->
+ receivedBackupUri = uri
+ androidx.tv.material3.Text("Settings route")
+ },
+ parentalControlContent = { androidx.tv.material3.Text("Parental route") }
+ )
+ }
+ LaunchedEffect(Unit) {
+ navController.navigate(
+ "settings?backupUri=${Uri.encode(backupUri)}"
+ )
+ }
+ }
+
+ composeRule.waitUntil(3_000) { receivedBackupUri == backupUri }
+ composeRule.onNodeWithText("Settings route").assertIsDisplayed()
+ composeRule.runOnIdle {
+ assertThat(receivedBackupUri).isEqualTo(backupUri)
+ }
+ }
+
+ @Test
+ fun parentalRoute_preservesLongProviderIdArgument() {
+ lateinit var navController: TestNavHostController
+
+ composeRule.setContent {
+ navController = rememberTestNavController()
+ NavHost(navController = navController, startDestination = "host") {
+ composable("host") {}
+ registerSettingsGraph(
+ actions = NoOpNavigationActions,
+ platformHost = EmptySettingsPlatformHost,
+ navigationDestinations = emptyList(),
+ settingsContent = { _, _, _ -> androidx.tv.material3.Text("Settings route") },
+ parentalControlContent = { androidx.tv.material3.Text("Parental route") }
+ )
+ }
+ LaunchedEffect(Unit) {
+ navController.navigate("parental_control_groups/987654321")
+ }
+ }
+
+ composeRule.waitUntil(3_000) {
+ navController.currentBackStackEntry?.arguments?.getLong("providerId") == 987654321L
+ }
+ composeRule.onNodeWithText("Parental route").assertIsDisplayed()
+ composeRule.runOnIdle {
+ assertThat(navController.currentBackStackEntry?.arguments?.getLong("providerId"))
+ .isEqualTo(987654321L)
+ }
+ }
+
+ @Composable
+ private fun rememberTestNavController(): TestNavHostController {
+ val context = LocalContext.current
+ return remember(context) {
+ TestNavHostController(context).apply {
+ navigatorProvider.addNavigator(ComposeNavigator())
+ }
+ }
+ }
+}
+
+private object NoOpNavigationActions : NavigationActions {
+ override fun navigate(destination: AppDestination, options: NavigationOptions) = Unit
+ override fun openPlayer(request: PlayerNavigationRequest) = Unit
+ override fun back(): Boolean = true
+ override fun returnTo(destination: AppDestination?): Boolean = true
+}
+
+private object EmptySettingsPlatformHost : SettingsPlatformHost {
+ override val buildInfo = SettingsBuildInfo(
+ versionName = "test",
+ versionCode = 1,
+ applicationId = "com.streamvault.feature.settings.test",
+ buildType = "debug"
+ )
+ override val backupFiles: SettingsBackupFileHost = EmptyBackupFileHost
+ override fun officialBuildStatus() = SettingsOfficialBuildStatus.VERIFICATION_UNAVAILABLE
+ override fun playRecording(request: SettingsRecordingPlaybackRequest) = Unit
+ override fun shareBackup(uri: Uri): Result<Unit> = error("not used")
+ override fun shareCrashReport(): Result<Unit> = error("not used")
+ override fun removableBackupDirectory(): File? = null
+}
+
+private object EmptyBackupFileHost : SettingsBackupFileHost {
+ override val jsonMimeType: String = "application/json"
+ override fun rememberManagedExport(uri: Uri) = Unit
+ override fun listManagedBackups(): List<SettingsBackupFileCandidate> = emptyList()
+ override fun listPickerFreeBackups(): List<SettingsBackupFileCandidate> = emptyList()
+ override fun listBackups(directory: File): List<SettingsBackupFileCandidate> = emptyList()
+ override fun createShareExportFile(): File = error("not used")
+ override fun createPickerFreeExportUri(): Uri? = null
+ override fun finishPickerFreeExport(uri: Uri, success: Boolean): Boolean = false
+ override fun createExportFile(directory: File): File = error("not used")
+ override fun delete(candidate: SettingsBackupFileCandidate): Boolean = false
+ override fun providerUri(file: File): Uri = error("not used")
+}
diff --git a/feature/settings/src/androidTest/java/com/streamvault/feature/settings/presentation/SettingsConnectedBehaviorTest.kt b/feature/settings/src/androidTest/java/com/streamvault/feature/settings/presentation/SettingsConnectedBehaviorTest.kt
new file mode 100644
index 00000000..b1998ef1
--- /dev/null
+++ b/feature/settings/src/androidTest/java/com/streamvault/feature/settings/presentation/SettingsConnectedBehaviorTest.kt
@@ -0,0 +1,369 @@
+package com.streamvault.feature.settings.presentation
+
+import android.graphics.Bitmap
+import androidx.activity.ComponentActivity
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.graphics.asAndroidBitmap
+import androidx.compose.ui.input.key.Key
+import androidx.compose.ui.test.SemanticsNodeInteraction
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.assertIsEnabled
+import androidx.compose.ui.test.assertIsFocused
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.hasClickAction
+import androidx.compose.ui.test.hasText
+import androidx.compose.ui.test.isToggleable
+import androidx.compose.ui.test.onAllNodesWithText
+import androidx.compose.ui.test.onNodeWithContentDescription
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.onRoot
+import androidx.compose.ui.test.pressKey
+import androidx.compose.ui.test.performKeyInput
+import androidx.compose.ui.test.performSemanticsAction
+import androidx.compose.ui.platform.LocalLayoutDirection
+import androidx.compose.ui.semantics.SemanticsActions
+import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.test.junit4.createAndroidComposeRule
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.platform.app.InstrumentationRegistry
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.core.ui.components.SearchInput
+import com.streamvault.core.ui.components.dialogs.PinDialog
+import com.streamvault.core.ui.theme.StreamVaultTheme
+import com.streamvault.domain.manager.BackupConflictStrategy
+import com.streamvault.domain.manager.BackupImportPlan
+import com.streamvault.domain.manager.BackupPreview
+import java.io.File
+import java.util.concurrent.atomic.AtomicReference
+import kotlinx.coroutines.delay
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+@OptIn(androidx.compose.ui.test.ExperimentalTestApi::class)
+class SettingsConnectedBehaviorTest {
+
+ @get:Rule
+ val composeRule = createAndroidComposeRule<ComponentActivity>()
+
+ @Test
+ fun settingsSections_areSelectableWithDpad_andRestoreFocusToSelectedSection() {
+ var selectedCategory by mutableIntStateOf(0)
+ val settingsFocusRequester = FocusRequester()
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ Row(modifier = Modifier.fillMaxSize()) {
+ SettingsNavigationRail(
+ selectedCategory = selectedCategory,
+ focusRequester = settingsFocusRequester,
+ onCategorySelected = { selectedCategory = it }
+ )
+ Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
+ androidx.tv.material3.Text(text = "Selected section: $selectedCategory")
+ }
+ }
+ LaunchedEffect(selectedCategory) {
+ delay(120)
+ settingsFocusRequester.requestFocus()
+ }
+ }
+ }
+
+ val providersNode = hasText("Providers") and hasClickAction()
+ val playbackNode = hasText("Playback") and hasClickAction()
+ composeRule.waitUntil(2_000) {
+ runCatching {
+ composeRule.onNode(providersNode).assertIsFocused()
+ }.isSuccess
+ }
+ composeRule.onNode(providersNode).performKeyInput { pressKey(Key.DirectionDown) }
+ composeRule.onNode(playbackNode).assertIsFocused()
+
+ composeRule.onNode(playbackNode).performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.waitForIdle()
+ composeRule.onNodeWithText("Selected section: 1").assertIsDisplayed()
+ composeRule.onNodeWithText("Playback").assertIsFocused()
+ composeRule.onRoot().saveSettingsScreenshot("settings_navigation_dpad")
+ }
+
+ @Test
+ fun settingsNavigation_inRtl_keepsSectionsAccessible() {
+ val focusRequester = FocusRequester()
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ Row(modifier = Modifier.fillMaxSize()) {
+ SettingsNavigationRail(
+ selectedCategory = 0,
+ focusRequester = focusRequester,
+ onCategorySelected = {}
+ )
+ Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
+ androidx.tv.material3.Text(text = "RTL settings")
+ }
+ }
+ }
+ }
+ }
+
+ composeRule
+ .onNode(hasText("Providers") and hasClickAction())
+ .assertExists()
+ .assertIsDisplayed()
+ composeRule.onNodeWithText("RTL settings").assertIsDisplayed()
+ composeRule.onRoot().saveSettingsScreenshot("settings_navigation_rtl")
+ }
+
+ @Test
+ fun settingsSearch_exposesAccessibleLabelAndCurrentValue() {
+ composeRule.setContent {
+ StreamVaultTheme {
+ SearchInput(
+ value = "sports",
+ onValueChange = {},
+ placeholder = "Search categories..."
+ )
+ }
+ }
+
+ composeRule
+ .onNodeWithContentDescription("Search categories...")
+ .assertExists()
+ .assertIsDisplayed()
+ }
+
+ @Test
+ fun backupPreview_forwardsStrategyToggleAndConfirmCallbacks() {
+ var selectedStrategy: BackupConflictStrategy? = null
+ var preferenceImportEnabled: Boolean? = null
+ var confirmed = false
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ BackupImportPreviewDialog(
+ preview = testBackupPreview(),
+ plan = BackupImportPlan(),
+ onDismiss = {},
+ onStrategySelected = { selectedStrategy = it },
+ onImportPreferencesChanged = { preferenceImportEnabled = it },
+ onImportProvidersChanged = {},
+ onImportSavedLibraryChanged = {},
+ onImportPlaybackHistoryChanged = {},
+ onImportMultiViewChanged = {},
+ onImportRecordingSchedulesChanged = {},
+ onConfirm = { confirmed = true }
+ )
+ }
+ }
+
+ waitForDialog("Review Backup Import")
+ composeRule
+ .onNode(hasText("Replace Existing") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.onAllNodes(isToggleable())[0].performSemanticsAction(SemanticsActions.OnClick)
+ composeRule
+ .onNode(hasText("Import Backup") and hasClickAction())
+ .assertIsEnabled()
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.runOnIdle {
+ assertThat(selectedStrategy).isEqualTo(BackupConflictStrategy.REPLACE_EXISTING)
+ assertThat(preferenceImportEnabled).isFalse()
+ assertThat(confirmed).isTrue()
+ }
+ composeRule.onNodeWithText("Review Backup Import").saveSettingsScreenshot("settings_backup_preview")
+ }
+
+ @Test
+ fun backupSelection_selectingItemForwardsUri_andUpdatesDialogState() {
+ var visible by mutableStateOf(true)
+ var selectedUri: String? = null
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ if (visible) {
+ BackupSelectionDialog(
+ title = "Choose backup",
+ subtitle = "Select a fixture",
+ items = listOf(
+ BackupDialogItem("content://backup/one", "Backup one"),
+ BackupDialogItem("content://backup/two", "Backup two")
+ ),
+ emptyMessage = "No backups",
+ onSelect = { uri ->
+ selectedUri = uri
+ visible = false
+ },
+ onDismiss = { visible = false }
+ )
+ }
+ }
+ }
+
+ waitForDialog("Choose backup")
+ composeRule
+ .onNode(hasText("Backup two") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.waitForIdle()
+ composeRule.runOnIdle {
+ assertThat(selectedUri).isEqualTo("content://backup/two")
+ }
+ composeRule.onNodeWithText("Choose backup").assertDoesNotExist()
+ }
+
+ @Test
+ fun backupSelection_backDismissesOpenDialog() {
+ var visible by mutableStateOf(true)
+ var dismissCount = 0
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ if (visible) {
+ BackupSelectionDialog(
+ title = "Dismiss with Back",
+ subtitle = "Back behavior",
+ items = listOf(BackupDialogItem("backup", "Backup")),
+ emptyMessage = "No backups",
+ onSelect = {},
+ onDismiss = {
+ dismissCount++
+ visible = false
+ }
+ )
+ }
+ }
+ }
+
+ waitForDialog("Dismiss with Back")
+ composeRule.runOnIdle {
+ composeRule.activity.onBackPressedDispatcher.onBackPressed()
+ }
+ composeRule.waitUntil(3_000) {
+ composeRule.onAllNodesWithText("Dismiss with Back").fetchSemanticsNodes().isEmpty()
+ }
+ composeRule.runOnIdle {
+ assertThat(dismissCount).isEqualTo(1)
+ }
+ }
+
+ @Test
+ fun parentalControlCard_reflectsPinState_andForwardsChangeAction() {
+ var hasPin by mutableStateOf(false)
+ var changeActionCount = 0
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ ParentalControlCard(
+ level = 0,
+ hasParentalPin = hasPin,
+ hasActiveProvider = true,
+ onChangeLevel = {},
+ onChangePin = {
+ changeActionCount++
+ hasPin = true
+ }
+ )
+ }
+ }
+
+ composeRule
+ .onNode(hasText("Set PIN") and hasClickAction())
+ .assertIsDisplayed()
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.waitUntil(2_000) {
+ composeRule.onAllNodesWithText("Change PIN").fetchSemanticsNodes().isNotEmpty()
+ }
+ composeRule.runOnIdle {
+ assertThat(changeActionCount).isEqualTo(1)
+ }
+ }
+
+ @Test
+ fun pinDialog_acceptsFourDigitEntry_andPreservesErrorSemantics() {
+ val enteredPin = AtomicReference<String?>(null)
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ PinDialog(
+ title = "Enter PIN",
+ cancelLabel = "Cancel",
+ error = "Incorrect PIN",
+ onDismissRequest = {},
+ onPinEntered = { enteredPin.set(it) }
+ )
+ }
+ }
+
+ composeRule.onNodeWithText("Enter PIN").assertIsDisplayed()
+ composeRule.onNodeWithText("Incorrect PIN").assertIsDisplayed()
+ composeRule.mainClock.advanceTimeBy(650)
+ composeRule.waitForIdle()
+ listOf("1", "2", "3", "4").forEach { digit ->
+ composeRule
+ .onNode(hasText(digit) and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ }
+ composeRule.waitUntil(3_000) { enteredPin.get() == "1234" }
+ composeRule.runOnIdle {
+ assertThat(enteredPin.get()).isEqualTo("1234")
+ }
+ }
+
+ private fun waitForDialog(title: String) {
+ composeRule.waitUntil(3_000) {
+ composeRule.onAllNodesWithText(title).fetchSemanticsNodes().isNotEmpty()
+ }
+ composeRule.mainClock.advanceTimeBy(650)
+ composeRule.waitForIdle()
+ }
+
+ private fun testBackupPreview() = BackupPreview(
+ version = 14,
+ providerCount = 1,
+ favoriteCount = 2,
+ groupCount = 1,
+ playbackHistoryCount = 3,
+ multiViewPresetCount = 1,
+ preferenceCount = 4,
+ protectedCategoryCount = 1,
+ scheduledRecordingCount = 1,
+ providerConflicts = 1,
+ favoriteConflicts = 0,
+ groupConflicts = 0,
+ historyConflicts = 1,
+ protectedCategoryConflicts = 0,
+ recordingConflicts = 0
+ )
+}
+
+@Suppress("DEPRECATION")
+private fun SemanticsNodeInteraction.saveSettingsScreenshot(name: String) {
+ val context = InstrumentationRegistry.getInstrumentation().targetContext
+ val directory = requireNotNull(context.externalMediaDirs.firstOrNull())
+ .resolve("settings-validation")
+ .apply { mkdirs() }
+ val outputFile = File(directory, "$name.png")
+ captureToImage().asAndroidBitmap().compressTo(outputFile)
+ println("SETTINGS_SCREENSHOT ${outputFile.absolutePath}")
+}
+
+private fun Bitmap.compressTo(outputFile: File) {
+ outputFile.outputStream().use { stream ->
+ check(compress(Bitmap.CompressFormat.PNG, 100, stream)) {
+ "Unable to write Settings connected-test screenshot: ${outputFile.absolutePath}"
+ }
+ }
+}
diff --git a/validation/phase5_settings/task11-runtime-validation.md b/validation/phase5_settings/task11-runtime-validation.md
index 9bc86f8c..df829fc1 100644
--- a/validation/phase5_settings/task11-runtime-validation.md
+++ b/validation/phase5_settings/task11-runtime-validation.md
@@ -51,6 +51,23 @@ BUILD SUCCESSFUL in 5m 43s
These tests cover the remaining app adapters and presentation-model seam; they
do not replace the manual TV journeys listed below.
+The focused verification was rerun after the workstation Gradle path change.
+The first invocation used the default C: Gradle user home and failed before
+any Settings task executed:
+
+```text
+Could not determine the dependencies of task ':core:navigation:compileKotlin'.
+Service 'SystemInfo' is not available (os=Windows 11 10.0 amd64, enabled=false).
+```
+
+The same command was rerun with `GRADLE_USER_HOME=E:\compose-settings-gradle-home`
+and `E:\androidSdk`; boundary verification, 34 Settings unit tests, lint,
+Android-test compilation, app Kotlin compilation, and app unit tests all passed
+(`BUILD SUCCESSFUL in 4m 51s`, 248 actionable tasks, 5 executed, 243
+up-to-date). The minimal `:core:navigation:compileKotlin` reproduction also
+passed with the E: Gradle home, so the C: Gradle environment failure was not a
+project or Settings assertion failure.
+
The profile-source check and both release-like assemblies pass together:
```text
@@ -124,8 +141,9 @@ neighboring feature/app acceptance work. The settings-specific connected tests
do not exercise the full app shell or all runtime journeys. The following
acceptance checks therefore remain open:
-- Settings entry/section navigation, D-pad focus restoration, dialog semantics,
- Back behavior, RTL, accessibility, and reduced-motion behavior.
+- Manual Settings entry/section navigation, D-pad focus restoration, dialog
+ semantics, Back behavior, RTL, accessibility, and reduced-motion behavior in
+ the production app shell.
- Backup/restore picker, local/folder/USB/Drive flows, partial-import recovery,
and provider backup-preview rendering on a running app.
- Parental controls, recording browser/player handoff, EPG dialogs, provider
@@ -135,6 +153,226 @@ No credentials, accounts, files, or destructive external operations were used.
Manual flows still require suitable fixtures (and, where applicable, accounts
or local files).
+## Expanded behavior-focused connected evidence (2026-08-28)
+
+The Settings connected suite was expanded and run on the same API 36 TV
+emulator using `E:\androidSdk`:
+
+```text
+gradlew.bat :feature:settings:connectedDebugAndroidTest \
+ --no-daemon --console=plain --warning-mode=none
+BUILD SUCCESSFUL in 1m 43s
+12 tests, 0 failures, 0 errors, 0 skipped
+```
+
+The final XML reports `tests=12`, `failures=0`, `errors=0`, `skipped=0`, and
+`time=62.167` seconds:
+
+`feature/settings/build/outputs/androidTest-results/connected/debug/TEST-Television_1080p(AVD) - 16-_feature_settings-.xml`
+
+The ten new tests cover section navigation, D-pad focus restoration, RTL
+navigation, SearchInput accessibility semantics, backup preview strategy and
+toggle callbacks, backup selection and Back dismissal, parental PIN state,
+four-digit PIN entry, encoded backup URI compatibility, and the long parental
+provider-id route argument. The two existing feature tests also passed. The
+dialog host now registers its guarded Back callback with the host activity
+dispatcher so platform Back dismisses Settings dialogs without finishing the
+activity.
+
+Exact failures in the accepted run: none.
+
+The connected suite was rerun after the first attempt encountered an emulator
+service race. At the time of the failed attempt, ADB could not find
+`emulator-5554`, and installation reported `cmd: Can't find service: package`.
+Once the existing emulator reported `sys.boot_completed=1` and its package
+service was available, the same command passed without restarting, clearing,
+or uninstalling the app:
+
+```text
+BUILD SUCCESSFUL in 58s
+12 tests, 0 failures, 0 errors, 0 skipped
+```
+
+The refreshed XML retains the same path and reports `tests=12`,
+`failures=0`, `errors=0`, `skipped=0`, `time=23.957`, timestamp
+`2026-08-28T17:45:10`.
+
+Screenshots were written to the emulator's shared test-media directory and
+pulled before instrumentation teardown:
+
+- `validation/phase5_settings/task11_screenshots/settings_navigation_dpad.png`
+ (1920x1080, SHA-256 `e83cb65d1b0c250a447f0429da1388ef96986757e8849e6f8159a6b2454ab829`)
+- `validation/phase5_settings/task11_screenshots/settings_navigation_rtl.png`
+ (1920x1080, SHA-256 `5e69995c6d081740be1539046274f8d276c1e668a458da948cb372a408ecf791`)
+- `validation/phase5_settings/task11_screenshots/settings_backup_preview.png`
+ (431x49 title-node capture, SHA-256 `088b46f397f408d164768171f19420676ae998313a891375f5b32fe32f345ddb`)
+
+## Production-shell manual journey evidence (2026-08-28)
+
+The debug app was installed with `:app:installDebug` and launched directly as
+`com.streamvault.app.debug/com.streamvault.app.MainActivity` on
+`emulator-5554`. Existing app data was preserved; no uninstall or data clear
+was used. Valid screenshots from the journey are under
+`validation/phase5_settings/manual_journeys/`.
+
+Safe journeys completed:
+
+- Entered Settings from the top navigation and visited Providers, Playback,
+ Privacy, Recording, Backup & Restore, EPG Sources, and About. The D-pad rail
+ focus and Settings content rendered in the production app shell.
+- Opened the Privacy protection-level dialog and dismissed it with platform
+ Back. The host remained
+ `com.streamvault.app.debug/com.streamvault.app.MainActivity`, confirming the
+ guarded dialog Back callback did not finish the activity.
+- Opened Enter New PIN without entering or changing a PIN. The existing PIN
+ state was preserved.
+- Opened Manage local backups; the UI correctly reported no
+ StreamVault-created local backups. Import Data was also opened safely and
+ reported: `No local StreamVault backups found. Export one first or open a
+ backup file with StreamVault.` No restore or destructive operation was run.
+- Opened EPG Sources; the UI reported no external EPG sources configured.
+- Opened the About update screen; before the fix, the first Check now action
+ reproduced the crash below. After reinstalling the patched build without
+ clearing data, the same D-pad journey and Check now action completed, the
+ activity stayed foregrounded, `Update status` remained `Up to date`, and
+ `Last checked` advanced to `Aug 28, 2026 2:29 PM`.
+
+Relevant manual screenshots include:
+
+- `validation/phase5_settings/manual_journeys/settings-entry-2.png`
+- `validation/phase5_settings/manual_journeys/settings-playback.png`
+- `validation/phase5_settings/manual_journeys/settings-privacy.png`
+- `validation/phase5_settings/manual_journeys/settings-pin-open.png`
+- `validation/phase5_settings/manual_journeys/settings-pin-dialog-2.png`
+- `validation/phase5_settings/manual_journeys/settings-backup-screen.png`
+- `validation/phase5_settings/manual_journeys/backup-import-picker.png`
+- `validation/phase5_settings/manual_journeys/backup-import-flow.png`
+- `validation/phase5_settings/manual_journeys/settings-epg-2.png`
+- `validation/phase5_settings/manual_journeys/update-replay-about.png`
+- `validation/phase5_settings/manual_journeys/update-check-post-fix.png`
+
+The first update attempt failed at `08-28 14:15:31.963` with this exact
+exception:
+
+```text
+FATAL EXCEPTION: main
+Process: com.streamvault.app.debug
+java.lang.StackOverflowError: stack size 8188KB
+ at com.streamvault.app.settings.AppSettingsUpdateAdapter.isRemoteVersionNewer(AppSettingsUpdateAdapter.kt:54)
+ (same frame repeated recursively)
+ at com.streamvault.feature.settings.presentation.SettingsViewModel$checkForAppUpdates$1.invoke(SettingsViewModel.kt:695)
+ at com.streamvault.feature.settings.presentation.SettingsAppUpdateActions$checkForAppUpdates$1.invokeSuspend(SettingsAppUpdateActions.kt:72)
+```
+
+The app-owned adapter had an unqualified call from its override back to itself
+instead of to the top-level current-build policy. The fix aliases the policy
+import in `app/src/main/java/com/streamvault/app/settings/AppSettingsUpdateAdapter.kt`;
+`app/src/test/java/com/streamvault/app/settings/AppSettingsUpdateAdapterTest.kt`
+now guards the delegation. The regression test was first run red with the
+same `StackOverflowError`, then green after the alias fix. The post-fix replay
+above is the connected/manual confirmation. The About screen still shows the
+saved pre-fix `StackOverflowError` report because app data was intentionally
+preserved; no new crash was generated by the replay.
+
+The seeded public provider `iptv-org US validation` was also exercised without
+credentials. Its sync reached the network and staged 1,467 Live channels:
+
+```text
+GET https://iptv-org.github.io/iptv/countries/us.m3u
+HTTP 200 ... 327094-byte body
+SyncCatalogStore: channel-staging-batch(1000) took=406ms
+SyncCatalogStore: channel-staging-batch(467) took=205ms
+TvInputChannelSync: TV input channels operations=1467 took=969ms
+```
+
+The final provider UI reported `Last sync status: ERROR` for two exact fixture
+limitations, not a Settings extraction crash:
+
+```text
+SyncManager: Section retry failed for provider 1 [MOVIES]: Playlist contains no movie entries
+SyncManager: Section retry failed for provider 1 [EPG]: No EPG URL configured for this provider
+```
+
+Provider sync screenshots are
+`provider-sync-start.png`, `provider-sync-running.png`, and
+`provider-sync-finished.png`. A focus attempt labeled Provider Diagnostics
+opened the Add a provider screen instead; no credentials were entered and Back
+returned to the provider screen. Recording storage was inspected safely, but
+no folder picker, recording, or player handoff was started.
+
+The remaining safe TV pass then re-entered Settings from a direct launch and
+covered Providers, parental controls, and Backup & Restore with the D-pad.
+Parental controls displayed the existing `Unlocked` category state without a
+mutation; platform Back returned to Providers with the Settings rail focus
+restored. Export Data stayed within the TV-safe picker-free path and surfaced
+the exact message:
+
+```text
+Backup saved locally. On supported TVs it is in Downloads/StreamVault; open it with a file manager.
+```
+
+Manage local backups subsequently listed these generated entries. Delete and
+Restore were not selected:
+
+```text
+streamvault_backup_20260828_150353_675.json
+streamvault_backup_20260828_150322_143.json
+```
+
+Captured artifacts (all 1920x1080 PNGs) are:
+
+| Artifact | Bytes | SHA-256 |
+| --- | ---: | --- |
+| `manual_journeys/remaining-launch.png` | 299723 | `479a0fb4e3429f21d7c2144c160cada4bc56811f1c50ba71eb3961c6c4e14528` |
+| `manual_journeys/remaining-settings-screen.png` | 326047 | `fc135af39f297df26374cbbe70aef2b5e37db557a8808bbbb63c61d07fd79516` |
+| `manual_journeys/remaining-parental-screen.png` | 192597 | `527d0e3b46a682738f30aa4cc319d10ec59ee7b0a3447d8380b2428b6df3593d` |
+| `manual_journeys/remaining-settings-return.png` | 305551 | `1fec5e06bd8c99a335aeca6be233f4f43970754eea40dfec30869ae3d9c51a94` |
+| `manual_journeys/remaining-backup-screen.png` | 449887 | `6d667520961eeb8a345e26267c1ff37f8b17e534da1fab8f6c113de8b858f46b` |
+| `manual_journeys/remaining-export-result.png` | 431066 | `d86ae25d0ab1fdcc164ec6b348b897c7d6d69e8e35a94b8912674feaad6aa8df` |
+| `manual_journeys/remaining-local-backups.png` | 213751 | `712b501e262fba2ad668e8e60c103f302d5a04ae3def75f95f1d62dedca9d9bc` |
+
+The foreground activity remained
+`com.streamvault.app.debug/com.streamvault.app.MainActivity`. No picker
+location, external account, credential, USB/Drive flow, import, restore, or
+delete action was used. Fixture-dependent restore, diagnostics action routing,
+recording/player handoff, and full-shell accessibility/reduced-motion gates
+remain open.
+
+## Incremental build performance evidence
+
+Five source-edit pairs, five moved-test compile pairs, and clean/warm guardrails
+were run in detached snapshots at `e12f816f` (pre-extraction) and `cf468d3e`
+(post-extraction). Both used `E:\androidSdk`, the repository Gradle wrapper,
+the same dedicated E: Gradle/temp paths, and the same profile/console flags.
+The complete raw table and profile paths are in
+`validation/phase5_settings/performance-samples-2026-08-28.md`.
+
+Source edit (`:app:compileDebugKotlin` versus
+`:feature:settings:compileDebugKotlin`) succeeded in all ten runs. Medians were
+`16926 ms` pre and `8858 ms` post (47.7% faster); averages were `19032 ms` pre
+and `19432 ms` post because the first post run populated feature/KSP state. The
+four post-setup samples averaged `9286 ms`, versus `15053 ms` for the matching
+pre samples (38.3% faster). The five-sample p95 values were `34946 ms` pre and
+`60017 ms` post.
+
+Moved-test compilation (`:app:compileDebugUnitTestKotlin` versus
+`:feature:settings:compileDebugUnitTestKotlin`) also succeeded in all ten runs.
+The averages were `22852 ms` pre and `14915 ms` post (34.7% faster), but the
+medians were `11324 ms` and `9889 ms` (12.7% faster), with p95 values of
+`60069 ms` and `35141 ms`. The mixed first-run setup state means the formal
+20% steady-state test target is not claimed as passed.
+
+The clean guardrail succeeded in both snapshots: pre `BUILD SUCCESSFUL in
+9m27s` with 154 actionable tasks (123 executed, 31 cached), and post `BUILD
+SUCCESSFUL in 4m55s` with 176 actionable tasks (119 executed, 57 cached).
+Warm no-change guardrails also succeeded: pre `10s`, post `12s`, with one
+executed task and all other actionable tasks up to date. The Phase 0 clean
+reference was `2m15.47s` from a different cache/storage state, so it is not a
+comparable clean baseline; the post clean value is above it. The post warm
+value is below the Phase 0 warm reference of `36.264s`. The performance gate
+therefore remains open pending a comparable Phase 0-relative clean baseline and
+a steadier test-compile comparison.
+
## Related open gates
The nine direct `:data` imports and the `AudioCompatibilityMemoryStore`