nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.22k stars 1.75k forks source link

NextCloud remains in "powersave" mode while being whitelisted #8304

Closed EpochalEngineer closed 3 years ago

EpochalEngineer commented 3 years ago

Re-opening #2889

Original Issue:

Actual behaviour

Nextcloud app was added to "Unmonitored Apps" and in "Optimise Battery Usage" the app is listed with a gray button (=should be ignored). Power saving mode is on (permanently).

New files do not seem to be detected, "force rescan" needed to detect new file. Upload queue items (created through a forced rescan) remain in "Waiting to exit power save mode" even when (creating a new file while) charging.

This might be due to PowerUtils.java only containing a check for PowerManager.isPowerSaveMode without checking if PowerManager.isIgnoringBatteryOptimizations is true. I'm not an Android developer, I only googled around a bit.

Expected behaviour

If the Nextcloud app is whitelisted it should upload while power saving mode is on.

Steps to reproduce

  1. Get a Samsung S7 (only have this device, sorry !)
  2. Enable Power Saving mode: go to "Battery" -> Set "Power Saving Mode" to MID (customised; ensure at least "Background network usage" is enabled, rest can all be off)
  3. Whitelist attempt 1: go to "Battery" -> "Unmonitored apps", add "Nextcloud"
  4. Whitelist attempt 2: go to "Battery" -> "Battery Usage" -> 3 dots -> "Optimise Battery Usage"; ensure "All Apps" are shown; Disable button next to "Nextcloud"
  5. Open Nextcloud (with expert mode on and Screenshot folder autoupload enabled) -> "Uploads", Take screenshot => nothing happens
  6. "Force Rescan" => screenshot will appear in queue with "Waiting to exit power save mode"
  7. Put phone in charger, new screenshot, Force Rescan => same result as 6.
  8. Disable Power Saving mode => Uploads are processed and finish successfully

Environment data

Android version: 8.0.0 (Samsung Experience 9.0)

Device model: SM-G935F

Stock or customized system: Stock

Nextcloud app version: 3.2.1

Nextcloud server version: 13.0.5

Logs

Web server error log

I didn't attach this as I believe it's purely on the Android side.

Nextcloud log (data/nextcloud.log)

I didn't attach this as I believe it's purely on the Android side.

Relevant updates with Nextcloud 3.13.0 and re-tested on 3.15.1 on an LG G7 and Samsung Galaxy Tab A7

Try to "Disable power save check" in Auto upload in the top right

This option is no longer in 3.13.0. On Android 10 with an LG G7.

On this phone, when charging, power save can still be enabled, so it won't even upload when it's charging, regardless of settings.

We now directly check this, when enabling an auto-upload folder. So if you already have one folder configured, and experience problems, please turn this folder off, save, turn it on. Then you should get the option to disable power save.

I do get the option to disable power save and a second one for battery optimizations, and this does turn on the system setting "Allow background activity" for the Nextcloud app. But it still will not upload when the device itself is in "Medium power saving mode" (regardless of whether the charger is plugged in).

The above is on the LG G7 mentioned. On a Galaxy Tab A7, I only get 1 of the 2 popups, which only changes the running in background option, not the "Optimize battery usage". Setting this to "Not optimized" does not change anything either. Note that turning auto-upload on and off on that folder does give me the "disable power save / optimization" popup again only on the Tab A7, even though those settings are already turned on at this point.

With both devices, with both power settings set correctly, on nextcloud's uploads view, it still says "Waiting to exit power save mode". As described in #7019, when clicking on a file, it does attempt to try and upload (displaying a progress bar and "uploading", but then immediately goes back to saying "Waiting to exit power save mode".

tobiasKaminsky commented 3 years ago

Let us track it in the old one.