Keep Android downloads running and prevents sleep - #2587
Open
hahn-kev-bot wants to merge 2 commits into
Open
Conversation
Screen-off suspended the process mid-download. User-visible long-running work now runs inside IKeepAwake.RunAsync, which reference counts a dataSync foreground service plus a partial wake lock on Android and does nothing elsewhere. Work items still run concurrently; only the acquire/release transitions are serialized. If keep-awake cannot be established the work still runs and the user gets a copyable error toast. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep Enter/Leave paired after a failed acquire so a later download can still protect the device, and drop the arena notes file from the tree. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| } | ||
|
|
||
| if (releaseFailure is not null) | ||
| logger.LogError(releaseFailure, "Failed to stop keeping the device awake after {WorkTitle}", work.Title); |
|
|
||
| private void ReportAcquireFailure(KeepAwakeWork work, Exception exception) | ||
| { | ||
| logger.LogError(exception, "Failed to keep the device awake for {WorkTitle}", work.Title); |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
replaces #2445, keeps the screen awake when a download is running.
AI summary
On Android, a long download used to stop silently when the screen slept. This wraps user-visible work (today: project download) in a refcounted keep-awake scope: a
dataSyncforeground service plus a partial wake lock while any such work is in flight, released when the last item finishes. Other platforms no-op. Work items run concurrently; only start/stop of the OS protection is serialized.If keep-awake cannot start, the download still runs (fail open) and a copyable error toast is shown via a new
UserNotificationEvent.Call site:
CombinedProjectsService.DownloadProject(still usesTask.Runso create+sync stay off the MAUI UI thread).Test plan
dotnet test backend/FwLite/FwLiteShared.Tests --filter FullyQualifiedName~RefCountedKeepAwakeTestsMade with Cursor