A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.
Keep resource selection unchanged; narrow fix to asset extraction
Commiemusclemommie61615e1f7045
diff --git a/CLAUDE.md b/CLAUDE.mdindex ce8c565..afbab47 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -233,7 +233,7 @@ In `QemuEngine.buildCommand()`: `tcg,thread=multi`, larger `tb-size` for ≥2GB## VM migration / upgrades (how the guest updates without a reset)-Asset extraction readiness fails if any bundled asset cannot be extracted, so `PodroidService` aborts startup rather than booting a mixed asset set. Extraction retries on the next app process launch; temporary-file cleanup targets only known asset destinations. Resource chips keep an existing RAM/storage selection visible when device filtering yields no fitting options, so low-memory devices do not lose their saved configuration.+Asset extraction readiness fails if any bundled asset cannot be extracted, so `PodroidService` aborts startup rather than booting a mixed asset set. Extraction retries on the next app process launch; temporary-file cleanup targets only known asset destinations.The guest system layer updates across app versions with **no VM reset and no data loss**, on both backends. The machinery:diff --git a/app/src/main/java/com/excp/podroid/ui/components/VmResourceChips.kt b/app/src/main/java/com/excp/podroid/ui/components/VmResourceChips.ktindex d0075b5..6848be6 100644--- a/app/src/main/java/com/excp/podroid/ui/components/VmResourceChips.kt+++ b/app/src/main/java/com/excp/podroid/ui/components/VmResourceChips.kt@@ -39,10 +39,9 @@ fun VmRamChips(),)val totalRamMb = DeviceResourcePolicy.deviceTotalRamMb(LocalContext.current)- val ramOptions = DeviceResourcePolicy.withCurrentOption(- DeviceResourcePolicy.ramOptionsFor(totalRamMb),- currentMb,- )+ val ramOptions = DeviceResourcePolicy.ramOptionsFor(totalRamMb).let { options ->+ if (currentMb in options) options else options + currentMb+ }FlowRow(modifier = Modifier.fillMaxWidth(),horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),@@ -141,10 +140,9 @@ fun VmStorageChips(),)val availableGb = DeviceResourcePolicy.deviceAvailableStorageGb(LocalContext.current)- val storageOptions = DeviceResourcePolicy.withCurrentOption(- DeviceResourcePolicy.storageOptionsFor(availableGb),- currentGb,- )+ val storageOptions = DeviceResourcePolicy.storageOptionsFor(availableGb).let { options ->+ if (currentGb in options) options else options + currentGb+ }FlowRow(modifier = Modifier.fillMaxWidth(),horizontalArrangement = Arrangement.spacedBy(PodroidTokens.Spacing.SM),@@ -221,6 +219,7 @@ fun VmBandwidthChips(}}+@Composableprivate fun formatRam(mb: Int): String =if (mb >= 1024) "${mb / 1024} GB" else "$mb MB"diff --git a/app/src/main/java/com/excp/podroid/util/DeviceResourcePolicy.kt b/app/src/main/java/com/excp/podroid/util/DeviceResourcePolicy.ktindex fc6cc61..e128a7f 100644--- a/app/src/main/java/com/excp/podroid/util/DeviceResourcePolicy.kt+++ b/app/src/main/java/com/excp/podroid/util/DeviceResourcePolicy.kt@@ -38,19 +38,20 @@ object DeviceResourcePolicy {return (stat.availableBytes / (1024L * 1024 * 1024)).toInt()}- /** RAM options that fit the device, leaving ~3 GB for Android. */+ /** RAM options that fit the device, leaving ~3 GB for Android. Always at+ * least the first three options, so small devices still get a usable list. */fun ramOptionsFor(totalRamMb: Long): List<Int> {val cap = totalRamMb - 3072- return RAM_OPTIONS_MB.filter { it <= cap }+ val filtered = RAM_OPTIONS_MB.filter { it <= cap }+ return if (filtered.size >= 3) filtered else RAM_OPTIONS_MB.take(3)}- /** Storage options that fit the device's free app-private space. */- fun storageOptionsFor(availableGb: Int): List<Int> =- STORAGE_OPTIONS_GB.filter { it <= availableGb }-- /** Keeps an existing setting selectable even when device filtering returns no options. */- fun withCurrentOption(options: List<Int>, current: Int): List<Int> =- if (current in options) options else options + current+ /** Storage options that fit the device's free app-private space. Always at+ * least the first three options, so small devices still get a usable list. */+ fun storageOptionsFor(availableGb: Int): List<Int> {+ val filtered = STORAGE_OPTIONS_GB.filter { it <= availableGb }+ return if (filtered.size >= 3) filtered else STORAGE_OPTIONS_GB.take(3)+ }fun nearestAtMost(options: List<Int>, target: Int): Int =options.filter { it <= target }.maxOrNull() ?: options.first()diff --git a/app/src/test/java/com/excp/podroid/util/DeviceResourcePolicyTest.kt b/app/src/test/java/com/excp/podroid/util/DeviceResourcePolicyTest.ktindex fb0cce7..0fa0e24 100644--- a/app/src/test/java/com/excp/podroid/util/DeviceResourcePolicyTest.kt+++ b/app/src/test/java/com/excp/podroid/util/DeviceResourcePolicyTest.kt@@ -39,7 +39,8 @@ class DeviceResourcePolicyTest {@Testfun ramOptionsFor_capsToLeaveHeadroomForAndroid() {- // 6 GB device: only options <= 3072 MB fit.+ // 6 GB device: only options <= 3072 MB fit, but the floor guarantees+ // at least the first three options anyway.assertEquals(listOf(512, 1024, 2048), DeviceResourcePolicy.ramOptionsFor(6_144))}@@ -49,16 +50,8 @@ class DeviceResourcePolicyTest {}@Test- fun ramOptionsFor_doesNotAdvertiseOptionsAboveCapacity() {- assertEquals(listOf(512, 1024), DeviceResourcePolicy.ramOptionsFor(4_096))- assertEquals(emptyList<Int>(), DeviceResourcePolicy.ramOptionsFor(2_048))- }-- @Test- fun withCurrentOption_keepsExistingSelectionWhenFilteredOptionsAreEmpty() {- assertEquals(listOf(512), DeviceResourcePolicy.withCurrentOption(emptyList(), 512))- assertEquals(listOf(2, 4), DeviceResourcePolicy.withCurrentOption(listOf(2, 4), 4))- assertEquals(listOf(2, 4, 8), DeviceResourcePolicy.withCurrentOption(listOf(2, 4), 8))+ fun ramOptionsFor_neverDropsBelowThreeOptions() {+ assertEquals(listOf(512, 1024, 2048), DeviceResourcePolicy.ramOptionsFor(2_048))}@Test@@ -72,8 +65,7 @@ class DeviceResourcePolicyTest {}@Test- fun storageOptionsFor_doesNotAdvertiseOptionsAboveCapacity() {- assertEquals(listOf(2, 4), DeviceResourcePolicy.storageOptionsFor(5))- assertEquals(emptyList<Int>(), DeviceResourcePolicy.storageOptionsFor(1))+ fun storageOptionsFor_neverDropsBelowThreeOptions() {+ assertEquals(listOf(2, 4, 8), DeviceResourcePolicy.storageOptionsFor(1))}}