docs: keep backup resume progress monotonic

This commit is contained in:
opencode.siil.arti.ee committed 2026-11-17 16:22:26 +00:00
1 parent f9dcb530f9
commit 0843aa3701
1 file changed
+1 -1
@@ -415,7 +415,7 @@ In the job coroutine, after device init and `devSize`:
- Backup branch:
- `imageSize = devSize` so error broadcasts report a sane total.
- Best-effort space check: `val existingSize = try { mSourceUri.getFileSize(this@WorkerService) } catch (_: Exception) { null }`; `val available = availableBytesFor(this@WorkerService, mSourceUri)`; only when both are non-null and `available < devSize - existingSize`, throw `NotEnoughSpaceForBackupException(devSize - existingSize, available)`. When the size cannot be queried, skip the pre-check rather than risk failing a resumable job.
- Broadcast the first progress intent with `processedBytes = existingSize ?: 0L`, `totalBytes = devSize`, `speed = 0f`, `isBackup = true`.
- Broadcast the first progress intent with `processedBytes = 0L`, `totalBytes = devSize`, `speed = 0f`, `isBackup = true` (the prefix-hash phase advances it to the resume offset, so the bar never moves backwards).
- `val sha256 = runBackup(blockDev, devSize, coroScope)`.
- `getFinishedIntent(mSourceUri, mDestDevice, devSize, isBackup = true, sha256 = sha256).broadcastLocallySync(this)`.
- `runBackup`: