Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve power usage by not trying to do stuff in background during flight mode #13008

Closed
SvenLieber opened this issue May 15, 2024 · 3 comments · Fixed by #13262
Closed

Improve power usage by not trying to do stuff in background during flight mode #13008

SvenLieber opened this issue May 15, 2024 · 3 comments · Fixed by #13262

Comments

@SvenLieber
Copy link

Is your feature request related to a problem? Please describe.

There is a high battery usage by Nextcloud even when I am in flight mode. When I am already on a lower battery it can happen that the phone turns off at night and I don't even have an alarm in the morning which is frustrating. I am aware that there are obvious solutions which I also list below. But I still think that there could be also a technical solution in which the Nextcloud app behaves more smart.

Describe the solution you'd like

I am aware that I explicitly turned of the "power save check" in Nextcloud to let auto-upload work efficiently.
However, for moments when I (also explicitly) turn the phone into flight mode I would expect Nextcloud to be smart and "knowing" that there currently is no Internet and thus no reason to perform auto-uploading or other background tasks.
I am not an Android developer, so I don't know if it is technically possible to fix this issue.
But I would imagine some sort of check that Nextcloud only wakes up and tries to do uploads when the phone is not in flight mode.

Describe alternatives you've considered

  • Obviously having the phone charged is a workaround. I try my best to have it charged
  • Charging the phone overnight. Something I don't want to do.
  • Enable the power save check in the auto-upload menu every time before I go to flight mode for saving battery.
  • Additionally change the launch settings for Nextcloud in the global battery settings to avoid running in background every time before I go to flight mode for saving battery.

Both technical solutions to manually turn on power saving and later torn it off again seem a bit overkill considering that this need to be done every time.

Additional context

I am aware that in the example shown in the following screenshot there is already a low battery. Something that some people might even consider a very low battery. But still, without active apps, a battery level of around 25% should be enough to survive the night if in flight mode.

nextcloud-power-draining-flight-mode

@joshtrichards
Copy link
Member

Hi @SvenLieber - Since many of these issues are specific to not only specific Android OS versions, but many other variables (some which are unknown or we'd have addressed them can you share:

  • app version
  • OS version
  • phone make/model
  • your active auto-upload configs

I completely believe you're experiencing this, but as a point of reference I do not on my Pixel 7 and I never charge it overnight either.

Nextcloud to be smart and "knowing" that there currently is no Internet and thus no reason to perform auto-uploading or other background tasks.

There really shouldn't be anything to upload if these are just media folders.

Are there any queued up or processed items in the Uploads tab overnight?

Since it's unclear what is triggering the usage, it would be potentially helpful to maybe gather logs from the device to see what it's constantly trying to do too (if you're able): https://github.com/nextcloud/android?tab=readme-ov-file#logs

@SvenLieber
Copy link
Author

Hi @joshtrichards,

my apologies for not including more context information. Because I used the enhancement issue template and not the one for bugs, I missed adding it.

  • Phone: Huawei Mate 20 Lite (SNE-LX1)
  • Phone OS version: EMUI 12.0.0.226 (C432E3R1P1) (which I think is Android 10)
  • Nextcloud version: 3.29.0 from the Google play store

For auto-upload I only have custom folders, because I started to use the SD card as default storage for WhatsApp and my Camera. Those folders weren't auto-detected after I moved them to the SD card (this also leaves me with a mixed photo/video destination folder for my camera, because the type of media is not something to select for custom-folders. Anyway, this is another problem).

Other notable things:

  • The upload queue was empty
  • When opening Settings->Auto upload it takes several minutes to show the folders (I only see a flashing Loading ...).
  • Auto-upload settings for basically all my folders
    • Only upload on unmetered Wi-FI
    • Use subfolders based on date
    • Original file will be kept in original folder
    • What to do if the file already exists? Skip uploading

Occasionally I also see the Preparing auto upload notification, but nothing is happening #12596
I checked that bug report before opening this issue, but apparently I missed the fact that a decrease in battery is also reported. I have the feeling it is related after all. Sorry for not checking more in detail.

I'd love to gather logs, but unfortunately I don't have a suitable setup at the moment (no root privileges on phone nor computer). But I have a linux VM running in Hyper-V. I could try to run adb from that. But I think this is not straightforward from what I can see from the Google search results.

@JonasMayerDev
Copy link
Collaborator

Currently, we collect the changed files all the time and only the upload process (which is independent) checks if the file is ready for upload. So we scan the file system regularly even when flight mode is active.
Currently, the advantage of that is that when for example you are on vacation and not in Wi-Fi, take a lot of images, it already collects files while not in WIFI and can directly start uploading once in WIFI. Else it could take some time (in theory about 20min but in reality with background restrictions often more than 1h) until the images are collected and ready for upload. Changing this to the behavior you suggested (not scanning file system while phone is in air plain mode / not meeting the folder requirements) would be "easy" but I am not sure if we should...?

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

Successfully merging a pull request may close this issue.

4 participants