From 4a57c6f6f1e4a6758cfabb4216ff0631b3ea882b Mon Sep 17 00:00:00 2001 From: maxjivi05 Date: Fri, 23 Oct 2026 20:45:14 -0400 Subject: [PATCH] chore: drop the comments this change added --- .../launcher/session/LoadingState.kt | 4 ---- .../launcher/session/SessionService.kt | 11 ----------- .../launcher/session/SteamDownloadMonitor.kt | 6 ------ .../launcher/session/LoadingStateTest.kt | 1 - .../session/SteamDownloadMonitorTest.kt | 1 - .../overlay/usr/local/bin/droiddeck-session | 2 -- .../usr/local/bin/droiddeck-steam-install | 19 ------------------- tools/tests/test_steam_install.py | 2 -- 8 files changed, 46 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/session/LoadingState.kt b/app/src/main/java/com/droiddeck/launcher/session/LoadingState.kt index e7a32fbad2..0180d67b74 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/LoadingState.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/LoadingState.kt @@ -131,10 +131,6 @@ class LoadingState(context: Context, private val steam: Boolean = true) { } } - /** - * What a Steam client download line says to show and how far it is: megabytes when the - * runtime counts them (" (2/17), 45 of 360 MB"), else the part and its number. - */ internal fun clientDownload(line: String): Pair? { val count = INSTALL_COUNT.find(line) ?: return null val mb = INSTALL_MEGABYTES.find(line.substring(count.range.last + 1)) diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 558e978e0a..e81fa0f12c 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -71,11 +71,6 @@ class SessionService : Service() { private val steamDownloadMonitor = SteamDownloadMonitor() private var downloadMonitorTask: Runnable? = null private var downloadActive = false - /** - * The runtime is fetching the Steam client itself (a first run, a repair), before anything is on - * screen. That download keeps the session awake whatever the downloads setting says: paused, a - * first run never gets as far as showing Steam. - */ private var clientInstallActive = false @Volatile private var steamLibraryMounts = emptyMap() private var suspendDownloadNow = false @@ -647,7 +642,6 @@ class SessionService : Service() { } }, ) - // Watching first: a first run's client download must be known before anything is paused. updateDownloadMonitoring() mainHandler.post { updateSuspendPolicy() } } @@ -1863,15 +1857,10 @@ class SessionService : Service() { getSystemService(NotificationManager::class.java)?.notify(NOTIFICATION_ID, buildNotification()) } - /** A download is under way that holds the session awake while it is out of sight. */ private fun downloadsKeepAwake(): Boolean = downloadActive && (steamDownloadsInBackground || clientInstallActive) && SessionState.mode == MODE_STEAM && suspendPolicy != SessionPrefs.SUSPEND_NEVER - /** - * Steam's own downloads with the downloads setting on, and the Steam client's download until the - * session shows its first frame whatever the setting: once Steam is on screen it was fetched. - */ private fun downloadWatchWanted(): Boolean = SessionState.running && SessionState.mode == MODE_STEAM && suspendPolicy != SessionPrefs.SUSPEND_NEVER && (steamDownloadsInBackground || !SessionState.firstFrameSeen) diff --git a/app/src/main/java/com/droiddeck/launcher/session/SteamDownloadMonitor.kt b/app/src/main/java/com/droiddeck/launcher/session/SteamDownloadMonitor.kt index 007b0b27a3..c125e59b80 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SteamDownloadMonitor.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SteamDownloadMonitor.kt @@ -139,11 +139,6 @@ internal class SteamDownloadMonitor { Regex("\"$key\"\\s+\"([^\"]*)\"").find(text)?.groupValues?.get(1) companion object { - /** - * The runtime has yet to fetch the Steam client: a first run, or a repair asked for or begun - * (droiddeck-steam-install drops its stamp as it starts one). That download runs before - * anything is on screen, and a paused session pauses it with the rest. - */ fun clientInstallPending(runtimeRoot: File): Boolean { val home = File(runtimeRoot, "root") val steam = File(home, ".local/share/Steam") @@ -153,7 +148,6 @@ internal class SteamDownloadMonitor { } private const val MANIFEST_PROGRESS_GRACE_MS = 8_000L - // Longer than Steam's ~60 s between rate lines, for when no traffic counter is available. private const val CONTENT_ACTIVITY_GRACE_MS = 90_000L private const val MIN_RECEIVE_BYTES_PER_SEC = 64L * 1024L private val PATH = Regex("\"path\"\\s+\"([^\"]+)\"") diff --git a/app/src/test/java/com/droiddeck/launcher/session/LoadingStateTest.kt b/app/src/test/java/com/droiddeck/launcher/session/LoadingStateTest.kt index dd545f1f51..c062823494 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/LoadingStateTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/LoadingStateTest.kt @@ -27,7 +27,6 @@ class LoadingStateTest { "bins_linuxarm64_linuxarm64" to 11, LoadingState.clientDownload("== STEP 17:38:17 downloading Steam: bins_linuxarm64_linuxarm64 (2/17)"), ) - // Under a megabyte in all: nothing to count yet. assertEquals("a_all" to 50, LoadingState.clientDownload("== STEP 00:00:00 downloading Steam: a_all (1/2), 0 of 0 MB")) } diff --git a/app/src/test/java/com/droiddeck/launcher/session/SteamDownloadMonitorTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SteamDownloadMonitorTest.kt index db9639f7af..4da943020d 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SteamDownloadMonitorTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SteamDownloadMonitorTest.kt @@ -210,7 +210,6 @@ class SteamDownloadMonitorTest { 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") diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 3eb5ff17ab..d8a44be52f 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -397,8 +397,6 @@ case $mode in steam_cef_gpu=0 fi else - # A first run downloads the client (about 360 MB in 2026): minutes on a slow connection, with - # the progress in megabytes on the loading screen. step "checking the Steam client (first run downloads it, ~1-2 min with nothing on screen)" droiddeck-steam-install || steam_setup_failed $? step "Steam client ready" diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-install b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-install index 291ec8ed43..334ac8f051 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-install +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-install @@ -25,8 +25,6 @@ stamp=$steam_root/package/droiddeck-installed legacy_stamp=$steam_root/package/bannerlator-installed unconfirmed=$steam_root/package/droiddeck-unconfirmed repair_request=$HOME/.bl-steam-repair -# The parts of an unfinished download: a session that ends, or loses its connection, part way -# through picks up where it stopped instead of fetching the whole client again. parts=$steam_root/package/droiddeck-download if [ -f "$legacy_stamp" ] && [ ! -f "$stamp" ]; then mv -f "$legacy_stamp" "$stamp" || true @@ -50,7 +48,6 @@ if [ -n "$fallback" ]; then fi if [ -n "$repair" ]; then echo "== STEP $(date -u +%H:%M:%S) repairing the Steam client ($repair)" - # A repair unpacks every part again - once: an interrupted one keeps what it has redone. if [ ! -f "$parts/.repair" ]; then rm -rf "$parts" mkdir -p "$parts" && : > "$parts/.repair" @@ -78,7 +75,6 @@ fi work=$(mktemp -d) trap 'rm -rf "$work"' EXIT -# A sleep that starts no process (droiddeck-session's nap): read -t on a pipe nothing writes to. nap() { [ -n "${nap_fd:-}" ] || exec {nap_fd}<> <(:) read -r -t "$1" -u "$nap_fd" _ 2>/dev/null || : @@ -88,16 +84,10 @@ size_of() { [ -f "$1" ] && n=$(wc -c < "$1") echo $((n)) } -# A connection can stall without closing (Wi-Fi power save, a phone changing networks), and -# curl's default then is to wait for ever with nothing on screen. A transfer under 4 KB/s for a -# minute is dropped and resumed from the bytes already on disk. limits=(--connect-timeout 30 --speed-limit 4096 --speed-time 60) -# Seconds between attempts that made no progress; the download fails after the last one. read -r -a delays <<< "${BL_STEAM_RETRY_DELAYS:-5 10 20 30 30}" step() { echo "== STEP $(date -u +%H:%M:%S) $*"; } -# The line the app's loading screen reads: the part, its number, and megabytes overall. A third -# argument is said after it (a stall), and is always said; otherwise only a change is. progress() { local mb=$(( (done_bytes + $(size_of "$1")) / 1000000 )) [ -z "${3:-}" ] && [ "$mb" = "${shown_mb:-}" ] && [ "$2" = "${shown_part:-}" ] && return 0 @@ -105,21 +95,16 @@ progress() { step "downloading Steam: $2 ($i/$total), $mb of $((total_bytes / 1000000)) MB${3:+ - $3}" } -# fetch URL FILE SIZE SHA256 PART: FILE complete and checked, resuming whatever is already there. fetch() { local url=$1 dest=$2 size=$3 sum=$4 part=$5 failures=0 bad=0 finished=0 before rc fd wait while :; do - # Whole once it is as long as the manifest says, or (no size given) once curl finished it. if [ -f "$dest" ] && { [ "$finished" = 1 ] || { [ "$size" -gt 0 ] && [ "$(size_of "$dest")" -ge "$size" ]; }; }; then echo "$sum $dest" | sha256sum -c --quiet 2>/dev/null && return 0 - # Bytes that do not check out are fetched whole again, a few times at most. rm -f "$dest" finished=0 bad=$((bad + 1)) [ "$bad" -lt 3 ] || { echo "droiddeck-steam-install: $part does not match its checksum" >&2; return 1; } fi before=$(size_of "$dest") - # curl's status comes back through the pipe (|| keeps set -e from ending the subshell before it - # is said); until then a progress line every 5 s. exec {fd}< <(curl -fsSL "${limits[@]}" -C - -o "$dest" "$url" && echo 0 || echo $?) until read -r -t 5 -u "$fd" rc; do if [ $? -le 128 ]; then rc=1; break; fi @@ -127,7 +112,6 @@ fetch() { done exec {fd}<&- if [ "$rc" = 0 ]; then finished=1; continue; fi - # 33: the server would not resume. Start the part over. [ "$rc" = 33 ] && rm -f "$dest" if [ "$(size_of "$dest")" -gt "$before" ]; then failures=0; else failures=$((failures + 1)); fi if [ "$failures" -gt "${#delays[@]}" ]; then @@ -189,8 +173,6 @@ total=$(grep -c . "$work/parts" 2>/dev/null || echo 0) total_bytes=$(awk '{ n += $4 } END { print n + 0 }' "$work/parts") mkdir -p "$parts" -# What an earlier attempt left for another client version is no use to this one. A part's file -# name carries its own hash, so a name still listed is the same part. for left in "$parts"/*; do [ -e "$left" ] || continue name=${left##*/} @@ -218,7 +200,6 @@ while read -r block file sum size; do rm -f "$parts/$file" done_bytes=$((done_bytes + size)) done < "$work/parts" -# Some entries are zipped with Windows separators; unzip keeps the backslash in the file name. find "$steam_root" -depth -name '*\\*' | while read -r odd; do fixed=${odd//\\//} mkdir -p "$(dirname "$fixed")" diff --git a/tools/tests/test_steam_install.py b/tools/tests/test_steam_install.py index 75bc1c5e91..54028187ca 100644 --- a/tools/tests/test_steam_install.py +++ b/tools/tests/test_steam_install.py @@ -343,7 +343,6 @@ sys.exit(28 if end < len(data) else 0) self.requests.unlink() Path(str(self.requests) + '.offsets').unlink() self.assertEqual(0, self.install().returncode) - # The next session asks only for the rest of the part it did not finish. self.assertEqual(['steam_client_steamdeck_publicbeta_linuxarm64', client], self.requested()) self.assertEqual([400000], self.offsets(client)) self.assertFalse(self.download.exists()) @@ -383,7 +382,6 @@ sys.exit(28 if end < len(data) else 0) self.assertNotEqual(0, self.install().returncode) self.assertIn(files['a_all'], self.requested()) self.requests.unlink() - # Still a repair, but what the interrupted one redid is not done a third time. self.assertEqual(0, self.install().returncode) self.assertEqual(['steam_client_steamdeck_publicbeta_linuxarm64', files['client_linuxarm64_linuxarm64']], self.requested())