setupwizard: language picker is a route, handoffs exempt
- Commit
dc3e7ef6f7c39c81168358b3a464377d84b9d863- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-02 01:11 UTC (4 days ago)
- Parents
1144647
DialogAsRoute (1): WelcomeScreen no longer holds language- picker state. Its language row requests the new Route.LanguagePickerDialog through a callback wired in Navigation, and the DialogPage() entry renders the existing stateless ui/dialogs/LanguagePickerDialog, applying the choice through SetupViewModel and popping. The route is transient in the persisted wizard stack: SetupFlow gained its wire name and drops it on decode, so a process death with the picker open resumes at Welcome (the navigation flow test caught the missing wire name). RouteScreenshotCoverage (2): Route.Wifi and Route.Security are exempted in Route.kt with the honest reason already documented in MetadataPreviews - both are handoff steps with no UI of their own that launch the system Wi-Fi / lock-screen activities and draw nothing, so a capture would fake a system screen. The new dialog route gets a real capture, 7-language-picker-dialog with fixed locales. The regenerated docs/structure/exceptions.tsv (the two new SCREENSHOT_COVERAGE rows) is included. Verified from a clean build dir with --no-build-cache: ./gradlew :setupwizard:lint :setupwizard:lintVitalRelease :setupwizard:testDevUnitTest :setupwizard:compileReleaseKotlin all green (51 tests, 0 failures).
Diff
docs/structure/exceptions.tsv
diff --git a/docs/structure/exceptions.tsv b/docs/structure/exceptions.tsvindex 6e7937a2ac..fff3855ea8 100644--- a/docs/structure/exceptions.tsv+++ b/docs/structure/exceptions.tsv@@ -88,6 +88,8 @@ SCREENSHOT_COVERAGE notes/src/main/java/com/vayunmathur/notes/Route.kt ExternalN SCREENSHOT_COVERAGE notes/src/main/java/com/vayunmathur/notes/Route.kt InkEditor: ink editor draws on Room-backed block state with a stylus canvas; no stateless slice for Layoutlib 1 SCREENSHOT_COVERAGE photos/src/main/java/com/vayunmathur/photos/Route.kt Map: MapLibre GL surface backed by live basemap tiles; Layoutlib has no GL surface or tile source to render 1 SCREENSHOT_COVERAGE photos/src/main/java/com/vayunmathur/photos/Route.kt SecureFolder: biometric/Keystore-gated vault grid whose thumbnails are decrypted with the vault password; no stateless Layoutlib slice 1+SCREENSHOT_COVERAGE setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt Security: handoff step with no UI of its own; it launches the system lock-screen/biometric enrolment activities and draws nothing 1+SCREENSHOT_COVERAGE setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt Wifi: handoff step with no UI of its own; it launches the system Wi-Fi setup activity and draws nothing 1 SCREENSHOT_COVERAGE shop/src/main/java/com/vayunmathur/shop/Route.kt EmbeddedCheckout: merchant WebView checkout loads a secret-bearing live continue_url held only in in-memory ViewModel state; Layoutlib cannot render the merchant page 1 SCREENSHOT_COVERAGE taxi/src/main/java/com/vayunmathur/taxi/Route.kt Accounts: screen reads the Lyft token store and live payment methods from the provider; no stateless slice for Layoutlib 1 SCREENSHOT_COVERAGE taxi/src/main/java/com/vayunmathur/taxi/Route.kt CurrentRide: tab polls the Lyft provider for a live active ride and delegates to live tracking; no stateless slice for Layoutlib 1
setupwizard/AGENTS.md
diff --git a/setupwizard/AGENTS.md b/setupwizard/AGENTS.mdindex 11f6029343..8ee5200260 100644--- a/setupwizard/AGENTS.md+++ b/setupwizard/AGENTS.md@@ -8,7 +8,7 @@ _Install: ./install setupwizard (dev by default)._ - Entry files: MainActivity.kt, Route.kt, Navigation.kt - Deps: (none declared) - Metadata: metadata_data/setupwizard.md (present)-- Rust: no / screenshotTest: no+- Rust: no / screenshotTest: yes (Wifi and Security routes are exempted in Route.kt: handoff steps with no UI of their own) ## Overview **Purpose:** First-run OS setup — language, Wi-Fi, time, location, lock, restore, bootloader warning; hands steps to owner apps, disables itself when done. Shorter secondary-user flow.@@ -36,7 +36,7 @@ _Install: ./install setupwizard (dev by default)._ - com/vayunmathur/setupwizard/ui/HandoffScreen.kt - com/vayunmathur/setupwizard/ui/FinishScreen.kt - com/vayunmathur/setupwizard/ui/components/SetupCheckboxRow.kt-- com/vayunmathur/setupwizard/ui/dialogs/LanguagePickerDialog.kt+- com/vayunmathur/setupwizard/ui/dialogs/LanguagePickerDialog.kt (stateless content for the `Route.LanguagePickerDialog` route; the route is transient in the persisted stack — SetupFlow drops it on resume) ## Verify (this module only) ```
setupwizard/src/main/java/com/vayunmathur/setupwizard/Navigation.kt
diff --git a/setupwizard/src/main/java/com/vayunmathur/setupwizard/Navigation.kt b/setupwizard/src/main/java/com/vayunmathur/setupwizard/Navigation.ktindex 00ef0612e7..2f8088adc8 100644--- a/setupwizard/src/main/java/com/vayunmathur/setupwizard/Navigation.kt+++ b/setupwizard/src/main/java/com/vayunmathur/setupwizard/Navigation.kt@@ -79,6 +79,17 @@ fun Navigation(viewModel: SetupViewModel) { onOpen = { open(it) }, onNextOemUnlock = { backStack.add(Route.OemUnlock) }, onNext = { advance(Route.Welcome) },+ onOpenLanguagePicker = { backStack.add(Route.LanguagePickerDialog) },+ )+ }+ entry<Route.LanguagePickerDialog>(metadata = com.vayunmathur.library.util.DialogPage()) {+ com.vayunmathur.setupwizard.ui.dialogs.LanguagePickerDialog(+ languages = viewModel::availableLanguages,+ onSelected = {+ viewModel.setLanguage(it)+ backStack.pop()+ },+ onDismiss = { backStack.pop() }, ) } entry<Route.OemUnlock> {
setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt
diff --git a/setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt b/setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.ktindex 94ce6e06c7..ed58bfc600 100644--- a/setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt+++ b/setupwizard/src/main/java/com/vayunmathur/setupwizard/Route.kt@@ -9,9 +9,15 @@ import kotlinx.serialization.Serializable * The order is not declared here - it depends on who is setting up, so it lives in * [com.vayunmathur.setupwizard.platform.SetupFlow]. These are only the destinations. */+// SCREENSHOT COVERAGE EXCEPTION: Wifi: handoff step with no UI of its own; it launches the system Wi-Fi setup activity and draws nothing+// SCREENSHOT COVERAGE EXCEPTION: Security: handoff step with no UI of its own; it launches the system lock-screen/biometric enrolment activities and draws nothing @Serializable sealed interface Route : NavKey { + /** Language picker dialog over [Welcome]. */+ @Serializable+ data object LanguagePickerDialog : Route+ /** Greeting, language, accessibility, and the unlocked-bootloader warning. */ @Serializable data object Welcome : Route
setupwizard/src/main/java/com/vayunmathur/setupwizard/platform/SetupFlow.kt
diff --git a/setupwizard/src/main/java/com/vayunmathur/setupwizard/platform/SetupFlow.kt b/setupwizard/src/main/java/com/vayunmathur/setupwizard/platform/SetupFlow.ktindex d29759a519..020cadc4f9 100644--- a/setupwizard/src/main/java/com/vayunmathur/setupwizard/platform/SetupFlow.kt+++ b/setupwizard/src/main/java/com/vayunmathur/setupwizard/platform/SetupFlow.kt@@ -61,6 +61,7 @@ object SetupFlow { Route.Migration to "migration", Route.Gestures to "gestures", Route.Finish to "finish",+ Route.LanguagePickerDialog to "language-picker", ) fun encodeStack(stack: List<Route>): String =@@ -88,6 +89,9 @@ object SetupFlow { var lastIndex = -1 for (route in parsed) { if (route == null) break+ // The language picker is a transient dialog over Welcome, not a+ // step: a stack persisted while it was open resumes at Welcome.+ if (route == Route.LanguagePickerDialog) break if (route == Route.OemUnlock) { // The diversion only ever sits directly after Welcome, and only the // device owner is ever diverted to it.
setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeScreen.kt
diff --git a/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeScreen.kt b/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeScreen.ktindex 8f7637e29f..72e964c231 100644--- a/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeScreen.kt+++ b/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeScreen.kt@@ -8,10 +8,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource@@ -27,7 +23,6 @@ import com.vayunmathur.library.ui.Spacing import com.vayunmathur.library.ui.Text import com.vayunmathur.setupwizard.R import com.vayunmathur.setupwizard.platform.SetupUiState-import com.vayunmathur.setupwizard.ui.dialogs.LanguagePickerDialog import java.util.Locale /**@@ -45,8 +40,8 @@ fun WelcomeScreen( onAccessibility: () -> Unit, onEmergencyCall: (() -> Unit)?, onNext: () -> Unit,+ onOpenLanguagePicker: () -> Unit = {}, ) {- var pickingLanguage by remember { mutableStateOf(false) } SetupScaffold( title = stringResource(R.string.welcome_to_modern_apps_os),@@ -70,7 +65,7 @@ fun WelcomeScreen( EntryRow( label = state.language.ifBlank { stringResource(R.string.english_united_states) }, icon = { IconLanguage() },- onClick = { pickingLanguage = true },+ onClick = onOpenLanguagePicker, ) EntryRow( label = stringResource(R.string.accessibility),@@ -79,16 +74,6 @@ fun WelcomeScreen( ) } - if (pickingLanguage) {- LanguagePickerDialog(- languages = languages,- onSelected = {- pickingLanguage = false- onLanguageSelected(it)- },- onDismiss = { pickingLanguage = false },- )- } } /**
setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeStep.kt
diff --git a/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeStep.kt b/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeStep.ktindex 6e9d618e96..ea1da508f5 100644--- a/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeStep.kt+++ b/setupwizard/src/main/java/com/vayunmathur/setupwizard/ui/WelcomeStep.kt@@ -17,6 +17,7 @@ internal fun WelcomeStep( onOpen: (Intent) -> Unit, onNextOemUnlock: () -> Unit, onNext: () -> Unit,+ onOpenLanguagePicker: () -> Unit = {}, ) { val context = LocalContext.current LaunchedEffect(Unit) { viewModel.onEnterWelcome() }@@ -35,5 +36,6 @@ internal fun WelcomeStep( onNext = { if (viewModel.welcomeLeadsToBootloaderWarning()) onNextOemUnlock() else onNext() },+ onOpenLanguagePicker = onOpenLanguagePicker, ) }
setupwizard/src/screenshotTest/kotlin/com/vayunmathur/setupwizard/ui/MetadataPreviews.kt
diff --git a/setupwizard/src/screenshotTest/kotlin/com/vayunmathur/setupwizard/ui/MetadataPreviews.kt b/setupwizard/src/screenshotTest/kotlin/com/vayunmathur/setupwizard/ui/MetadataPreviews.ktindex bed0c3f5fd..0ce2cd562d 100644--- a/setupwizard/src/screenshotTest/kotlin/com/vayunmathur/setupwizard/ui/MetadataPreviews.kt+++ b/setupwizard/src/screenshotTest/kotlin/com/vayunmathur/setupwizard/ui/MetadataPreviews.kt@@ -5,6 +5,7 @@ import androidx.compose.ui.tooling.preview.Preview import com.android.tools.screenshot.PreviewTest import com.vayunmathur.library.ui.DynamicTheme import com.vayunmathur.setupwizard.platform.SetupUiState+import com.vayunmathur.setupwizard.ui.dialogs.LanguagePickerDialog import java.util.Locale /** Phone-shaped, roughly 1080x2340 at xxhdpi. */@@ -22,10 +23,9 @@ private val fixtureState = SetupUiState( * Store listing images for `:setupwizard` in the `phone` bucket — every route with * UI of its own (welcome, OEM-unlock warning, location, migration, gestures, finish). *- * Exceptions (no UI exists to capture): `Route.Wifi` and `Route.Security` are+ * `Route.Wifi` and `Route.Security` are exempted in Route.kt: they are * `HandoffScreen` steps that draw nothing and launch the system's Wi-Fi/lock- * activities, so there is no setupwizard screen for them — capturing one would- * mean faking a system screen.+ * activities, so there is no setupwizard screen for them. * `./gradlew :setupwizard:metadata` copies renders into `metadata_data/photos/setupwizard/phone/`. */ class MetadataPreviews {@@ -71,6 +71,15 @@ class MetadataPreviews { PreviewTheme { GesturesScreen(onTryIt = {}, onSkip = {}) } } + @PreviewTest+ @Preview(name = "7-language-picker-dialog", device = PHONE, group = "phone")+ @Composable+ fun Preview7LanguagePickerDialog() {+ PreviewTheme {+ LanguagePickerDialog(languages = { listOf(Locale.US, Locale.FRENCH, Locale.GERMAN) }, onSelected = {}, onDismiss = {})+ }+ }+ @PreviewTest @Preview(name = "6-finish", device = PHONE, group = "phone", showSystemUi = true) @Composable