-
Notifications
You must be signed in to change notification settings - Fork 173
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
File system restrictions on Android 11 #1117
Comments
With jkoan’s help I got the emulator up and running and set up Navit:
Result: The map displays without any apparent issues. However, permissions for the copied map file had to be fixed manually: Original: Changed: On my phone (which had the issues described but which I have since migrated back to Android 10) all files in the Navit folder belong to Navit’s user and are at least readable and writable for owner and group – which contradicts my initial suspicion that the behavior might have to do with incorrect file ownership or permissions. However, the only way to tell for sure is to retry with Android 11. |
Just to be sure, I copied In short, I am unable to reproduce the behavior of my hardware device on the emulator. I’ll have to upgrade my device to Android 11 and reproduce it there, then check permissions, possibly try recreating the app data dir completely and see what I find. However, that will take some time as it implies downtime on a production device. |
Just out of curiosity, I reset the owner to the “incorrect” one on |
Hi, I got everything working after my phone updated to android 11. Retried with a fresh copy and it worked just fine by uploading it over USB with ADB into the navit private storage folder. After the upgrade the contents of destinations.txt is unusable just as the map that was there before, but after a first destination is set it works again fine, just the destinations from before the update are lost. At first speech did not work, but only after updating google tts by means of the playstore I noticed I had media volume set to zero, so It may have worked without updating tts too. I am aware the above does not give a clear path to success but I wanted to make clear I got everything working without changing any permission related to storage or any code in navit. I found no relevant changes to storage permissions between android 10 and 11 for regular apps.
I experienced this as |
I think the biggest problem with this description is that this is using the default location, the problem I encountered and others people are also complaining about is if you set a custom location for you maps. |
not really, the very first line in the issue describes a problem when using the private storage area |
you are referring to storage location, right? That is, filesystem path, not GPS coordinates, correct? @jandegr so you are saying all you needed to do was “touch” the files? any idea what is happening behind the scenes, i.e. what causes this to fail initially? |
Yep, I think this was the Problem all the time, because even the recent docs state that application specific directories shouldn't be a Problem. But for user defined folders I think there's a Problem because of the concept of skoped storage. |
I think the symptoms I experienced and the context are exactly what you described in the first two lines of your opening post. I would advise anybody on android 10 to keep a good copy of any custom bin's xml's (and destination.txt if of importance) on a desktop. If after an upgrade to android 11 problems arise, then delete the custom files in the private storage and transfer the good copy's with adb/usb. So I did "replace", not just "touch" as you suggested. I spent quite a bit of time investigating file ownership and permissions so I just thought posting the quickfix that eventually worked for me might save somebody else a few hours, who kows. If this works for somebody else and you really want to know what happened in the upgrade, the you may want to compare the custom files before and after the upgrade. Since the upgrade process is device-vendor provided, this quickfix comes with no guarantee, just informational. FYI it was on a nokia 2.2 with a fast sd card formatted as internal storage EDIT: downloading the map of "faroer" with the builtin map downloader still works and the map worked instantly after download, that confirmed the private storage folder itself was perfectly usable. EDIT: futhermore I have a banking app that is broken after the android11 upgrade and will require work from the dev's of the bank to fix it, another app only lost my credentials after the upgrade |
@jandegr I doubt the file contents change during the upgrade. After the failed upgrade, I restored my Android 10 installation and was able to use Navit again. I didn’t touch the contents of I suspect a quick fix would be to move Navit’s private data to a different location in shared storage (using MTP), then start Navit once (to recreate the folder), then copy the files back (again using MTP). I’ll try that when I have some time on my hands and can afford some downtime. |
I upgraded to Android 11 once more and tried to hunt this down a bit further today.
The message mentions inode number is 4396, which on my device refers to I also see that Navit is not creating Digging a bit deeper, I found
This is probably what directs Navit to look in After deleting cache and local data (after creating a backup, of course), Navit could access its private external storage dir (aka
Conclusion:Custom map paths may cause Navit to lose access to its private external storage after an upgrade to Android 11. The reason has to do with external storage access restrictions on Android 11:
Since I had previously set a custom map path using the built-in file browser (which starts at Solution:By the time we run into this condition, it is probably too late to automatically recover from this – the user has upgraded to Android 11, and the configured path is now out of our reach, so we likely cannot even resolve symlinks to determine whether that path can be reached by another name. Basically we have two options:
Also, we should change the default path for the custom map location file picker; I suggest we start in the app’s private external storage folder. The other button (which lacks a clear label, by the way) currently sets the path to |
I changed the default dir for the file picker. Currently, Navit.java#736 is still breaking things for us: if the path does not contain If I edit |
After upgrading to Android 11, Navit is no longer seeing any files (navit.xml or map files) in
/sdcard/Android/data/org.navitproject.navit/files
. This has still worked in Android 10.The logcat shows this message:
and a few debug messages from Navit telling us that a bunch of file access operations have failed.
Also, for file and media permission, only media access can be selected, full file access is not even available.
According to information on the net, Android 11 reversed the previous decision of locking apps out of the file system, see https://stackoverflow.com/questions/60360368/android-11-r-file-path-access and https://stackoverflow.com/questions/62782648/android-11-scoped-storage-permissions/66366102#66366102.
As far as I can see it, full filesystem access requires
MANAGE_EXTERNAL_STORAGE
permission (newly introduced in Android 11). The previousWRITE_EXTERNAL_STORAGE
becomes ineffective (i.e. does nothing) on Android 11, though iirc this affects only apps targeting SDK 30+.MANAGE_EXTERNAL_STORAGE
is subject to a PlayStore policy: Google will accept this permission only for certain use cases, and Navit likely does not fall into this category.Another new restriction is that apps can no longer access each other’s private shared storage areas, or in fact anything underneath certain paths (among them
/sdcard/Android/data
) that doesn’t belong to them. Not sure if that is what is preventing us from accessing/sdcard/Android/data/org.navitproject.navit/files
; after all, this path belongs to our app.I tried yesterday to target SDK 30, request
MANAGE_EXTERNAL_STORAGE
and grant full filesystem permissions to Navit, but still get the exact same behavior and the same error message.I have asked on Stack Overflow, with no answers so far.
@jkoan tells me he got similar reports by mail but also hasn’t figured out so far why this is not working. Any input is appreciated.
The text was updated successfully, but these errors were encountered: