-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use "Storage Access Framework" to allow storing maps on external sdcard #7045
Comments
I don't think it is a working solution:
|
I love OsmAnd (F-Droid) for its offline maps, I use it frequently in many occasions and even contribute to openstreetmap in order to improve the OsmAnd maps. However, it's a real pain in the donkey (substitute with synonym) that OsmAnd cannot write to SD cards [for years already!] in LineageOS (also didn't work on a stock Sony Xperia XA OS) - instead, these massive maps use up all of my scarce internal memory. Please, do something about this permission thing. |
@cabroncito But be aware, if you use this designated app path, all OsmAnd files will be deleted, if you clear OsmAnd app data or uninstall OsmAnd. |
@vshcherb |
@Zahnstocher That might be because your ROM altered the sdcard or media_rw permissions to assign it a gid which allows apps to write. However this is a hack and not the way Google anticipated this. They tell everyone to use the Storage Access Framework. As an example OpenCamera impelements storage with SAF and it works to store pictures on the sdcard. I've just tried to put my maps on: |
I don't think that my SD card or media_rw permission is altered.
The app should always be able to access the app-specific directory without SAF. Also Android docs explicitly states that:
https://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory() getExternalFilesDir returns the app-specific directory path |
Tell me how to turn on debug logs for osmand and then I can tell you why it doesn't work on my device. |
I don't think that there is a setting to turn on debug. By the way, I'm not able to reproduce this issue on Android emulator with official Google Android P and Q images: I guess something is special with your ROM? |
@Zahnstocher I'm concerned it will be even more cumbersome unfortunately especially for people who will run out of default path. Though even default path will be cumbersome. |
@vshcherb Google Play requires targetSdkVersion 28 for app updates by November 1 2019, thus it will very likely be 29 or above one year later. If OsmAnd targets Android API 29, I think the only way to share the same directory (for maps / favorites) will be to use SAF. A hint for NDK: In native C++ code you can open this fd: You may find some SAF examples: |
@Zahnstocher Thanks for replying!!
On a Sony Xperia XA (Stock ROM) about 1 year ago I installed F-Droid and then OsmAnd, set the map path to sdcard (only 1 partition FAT32) and downloaded a map, which, after finishing the download, did not appear in Osmand. I repeated the download several times, tried with different maps - nothing worked; until I changed the map data folder to internal. Then with the very next download the map was usable. Other users who are reporting write permission issues with SDcards with the same phone/LOS: If I remember correctly, especially Sony users have been experiencing problems with OsmAnd and SDcards. If of any help, I can run some more tests next week with a Xiaomi Redmi Note 4 (Mediatek CPU, Android 6 Stock ROM), Unihertz Jelly Pro (Android 7 Stock ROM) and a Sony Xperia Z2 tablet (AICP ROM based on Pie). |
@cryptomilk I just noticed that you are the LineageOS - Maintainer for Sony Xperia XZ1 Compact! 👍 |
@Zahnstocher There is no Moving the maps fails, no logcat error or warning. |
The problem might be that |
I've added |
I wonder what makes your device different from others. I've never had these problems on LineageOS so far. |
@scaidermern Does your device have an external micro sdcard? If yes, which device is it? |
Yes, it has. It is a Xiaomi A1 but I also used a Motorola G4 Play and a Samsung S4 with LineageOS and OsmAnd maps on an external SD card before. |
https://source.android.com/devices/storage/traditional For adoptable storage, the sdcard needs to be encrypted. However that is not that easy with File-Based Encryption. The Xiaomi A1 is using FDE so probably you have adopted your sdcard and because of that it works ... |
https://www.xda-developers.com/android-q-storage-access-framework-scoped-storage/ |
I think it is related only to external sdcard users, so with Android Q the default option where maps are stored in a specific folder for application will work as before. |
@cryptomilk : I still don't get it, there must be a reason why this does not work with LineageOS on the G8441... Any new insights? |
I finally managed to go through it and I think this topic will be closed as having contradictive information.
Main: There no much benefit of Shared System if Android Q will stop supporting it and we don't use it by default. Main benefit is to not store Maps in 2 locations (GPX files are lightweight and another solution could be applied). The easiest option as it looks will be acquiring root on device and symlink folders. |
Work in progress - 759b2d8#diff-830bf84e0e2639b27123090a5c2871f45009f1f27e93b49bddefb8bac017106aR211 We will also need to
|
@vshcherb Based on my understanding, the ongoing work linked in the above diff is based on a wrong assumption that the
will not work on Android 11. |
It was tested on Android 11 emulator. Not all API available but read API still works |
What is the situation now with Android 11? Will there be an improvement in performance at some point? I have to have my maps on SD card because of space constraints. Downloading and indexing maps does work, but is very slow. Opening OSMAND takes a minute or two before the map is visible, which is a daily nuisance. I can't go back to Android 10 just for this, and don't wish to root for all the usual reasons. If there is no future for OSMAND I'd like to know so I can start looking for other options. I really don't want to, since OSMAND has been my main mapping and navigation tool for several years now. |
Situation is quite ambiguous, we will need to put a significant effort to implement it and I think it couldn't be expected earlier than 2021 Q3 |
Thanks for the quick response. If it's in the pipeline I'm happy. I was really quite surprised by the related changes in Android 11. I had loads of trouble sorting out access to my SD card. I'm sure many apps have had problems with it. |
This seems to be fixed as of 21st July. There were some system updates this morning, after which OSMAND+ wouldn't run, so I reinstalled it and it now starts up more quickly. Thanks to whoever has done the necessary work. |
#12046 There is a discussion going on related to Samsung devices on Android 11 with SDcard which represent > 50% of the following use cases. |
Thanks. |
@vshcherb . |
On Android 5.0+ you need to use the Storage Access Framework to allow an app to store data on an external sdcard.
An app correctly implementing this is OpenCamera (GPL), see their FAQ section. With that app storing data on the sdcard simply works.
This will fix #3904 and #3790.
The text was updated successfully, but these errors were encountered: