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

Auto Upload on Android does not upload all images automatically due to battery optimization #416

Closed
2 tasks done
HugoNext opened this issue Feb 17, 2022 · 10 comments
Closed
2 tasks done
Labels
good first issue Issues easy to implement or with a narrow scope of changes type:bug Something isn't working
Milestone

Comments

@HugoNext
Copy link

HugoNext commented Feb 17, 2022

Please agree to the following

Summary

Auto Upload on Android does not upload all images automatically

What software is involved?

  • Operating System: Android 12 on Pixel 6
  • Cryptomator: 1.6.8 for Android

Volume Type

WebDAV

Steps to Reproduce

Configure Auto Upload so that it uploads all images via WLAN.
The Vault is synchronized via WebDAV with a Nextcloud instance.
Auto Upload is configured to immediately upload images and videos over Wi-Fi only.

The Vault is unlocked when Wi-Fi is enabled and the device is on a Wi-Fi network.

Expected Behavior

All pictures taken with the phone camera are encrypted and uploaded to the Vault.

Actual Behavior

Some days not all images are uploaded. Individual images or image series are ignored. There is no difference between the individual images. All pictures were taken with the internal camera.

This happens every few days. The behavior cannot be reproduced actively. It is not obvious what behavior causes the images not to be uploaded completely.

Reproducibility

Intermittent

Relevant Log Output

No response

Anything else?

No response

@HugoNext HugoNext added the type:bug Something isn't working label Feb 17, 2022
@SailReal SailReal transferred this issue from cryptomator/cryptomator Feb 17, 2022
@SailReal
Copy link
Member

To understand the problem exactly: Are the images not uploaded directly but later or ignored completely?

First, it would be interesting to see if the images are not captured at all or are "lost" later. Can you please activate debug mode and let it run for the next days. As soon as you notice that an image is missing, write down the name of the image. Then either send us the log file together with the name or open it yourself and search for an entry with the name of the image. The entry in the log should look something similar to
2020-08-17 09:36:40.101 12325-12325/org.cryptomator D/PhotoContentJob: Added file to UploadList /storage/emulated/0/DCIM/Camera/IMG_20200817_093619.jpg

@SailReal SailReal added the state:awaiting-response We need further input from the issue author label Feb 17, 2022
@HugoNext
Copy link
Author

The images will then no longer be uploaded at all. These are completely ignored. I have now activated the debug mode and will report back as soon as images are ignored.

@no-response no-response bot removed the state:awaiting-response We need further input from the issue author label Feb 17, 2022
@HugoNext
Copy link
Author

HugoNext commented Feb 19, 2022

So, yesterday it happened again.
I took 18 pictures with my cell phone yesterday. Of these, only the first three were uploaded by the auto uploader. The others were not uploaded to the Vault.
The filename of the first picture that was not uploaded is PXL_20220218_132640893.jpg.

I did not find this file name in the log files.
I try to upload the logfile here, I hope it works.

Yesterday I deleted the cache of the app in the hope that it works again. Now the auto upload does not work at all.

I have made today over 20 pictures and 2 videos. None of them was uploaded. I have unlocked the Vault several times while I was logged into a Wi-Fi network.

I also took a picture today while the Vault was unlocked and the phone was on Wi-Fi. This photo was also ignored by the auto uploader.

1.txt

@SailReal
Copy link
Member

Sorry for the late response and thanks for the log file.

Is it possible that you set the Battery usage of Cryptomator to Restricted? You can check it under Settings --> Apps --> Cryptomator --> Battery. You can also try to set it to Unrestricted and check if this helps 🙏

@SailReal SailReal added the state:awaiting-response We need further input from the issue author label Feb 23, 2022
@HugoNext
Copy link
Author

First of all, thanks for the answer. I just looked. it was set to optimized. I've now set it to unrestricted. I will check the behavior in the next few days. But that would mean that Cryptomator would have to run constantly in the background so that it would know when new images were created? Wouldn't it be better if the app checked which images have been added since the last upload when the auto upload starts? Surely this would be less error-prone?

@no-response no-response bot removed the state:awaiting-response We need further input from the issue author label Feb 23, 2022
@SailReal
Copy link
Member

it was set to optimized. I've now set it to unrestricted. I will check the behavior in the next few days.

Optimized should be enough, but maybe it will change something, I'm curious about your feedback.

But that would mean that Cryptomator would have to run constantly in the background so that it would know when new images were created? Wouldn't it be better if the app checked which images have been added since the last upload when the auto upload starts? Surely this would be less error-prone?

No, its just a question of priories, if the app is e.g. Restricted background tasks are very very limited but Cryptomator doesn't consume much energy, check it yourself, go to Settings --> Battery --> Battery usage, if you normally use your phone, Cryptomator isn't even in the list.

Cryptomator doesn't scan always all files in the background but registers an observer to the system which gets notified if a new picture or video was created or modified. During the execution of this observer, we only store the path to the file which is more or less a no op for a smartphone...

@SailReal SailReal added the state:awaiting-response We need further input from the issue author label Feb 23, 2022
@HugoNext
Copy link
Author

So since I set Cryptomator to unrestricted it seems to be working.
All pictures and videos were uploaded as I expected. Apparently my Pixel 6 killed the app in the background, so Cryptomator didn't notice that new pictures were taken.

I will continue to monitor this and give feedback again in the next few days or weeks.

@no-response no-response bot removed the state:awaiting-response We need further input from the issue author label Feb 27, 2022
@SailReal
Copy link
Member

So since I set Cryptomator to unrestricted it seems to be working.

Awesome, that means we will request this permission if auto upload gets enabled.

Apparently my Pixel 6 killed the app in the background, so Cryptomator didn't notice that new pictures were taken.

Kind of, Cryptomator isn't always running in the background but it seams that we aren't always allowed to execute the background job if not Restricted is set.

I will continue to monitor this and give feedback again in the next few days or weeks.

Thank you 🙂

@SailReal SailReal added this to the 1.8.0 milestone Feb 27, 2022
@SailReal SailReal added the good first issue Issues easy to implement or with a narrow scope of changes label Feb 27, 2022
@SailReal SailReal added this to To do in Good First Issues via automation Feb 27, 2022
@SailReal SailReal moved this from To do to In progress in Good First Issues Feb 27, 2022
@HugoNext
Copy link
Author

So, I have been watching the behavior of the app for the last few days/weeks now. Everything seems to be working now.
All the pictures I took with the smartphone were uploaded cleanly as soon as I was on wifi and the corresponding vault was unlocked.
Thanks for the help!

@SailReal SailReal changed the title Auto Upload on Android does not upload all images automatically Auto Upload on Android does not upload all images automatically due to battery optimization Mar 18, 2022
@SailReal
Copy link
Member

Thank you for your intensive testing and staying tuned on this issue.

Unfortunately, we can't simply request this programmatically, as some apps have been threatened with being kicked out of the App Store if they don't disable the feature again, but it would be nice and easy for the user:

Instead, we need to guide the user to do this and can only redirect that user to the appropriate setting which is really annoying:

Good First Issues automation moved this from In progress to Done Mar 18, 2022
@SailReal SailReal modified the milestones: 1.8.0, 1.7.2 Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues easy to implement or with a narrow scope of changes type:bug Something isn't working
Projects
Development

No branches or pull requests

2 participants