Skip to content

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Dec 1, 2025

  • Tests written, or not not needed

Issue

Long-running CoroutineWorkers (like FileUploadWorker, FolderDownloadWorker) attempt to start a foreground service using setForeground() to comply with WorkManager requirements.

On some devices or Android versions, this can throw:

2025-12-01 09:32:51.500  2566-2664  FileUploadWorker  E  com.nextcloud.client
    Error caught at FileUploadWorker: 
    android.app.ForegroundServiceStartNotAllowedException: 
        startForegroundService() not allowed due to mAllowStartForeground = false
        at service com.nextcloud.client/androidx.work.impl.foreground.SystemForegroundService

2025-12-01 09:32:51.500  2566-2591  WM-GreedyScheduler  D  com.nextcloud.client
    Constraints met: Scheduling work ID WorkGenerationalId(
        workSpecId = 738d8cdc-3311-4dc3-8b3f-019043410db9, 
        generation = 0
    )

2025-12-01 09:32:51.500  2566-2664  FileUploadWorker  E  com.nextcloud.client
    FileUploadWorker stopped

Changes

Previously, this exception would fail the worker, stopping uploads/downloads unnecessarily. Instead of failing the worker, the error is logged as a warning.

Adds OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST

How to reproduce?

  1. Select a one big file (e.g. 1GB) to upload
  2. Then again select another big file to upload

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Codacy

SpotBugs

CategoryBaseNew
Bad practice4242
Correctness7474
Dodgy code267267
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3535
Performance4848
Security1818
Total494494

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16038.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants