settings: dead toggle labelled, dead field deleted, backup gaps closed
- Commit
80c19b51909ee3ea8a47b76dd406935dccce5612- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-20 23:50 UTC (15 days ago)
- Parents
5a03791
parentalcontrols' explicit-sites toggle saved a choice nothing enforces - it now says 'Not yet enforced' instead of implying protection. Launcher TV's quickSettings was parsed and saved but never displayed - deleted (persisted stores ignore the unknown key). Backup coverage gaps: sudoku's agent omitted its own settings datastore, solitaire's omitted its settings prefs, and todo's manual export dropped datastore_default - all restored in/out settings silently. Updater (signed OS updates, on) and appstore (third-party APKs, off) auto-install rows now say 'Applies at the next scheduled check' with non-contradicting rationales. Verified: compile for all seven modules.
Diff
appstore/src/main/java/com/vayunmathur/appstore/data/SettingsRepository.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/SettingsRepository.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/SettingsRepository.ktindex 6a449034c6..7e66563daa 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/SettingsRepository.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/SettingsRepository.kt@@ -36,8 +36,9 @@ class SettingsRepository( /** * Whether the periodic update check may also download and install updates on its own,- * with no tap. Off by default: this installs apps without the user present, so it is- * strictly opt-in. With it off the same updates wait for the user to ask for them.+ * with no tap. Third-party APKs are off by default: this installs third-party APKs+ * without the user present, so it is strictly opt-in. With it off the same updates+ * wait for the user to ask for them. * Either way the install itself is silent, so this only decides who starts it. Only * ever acts on updates that install silently (see the worker). */
appstore/src/main/java/com/vayunmathur/appstore/data/UpdateCheckWorker.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/UpdateCheckWorker.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/UpdateCheckWorker.ktindex 49cfc4aec7..5d1b661d97 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/UpdateCheckWorker.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/UpdateCheckWorker.kt@@ -53,7 +53,7 @@ import java.util.concurrent.TimeUnit * it also downloads and installs — as a foreground service — the updates it can apply * silently: packages this store is the installer or update owner of, on API 31+. Everything * it can't install without a prompt is left to the notification, exactly as before.- * Auto-install is off by default.+ * Auto-install of third-party APKs is off by default. */ class UpdateCheckWorker( private val context: Context,
appstore/src/main/java/com/vayunmathur/appstore/platform/AppStoreViewModel.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/platform/AppStoreViewModel.kt b/appstore/src/main/java/com/vayunmathur/appstore/platform/AppStoreViewModel.ktindex 1120aac974..de6137a949 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/platform/AppStoreViewModel.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/platform/AppStoreViewModel.kt@@ -78,7 +78,7 @@ class AppStoreViewModel( internal val installer = InstallCoordinator(context, db, play, accrescent, viewModelScope) { ownSigningCertificates } - /** Off-by-default: the periodic check may also download and install updates unattended. */+ /** Third-party APKs are off by default: the periodic check may also download and install updates unattended. */ val autoInstallUpdates: StateFlow<Boolean> = settings.autoInstallUpdates /** The sources the user has left switched on. See [AppSource.TOGGLEABLE]. */
appstore/src/main/res/values/strings.xml
diff --git a/appstore/src/main/res/values/strings.xml b/appstore/src/main/res/values/strings.xmlindex 79dff4ec1c..c54780c02d 100644--- a/appstore/src/main/res/values/strings.xml+++ b/appstore/src/main/res/values/strings.xml@@ -90,7 +90,7 @@ <string name="updates_channel_name">App updates</string> <string name="updates_channel_description">Tells you when apps you installed here have a newer version.</string> <string name="setting_auto_install_updates_title">Automatically install updates</string>- <string name="setting_auto_install_updates_summary">When on, updates install when found. When off, they wait for a tap. Store-installed apps update silently; the rest just notify.</string>+ <string name="setting_auto_install_updates_summary">Third-party APKs are off by default. When on, updates install when found. When off, they wait for a tap. Store-installed apps update silently; the rest just notify. Applies at the next scheduled check.</string> <!-- Sources page, background update-check status card. --> <string name="setting_update_check_title">Background update checks</string> <string name="setting_update_check_last">Last checked %1$s</string>
games/solitaire/src/main/java/com/vayunmathur/games/solitaire/platform/AppBackupAgent.kt
diff --git a/games/solitaire/src/main/java/com/vayunmathur/games/solitaire/platform/AppBackupAgent.kt b/games/solitaire/src/main/java/com/vayunmathur/games/solitaire/platform/AppBackupAgent.ktindex e056681875..6004e6a309 100644--- a/games/solitaire/src/main/java/com/vayunmathur/games/solitaire/platform/AppBackupAgent.kt+++ b/games/solitaire/src/main/java/com/vayunmathur/games/solitaire/platform/AppBackupAgent.kt@@ -4,8 +4,10 @@ import com.vayunmathur.library.util.BaseBackupAgent /** Backup agent covering solitaire stats and achievement data. */ class AppBackupAgent : BaseBackupAgent() {+ // "solitaire_settings" holds the card colour scheme. Omitting it silently reset it on+ // every restore. override val prefNames: List<String>- get() = listOf("solitaire_stats")+ get() = listOf("solitaire_stats", "solitaire_settings") // The shared DataStoreUtils file, holding AchievementsManager unlocks. override val datastoreNames: List<String>
games/solitaire/src/main/res/xml/data_extraction_rules.xml
diff --git a/games/solitaire/src/main/res/xml/data_extraction_rules.xml b/games/solitaire/src/main/res/xml/data_extraction_rules.xmlindex 771f82a340..e9414c7167 100644--- a/games/solitaire/src/main/res/xml/data_extraction_rules.xml+++ b/games/solitaire/src/main/res/xml/data_extraction_rules.xml@@ -2,7 +2,8 @@ <!-- Solitaire. Audited state: the "solitaire_stats" SharedPreferences file (SolitaireStatsRepository / AppBackupAgent.prefNames) holding win counts, best- times and streaks, plus filesDir/datastore_default.preferences_pb, the shared+ times and streaks, plus the "solitaire_settings" SharedPreferences file holding+ the card colour scheme, plus filesDir/datastore_default.preferences_pb, the shared DataStoreUtils file holding the AchievementsManager unlocks. No Room database and nothing written to external storage; achievements.json is a read-only APK asset.@@ -13,8 +14,8 @@ SCOPE: solitaire declares android:backupAgent=".platform.AppBackupAgent" and does NOT set android:fullBackupOnly, so Android uses key/value backup and the <cloud-backup> section below is NOT consulted. Cloud content is exactly- AppBackupAgent's prefNames = ["solitaire_stats"] plus datastoreNames =- ["datastore_default"], which is the same data this file would have sent.+ AppBackupAgent's prefNames = ["solitaire_stats", "solitaire_settings"] plus+ datastoreNames = ["datastore_default"], which is the same data this file would have sent. <device-transfer> IS governed here, and these rules become the cloud control too if the backupAgent is ever removed. -->
games/sudoku/src/main/java/com/vayunmathur/games/sudoku/platform/AppBackupAgent.kt
diff --git a/games/sudoku/src/main/java/com/vayunmathur/games/sudoku/platform/AppBackupAgent.kt b/games/sudoku/src/main/java/com/vayunmathur/games/sudoku/platform/AppBackupAgent.ktindex 35b627d2a6..4b14cc2adc 100644--- a/games/sudoku/src/main/java/com/vayunmathur/games/sudoku/platform/AppBackupAgent.kt+++ b/games/sudoku/src/main/java/com/vayunmathur/games/sudoku/platform/AppBackupAgent.kt@@ -6,6 +6,11 @@ import com.vayunmathur.library.util.BaseBackupAgent class AppBackupAgent : BaseBackupAgent() { override val prefNames: List<String> get() = listOf("sudoku_stats") - // The shared DataStoreUtils file, holding AchievementsManager unlocks.- override val datastoreNames: List<String> get() = listOf("datastore_default")+ /**+ * Both files, or a restore silently wipes half the player's history: "settings" holds the+ * answer-mode and highlight-mistakes settings, while the shared DataStoreUtils file holds+ * the AchievementsManager unlocks. Omitting "settings" silently reset both settings on+ * every restore.+ */+ override val datastoreNames: List<String> get() = listOf("settings", "datastore_default") }
games/sudoku/src/main/res/xml/data_extraction_rules.xml
diff --git a/games/sudoku/src/main/res/xml/data_extraction_rules.xml b/games/sudoku/src/main/res/xml/data_extraction_rules.xmlindex 27bfc8fa6f..5e73d4f8f5 100644--- a/games/sudoku/src/main/res/xml/data_extraction_rules.xml+++ b/games/sudoku/src/main/res/xml/data_extraction_rules.xml@@ -2,7 +2,9 @@ <!-- Sudoku. Audited state: the "sudoku_stats" SharedPreferences file (AppBackupAgent.prefNames) holding per size-and-difficulty played/won counts,- win streaks and best times, plus filesDir/datastore_default.preferences_pb,+ win streaks and best times, plus filesDir/datastore/settings.preferences_pb+ holding the answer-mode and highlight-mistakes settings, plus+ filesDir/datastore_default.preferences_pb, the shared DataStoreUtils file holding the AchievementsManager unlocks. No Room database, no in-progress board (the puzzle lives only in the ViewModel), nothing written to external storage - achievements.json is a read-only APK@@ -12,7 +14,7 @@ NOT set android:fullBackupOnly, so Android uses key/value backup and the <cloud-backup> section below is NOT consulted. Cloud content is exactly AppBackupAgent's prefNames = ["sudoku_stats"] plus datastoreNames =- ["datastore_default"], which is the same data this file would have sent.+ ["settings", "datastore_default"], which is the same data this file would have sent. <device-transfer> IS governed here, and these rules become the cloud control too if the backupAgent is ever removed. -->
games/sudoku/src/test/java/com/vayunmathur/games/sudoku/platform/SudokuAchievementsAndMiscTest.kt
diff --git a/games/sudoku/src/test/java/com/vayunmathur/games/sudoku/platform/SudokuAchievementsAndMiscTest.kt b/games/sudoku/src/test/java/com/vayunmathur/games/sudoku/platform/SudokuAchievementsAndMiscTest.ktindex 42fbd62833..7640fbe137 100644--- a/games/sudoku/src/test/java/com/vayunmathur/games/sudoku/platform/SudokuAchievementsAndMiscTest.kt+++ b/games/sudoku/src/test/java/com/vayunmathur/games/sudoku/platform/SudokuAchievementsAndMiscTest.kt@@ -63,7 +63,7 @@ class SudokuAchievementsAndMiscTest { fun backupAgentDeclaresSudokuFiles() { val agent = AppBackupAgent() assertEquals(listOf("sudoku_stats"), agent.prefNames)- assertEquals(listOf("datastore_default"), agent.datastoreNames)+ assertEquals(listOf("settings", "datastore_default"), agent.datastoreNames) } @Test
launcher/src/main/java/com/vayunmathur/launcher/data/TvPrefs.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/data/TvPrefs.kt b/launcher/src/main/java/com/vayunmathur/launcher/data/TvPrefs.ktindex e571c25609..1d5d3a962f 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/data/TvPrefs.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/data/TvPrefs.kt@@ -11,25 +11,20 @@ import kotlinx.coroutines.flow.map data class TvSettings( /** Saved top-row packages in order, or null when the row still follows the defaults. */ val appOrder: List<String>? = null,- /** Optional settings shortcuts by the clock (`bluetooth`, `sound`, `picture`). */- val quickSettings: List<String> = emptyList(), ) private val Context.tvDataStore by preferencesDataStore(name = "tvlauncher_config") /** DataStore-backed persistence for [TvSettings] (the BackupConfig pattern, not Room). */ class TvPrefs(private val context: Context) {+ // A legacy "quick" key in an existing store is ignored: DataStore tolerates+ // unknown keys, so removing its parsing stays backward-compatible. val settings: Flow<TvSettings> = context.tvDataStore.data.map { p -> TvSettings( appOrder = p[KEY_APPS] ?.split(',') ?.map { it.trim() } ?.filter { it.isNotEmpty() },- quickSettings = p[KEY_QUICK]- ?.split(',')- ?.map { it.trim().lowercase() }- ?.filter { it.isNotEmpty() }- ?: emptyList(), ) } @@ -38,14 +33,9 @@ class TvPrefs(private val context: Context) { context.tvDataStore.edit { it[KEY_APPS] = order.joinToString(",") } } - suspend fun saveQuick(quick: List<String>) {- context.tvDataStore.edit { it[KEY_QUICK] = quick.joinToString(",") }- }- /** Shared constants and helpers for TvPrefs. */ companion object { private val KEY_APPS = stringPreferencesKey("apps")- private val KEY_QUICK = stringPreferencesKey("quick") } }
launcher/src/test/java/com/vayunmathur/launcher/data/TvPrefsTest.kt
diff --git a/launcher/src/test/java/com/vayunmathur/launcher/data/TvPrefsTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/data/TvPrefsTest.ktindex 216e756d86..0a58fe7217 100644--- a/launcher/src/test/java/com/vayunmathur/launcher/data/TvPrefsTest.kt+++ b/launcher/src/test/java/com/vayunmathur/launcher/data/TvPrefsTest.kt@@ -10,7 +10,7 @@ import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner /**- * Tests for [TvPrefs]: row order and quick-settings round-trip through+ * Tests for [TvPrefs]: row order round-trip through * DataStore, starting from [TvSettings] defaults. */ @RunWith(RobolectricTestRunner::class)@@ -42,11 +42,4 @@ class TvPrefsTest { p.saveOrder(listOf("com.example.b", "com.example.c")) assertEquals(listOf("com.example.b", "com.example.c"), p.settings.first().appOrder) }-- @Test fun quickRoundTrip() = runTest {- val p = prefs()- p.saveQuick(listOf("Bluetooth", "SOUND"))- // Quick settings are normalised to lowercase.- assertEquals(listOf("bluetooth", "sound"), p.settings.first().quickSettings)- } }
parentalcontrols/src/main/java/com/vayunmathur/parentalcontrols/ui/WebContentFiltersScreen.kt
diff --git a/parentalcontrols/src/main/java/com/vayunmathur/parentalcontrols/ui/WebContentFiltersScreen.kt b/parentalcontrols/src/main/java/com/vayunmathur/parentalcontrols/ui/WebContentFiltersScreen.ktindex e428c0d2b7..4400b471a3 100644--- a/parentalcontrols/src/main/java/com/vayunmathur/parentalcontrols/ui/WebContentFiltersScreen.kt+++ b/parentalcontrols/src/main/java/com/vayunmathur/parentalcontrols/ui/WebContentFiltersScreen.kt@@ -42,7 +42,7 @@ fun WebContentFiltersScreen( SettingsSection { SettingsSwitchRow( title = stringResource(R.string.web_filters_toggle),- supportingText = stringResource(R.string.web_filters_toggle_hint),+ supportingText = stringResource(R.string.web_filters_not_yet_enforced), checked = checked, onCheckedChange = onChange, )
parentalcontrols/src/main/res/values/strings.xml
diff --git a/parentalcontrols/src/main/res/values/strings.xml b/parentalcontrols/src/main/res/values/strings.xmlindex 3492255626..b57b7320d8 100644--- a/parentalcontrols/src/main/res/values/strings.xml+++ b/parentalcontrols/src/main/res/values/strings.xml@@ -28,6 +28,8 @@ <string name="web_filters_toggle">Filter explicit sites</string> <!-- Web content filters screen: explanation under the toggle. --> <string name="web_filters_toggle_hint">Blur explicit sites and turn on SafeSearch in supported browsers.</string>+ <!-- Web content filters screen: honest status under the toggle, which has no enforcement hook yet. -->+ <string name="web_filters_not_yet_enforced">Not yet enforced — this setting is saved, but it does not filter sites yet.</string> <!-- Bedtime screen: title, also the label of its row in Settings > Parental controls. Noun phrase. --> <string name="bedtime_title">Child bedtime</string>
todo/src/main/java/com/vayunmathur/todo/ui/TodoBackupButtons.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/ui/TodoBackupButtons.kt b/todo/src/main/java/com/vayunmathur/todo/ui/TodoBackupButtons.ktindex 2146de7d72..1a284bb224 100644--- a/todo/src/main/java/com/vayunmathur/todo/ui/TodoBackupButtons.kt+++ b/todo/src/main/java/com/vayunmathur/todo/ui/TodoBackupButtons.kt@@ -13,6 +13,9 @@ fun TodoBackupButtons() { val context = LocalContext.current BackupButtons( dbConfigs = remember { todoDbConfigs(context) },+ // TodoSettings lives in the shared datastore_default file; omitting it drops+ // settings on manual restore.+ datastoreNames = listOf("datastore_default"), dbCodec = SqlCipherDbCodec, extraFiles = emptyList(), )
updater/src/main/java/com/vayunmathur/updater/domain/AutoInstallPolicy.kt
diff --git a/updater/src/main/java/com/vayunmathur/updater/domain/AutoInstallPolicy.kt b/updater/src/main/java/com/vayunmathur/updater/domain/AutoInstallPolicy.ktindex 63c0bcb9d2..6f3029b3e5 100644--- a/updater/src/main/java/com/vayunmathur/updater/domain/AutoInstallPolicy.kt+++ b/updater/src/main/java/com/vayunmathur/updater/domain/AutoInstallPolicy.kt@@ -15,7 +15,7 @@ object AutoInstallPolicy { /** Inputs to the background auto-install decision: user settings and network state. */ data class Conditions(- /** The user's setting. Default on. */+ /** The user's setting. Signed OS updates are on by default. */ val autoInstall: Boolean, /** The user's setting. Default off. */ val meteredAllowed: Boolean,
updater/src/main/java/com/vayunmathur/updater/platform/UpdaterPreferences.kt
diff --git a/updater/src/main/java/com/vayunmathur/updater/platform/UpdaterPreferences.kt b/updater/src/main/java/com/vayunmathur/updater/platform/UpdaterPreferences.ktindex 6e44f85647..e106fe0f29 100644--- a/updater/src/main/java/com/vayunmathur/updater/platform/UpdaterPreferences.kt+++ b/updater/src/main/java/com/vayunmathur/updater/platform/UpdaterPreferences.kt@@ -9,7 +9,7 @@ package com.vayunmathur.updater.platform */ internal object UpdaterPreferences { - /** Whether to download and apply without asking. On by default. */+ /** Whether to download and apply signed OS updates without asking. Signed OS updates are on by default. */ const val AUTO_INSTALL = "updater_auto_install" /** Whether auto-install may use a metered connection. Off by default — an OTA is 1-2 GB. */
updater/src/main/res/values/strings.xml
diff --git a/updater/src/main/res/values/strings.xml b/updater/src/main/res/values/strings.xmlindex 9d6d38bf38..3357c509ac 100644--- a/updater/src/main/res/values/strings.xml+++ b/updater/src/main/res/values/strings.xml@@ -14,10 +14,10 @@ <string name="check_now">Check now</string> <string name="auto_install">Install updates automatically</string>- <string name="auto_install_desc">Download and apply updates in the background, then restart when the device is idle.</string>+ <string name="auto_install_desc">Signed OS updates are on by default. Download and apply updates in the background, then restart when the device is idle. Applies at the next scheduled check.</string> <string name="metered_allowed">Use mobile data</string>- <string name="metered_allowed_desc">Allow automatic updates over a metered connection. A full update can be over a gigabyte.</string>+ <string name="metered_allowed_desc">Allow automatic updates over a metered connection. A full update can be over a gigabyte. Applies at the next scheduled check.</string> <!-- Notification channel: the ongoing progress of a download and installation. --> <string name="channel_progress">Installing updates</string>