Skip to content

fix: resolve download service flapping, QuickDownload deadlock, and improve stability - #2650

Open
yolka-wiz wants to merge 2 commits into
JunkFood02:mainfrom
yolka-wiz:fix/stability-and-troubleshooting
Open

yolka-wiz wants to merge 2 commits into
JunkFood02:mainfrom
yolka-wiz:fix/stability-and-troubleshooting

Conversation

@yolka-wiz

Copy link
Copy Markdown

Summary

This PR addresses several stability and download lifecycle issues encountered during download execution, Quick Download intents, and state restoration.

Problems Addressed

  • Foreground service flapping: DownloadService could rapidly start and stop foreground notifications when tasks transitioned between queuing and execution in DownloaderV2.
  • QuickDownload deadlock: Window attachment with TYPE_APPLICATION_OVERLAY in QuickDownloadActivity could cause window manager deadlocks on certain Android versions.
  • State threading & cancellation: Compose snapshot state updates during task/backup recovery could trigger race conditions or erroneous cancellations of completed files.
  • Notification thrashing: High-frequency progress updates saturated the Android notification manager.

Solution

  • DownloaderV2: Track active task lifecycle centrally with hasActiveTasks to stabilize foreground service start/stop triggers.
  • QuickDownloadActivity: Remove overlay window type in favor of standard activity lifecycle to prevent window deadlocks.
  • State safety & recovery: Safeguard snapshot updates during state restoration and prevent false cancellation flags on restored files.
  • Notification throttling & resumption: Throttle notification progress callbacks and support resuming partial downloads in the temporary directory.
  • Troubleshooting: Add optional debug file logging (seal_debug.log) with log rotation and export UI to facilitate diagnosing runtime issues.

…d backup recovery

- Fix foreground service flapping in DownloaderV2 by tracking active tasks
- Remove TYPE_APPLICATION_OVERLAY in QuickDownloadActivity to prevent window deadlocks
- Fix Compose snapshot state threading during backup restore in DownloaderV2
- Prevent false cancellation of existing completed files on app restore
- Support resuming partial downloads in tmp directory with aria2c
- Debounce and throttle notification progress updates
- Add bundled QuickJS JavaScript runtime detection for yt-dlp challenges
- Add Troubleshooting debug file logger (seal_debug.log) with UI export and log rotation
- Add GitHub Actions CI workflow to build generic release APKs (universal and arm64-v8a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant