-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Allow using Downloads
as a storage location
#9981
base: master
Are you sure you want to change the base?
Conversation
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/9981.apk |
CodacyLint
SpotBugs (new)
SpotBugs (master)
|
This comment was marked as off-topic.
This comment was marked as off-topic.
I tested the APK linked above on an Android 11 device (LineageOS - Fairphone 3), I'll detail below what I observed on my device. At first the Downloads folder option didn't show up in the list, even though I gave the app "Allow management of all files". I configured the Screenshots folder to be auto-uploaded, with files moved to the App folder (now Downloads). However, in the default gallery app that comes with LineageOS, they show up as all-grey images, and the reported path is:
Note that the additional |
Thanks for the analysis @rmelotte, this is still a work in progress but that info will help us get it done |
@tobiasKaminsky perhaps we should split this in two:
|
Signed-off-by: Álvaro Brey Vilas <[email protected]>
a7d7cf3
to
da591f2
Compare
Downloads
as a storage location
|
Codecov Report
@@ Coverage Diff @@
## master #9981 +/- ##
============================================
+ Coverage 31.25% 31.26% +0.01%
+ Complexity 3228 3227 -1
============================================
Files 536 536
Lines 39667 39671 +4
Branches 5462 5462
============================================
+ Hits 12396 12404 +8
+ Misses 25459 25455 -4
Partials 1812 1812
|
Hi I am just wondering why the solutions seems to be "choosing an other storage folder" - yeah I understand that "Downloads" has some kind of special handling by the system, but there are two things at least at my two devices:
The rename could be done with a file explorer or with "mv" via adb shell.
So from my point of view there has to be a solution for the original storage folders of nextcloud, too. At least for
Sorry if I am telling nothing new to you, but probably there is some new information helping you to get a full solution for the problem. |
I can confirm this behavior - even more, if I delete the created |
...and a few more observations:
|
ah, and please make 'Downloads' not the default, because i really like it to have /sdcard/nextcloud/ as storage folder, which is already difficult to configure (you have uninstall the app completely and reinstall, after that never touch the storage config. then nextcloud will use this folder because none of the three options is chosen). or add that folder to the available storage folders, too, because its already possible to use. |
Thanks for the info; this is a complicated issue to work on due to differences between android versions and manufacturers. Some more research is needed; it looks like in some phones, files in |
yeah, i can imagine. its like website dev in 2002 😅 probably worse. for me it was important to give the information about the "rename"-hack because that works at least on huawei p20 and oneplus 9 with latest android uodates installed. if i can solve it with some manual hack probably the app can do it automatically (probably with more elegance 😉) |
Quick question, does a reboot of the phone also do the trick, like renaming? |
Quick answer: No. the media scanner seems not be triggered on reboot anymore. only triggering filesystem events seems to work. i had a talk to the the author of AutoSync, and he says the app downloads the file as a tmp file, then deletes the original and then renames the tmp file to the original file. |
@AlvaroBrey on my Pixel 4, Android 12, a reboot adds the pictures to the gallery, so apparently the media scanner discovers them. |
I think moving to /Download is the way to go now with Google enforcing scoped storage. Even if some manufacturers today are not enforcing it correctly, it's probably a bug and Google will make them fix it sooner or later. As a side note, Google drive is also downloading to /Download |
from an current point of view, the nextcloud client is the only one app with this problem besides many synchronization apps which all download the files anywhere else and get there files indexed. sorry, but download folder is only the path of least resistance to say "it works, if you dont like it use another app" |
That's interesting, wonder how the other clients work, because from what I understand from the Android update note here, it doesn't seems to be allowed. |
i don't know how they do this, but it works really good on my android 12 device. i just swiched to AutoSync because it offers functionality like the nextcloud client for windows. With it (for example) i just sync my local DCIM folder, including instant upload if i make a photo and sync down from remote folder if i have made photos on a different device. the nextcloud app is now used for browsing the nextcloud for single files only. in this use case the download folder would be okay a local folder. |
What you want is two-way sync which is a slightly different issue and should be handled differently. Other apps can see the images inside DCIM because DCIM is a standard directory that the MediaStore API supports for images and videos. But I think this issue is more about downloading an arbitrary file and making it available to other apps. |
sorry, but you dont get my point if you only read my last post. what I mean is that is is not relevant where the other apps store the file, images are immediately indexed and visible within gallery apps and so on. it works with every non standard path. just an example from my phone /storage/emulated/0/SyncTest_Nextcloud/ |
Rather than trying to handle every possible use case up front would it be better to enable the Downloads folder for now? The existing setup with the private app folders effectively puts Nextcloud in a "jail" on any non-technical users phone completely destroying the WAF of Nextcloud. |
+1 to fixing the 2 year old regression bug instead of debating how for 6 months. Its already broken beyond use, so why not make it usable. |
On Android >= 10, MediaScanner won't index (either manually or automatically) files in our app's private folder. That means that other apps can't access files downloaded in Nextcloud.
To solve this, we intend to allow setting
Downloads
as a storage directory, which would be public.WRITE_EXTERNAL_STORAGE
orMANAGE_EXTERNAL_STORAGE
as we use the File API. Could be done without it using the MediaStore API directly but this is an unknown amount of work.- [ ] Media files may need to be added twice? (once to the Downloads collection and another to media)
- [ ] Ensure files are deleted from MediaScanner when deleted
Fixes #6150
Fixes #10038