With the release of Android 11, Google decided to restrict for security reason the access to the other application folders, except for file managers and antivirus. At first glance, seems reasonable but many things went wrong and now Android 11 is much more limited.
I have an Android application that doesn’t look into other application folders, so I thought I was safe. I was wrong in so many points.
Empty Android/data directory
Listing the files in Android/data folder returns nothing. This is incorrect because Android/data contains a folder (com.mycompany.myapp) which exists and that my application can navigate to. My application has a file/folder picker which was failing there. Solution: overwrite the result with the package name of your application.
But it didn’t ended their, now Android 11 also returns nothing when listing the root folder (/) and /storage. Solutions: overwrite “storage” as result for / and use getExternalFilesDirs to find the possible sub folders of /storage.
No access for file managers
As mentioned before file managers would have access to all the previous it had access. This didn’t happen. Many file managers needed to request an update with the new permission which I guess take much more time to review from Google.
What I notice also is that most of the file managers even though had access to internal memory /Android/data folder would still not get access to the SD Card /Android/data.
Solution: Add new features in your application to copy files from/to a folder where file managers can access.
No more access to any directories
Android 11 will remove access to any directories except the media, document and application /Android/data directory. That means that if the application was using/writing files somewhere else, the files will need to be moved to the /Android/data directory.
At the same time Android 11 is making /Android/data/app not readable for any other app, even with the new MANAGE_EXTERNAL_STORAGE permission. There is now little difference between /data/data (the real app private storage) and /Android/data.
Solution: Move any files to the /Android/data/ directory if it’s your files, remove feature from your app if it’s not your files. Grant root access?
Share files no longer working
Android has a system to start an Activity with an Intent. This allows to use other applications in your application. For example, you have a text file and use the “launch” intent, Android will propose you to choose among the installed application that can open the file. If you choose the “share” intent for the file, Android might propose you applications like Dropbox, GDrive, GMail, File managers, Whatsapp. This won’t work anymore in Android 11 for files located in the application /Android/data.
Solution: First copy the file to a public directory then share this file.
Conclusion: With Android, Google started with a good intention for security reasons but it was poorly executed. I also think that with Android 11 having a SD card will be less useful as they seem to focus on only media files for the SD card. Many Android applications that are no longer actively maintained will have compatibility issues. Many apps will also have to remove feature or will be no longer working as most of the files will become private.