fix(auto-upload): calls#16393
Conversation
0288d8e to
1fbb84f
Compare
| } | ||
|
|
||
| fun insertEntries(folder: SyncedFolder, repository: FileSystemRepository) { | ||
| val enabledTimestampMs = folder.enabledTimestampMs |
There was a problem hiding this comment.
fun SyncedFolder.shouldSkipFile already checking and isExisting is not representing existence of the sync folder it means "Also upload existing files". Function name will be change in different PR.
| .addContentUriTrigger(MediaStore.Video.Media.INTERNAL_CONTENT_URI, true) | ||
| .addContentUriTrigger(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, true) | ||
| .setTriggerContentMaxDelay(MAX_CONTENT_TRIGGER_DELAY_MS, TimeUnit.MILLISECONDS) | ||
| .setTriggerContentUpdateDelay(Duration.ofSeconds(5)) |
There was a problem hiding this comment.
Creating 5, 10 as a const value to fix MagicNumber is not good for this use case. Duration.ofSeconds(5) clearly indicates what it is.
| } | ||
| } | ||
|
|
||
| private suspend fun updateForegroundInfo(notification: Notification) { |
There was a problem hiding this comment.
ContentObserverWork should be background job.
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
8179bba to
7d13475
Compare
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16393.apk |
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
/backport to stable-3.36 |

Issue
On Android, long-running foreground jobs cannot be started while the app is in the background. Attempting to do so results in the following exception:
ContentObserverWorktriggersAutoUploadWorkerto upload files. When this happens while the app is in the background, the foreground service cannot be started, causing the auto-upload process to fail.Additionally, when the app is removed from recent apps,
ContentObserverWorkmay not be triggered at all. In that case, changed content URIs are never passed toAutoUploadWorker, which can cause auto-upload to not work.Changes
Remove duplicated and repeated worker-trigger logic, keeping only the required and correct trigger points.
Make
AutoUploadWorkera long-running foreground worker, as required for upload operations.Trigger
AutoUploadWorkeragain when the app returns to the foreground. This ensures pending uploads resume in cases where the user previously killed the app and the scheduled execution ofContentObserverWorkdid not occur.