appstore: stop downloading the base APK twice per install
- Commit
5ed27fa321e3e38275bf3d923fae48c60f4ecf50- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-07 19:38 UTC (28 days ago)
- Parents
5ceb40c
Symptom: every direct (F-Droid / Modern Apps / proprietary / Izzy) install transferred the base APK twice. The progress bar ran 0-100%, reset, and ran again, and a 200MB base cost 400MB of metered data and twice the wait before verification even started. Root cause: installFromUrl called download() unconditionally and then called downloadVerified() on the same target, which downloads the same URL again (and overwrites the file). The first call was a leftover from before downloadVerified existed (161292d30). It also sat outside the try/finally that deletes staged APKs, so a failure in that first download left a partial file behind until the 24h startup sweep. Fix: delete the redundant pre-download. downloadVerified already reports aggregate progress and size-checks with one retry. Verification: code inspection (the remaining single call site is downloadVerified for base and splits); :appstore:compileDevKotlin and :appstore:testDevUnitTest pass.
Diff
appstore/src/main/java/com/vayunmathur/appstore/data/installer/InstallCoordinator.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/installer/InstallCoordinator.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/installer/InstallCoordinator.ktindex b15a41a43b..2f08cb67f5 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/installer/InstallCoordinator.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/installer/InstallCoordinator.kt@@ -249,9 +249,6 @@ class InstallCoordinator( } val file = File(context.cacheDir, DownloadCache.apkName(app.packageName))- download(apkUrl, file, app.sizeBytes) { fraction ->- stage(app.packageName, InstallStage.Downloading(fraction))- } // Split-set versions install every file in one session: the base // plus the sibling splits sharing its versionCode. Without the set,