Skip to content

fix(auto-upload): stop worker restart loop at battery charge limit - #18049

Merged
tobiasKaminsky merged 3 commits into
masterfrom
fix/auto-upload-battery-checks
Nov 18, 2026
Merged

tobiasKaminsky merged 3 commits into
masterfrom
fix/auto-upload-battery-checks

Conversation

@alperozturk96

@alperozturk96 alperozturk96 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

  • Fixes linked issue
  • Removes confusion of isCharging

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@github-actions

Copy link
Copy Markdown

SpotBugs

CategoryBaseNew
Bad practice2424
Correctness4646
Dodgy code125125
Experimental11
Malicious code vulnerability11
Multithreaded correctness1313
Performance2525
Security1515
Total250250

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 7.69231% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...xtcloud/client/jobs/autoUpload/AutoUploadWorker.kt 0.00% 9 Missing ⚠️
...tcloud/client/device/PowerManagementServiceImpl.kt 33.33% 1 Missing and 1 partial ⚠️
...m/nextcloud/client/jobs/upload/FileUploadHelper.kt 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit 007de71
Version 18049
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@JanisPlayer

Copy link
Copy Markdown

Hi @alperozturk96,

I tested the QA build of this PR side-by-side with the unpatched release app on my Samsung device while held at the 80% battery protection limit (AC powered: true, status: 4, level: 79), and also had my AI agent run a live ADB verification to confirm my test results:

  • Unpatched app: Immediately enters the SystemForegroundDispatcher / StopWorkRunnable cancellation loop (~30ms cycle), spiking system_server to >210% CPU and the app to >60% CPU.
  • This PR completely fixes the loop! All folders are checked once within ~250ms, log 🔌 Skipping: charging only folder but battery is not charging, and finish cleanly with Result.success() (0% CPU afterwards).

One small observation from the logs that the AI agent pointed out during our verification run:
Because isCharging is now false when plugged in and held at the 80% charge limit (status = 4), folders configured as "Charging only" are skipped once the battery reaches 80% even though the phone is still plugged into AC power (and isWaitingForCharging() doesn't check !overridePowerSaving yet for manual syncs). If skipping uploads while held at the charge limit is intentional, then this works as designed—just wanted to pass that along!

@tobiasKaminsky
tobiasKaminsky merged commit f778cfa into master Nov 18, 2026
26 checks passed
@tobiasKaminsky
tobiasKaminsky deleted the fix/auto-upload-battery-checks branch November 18, 2026 09:10
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.

Auto Upload high CPU usage

3 participants