fix: a first run's Steam client download is not paused out of sight

With the default background behavior (Manual), a session pauses as soon
as DroidDeck is hidden or the screen turns off - one second after start in
the report this came from, before the download had begun. "Keep downloads
running" did not help: it is off by default, and it only recognizes the
client's own game downloads, not the runtime fetching the client itself.

Until the session shows its first frame, the download watch now also
asks whether the client is still to be fetched (no install stamp or no
client binary, or a repair asked for). While it is, the session is kept
awake with its wake and Wi-Fi locks whatever the downloads setting says,
the notification reads "Steam download active" with Suspend now, and a
steam.client_download event marks start and end. The watch is set up
before the first suspend decision, so a session started with the screen
off is not paused first. Once the client is there, the chosen behavior
applies again.
This commit is contained in:
maxjivi05 committed 2026-10-11 14:45:57 -04:00
1 parent 342d2e7f20
commit 0cd7f07725
3 files changed
+93 -22

No files matched your search

@@ -126,6 +126,39 @@ class SteamDownloadMonitorTest {
}
}
@Test fun theClientIsPendingUntilItIsInstalledAndStamped() {
val root = Files.createTempDirectory("droiddeck-steam-client-").toFile()
try {
val steam = File(root, "root/.local/share/Steam")
assertTrue(SteamDownloadMonitor.clientInstallPending(root))
File(steam, "steamrtarm64").mkdirs()
File(steam, "steamrtarm64/steam").writeText("client")
// Unpacked but not finished: droiddeck-steam-install stamps the client last.
assertTrue(SteamDownloadMonitor.clientInstallPending(root))
File(steam, "package").mkdirs()
File(steam, "package/droiddeck-installed").writeText("1791686101\n")
assertFalse(SteamDownloadMonitor.clientInstallPending(root))
} finally {
root.deleteRecursively()
}
}
@Test fun anOlderStampCountsAndARepairRequestIsPending() {
val root = Files.createTempDirectory("droiddeck-steam-client-").toFile()
try {
val steam = File(root, "root/.local/share/Steam")
File(steam, "steamrtarm64").mkdirs()
File(steam, "steamrtarm64/steam").writeText("client")
File(steam, "package").mkdirs()
File(steam, "package/bannerlator-installed").writeText("1\n")
assertFalse(SteamDownloadMonitor.clientInstallPending(root))
File(root, "root/.bl-steam-repair").writeText("1\n")
assertTrue(SteamDownloadMonitor.clientInstallPending(root))
} finally {
root.deleteRecursively()
}
}
private fun manifest(root: File, appId: String, downloaded: Long, total: Long, flags: Int): File {
val file = File(root, "steamapps/appmanifest_$appId.acf")
check(file.parentFile?.mkdirs() != false)