I recently bought a Samsung Galaxy S20 FE with Android 12, and I quickly noticed that many applications were unable to access files on the SD card. For instance, I used to access local HTML/MP3 files from different browsers or music players. On my new system, these applications can see folders and navigate through them, but can not open or even list any regular file. There is a few exceptions, e.g. Total Commander or AIMP.
Note that the phone is rooted with Magisk.
From what I understood, this is a policy change from Google which appeared on Android 11 (API/SDK 30): https://www.xda-developers.com/android-11-all-files-access-permission-form/
I tried a few solutions I could find online, for instance:
pm grant com.XXX.YYY android.permission.MANAGE_EXTERNAL_STORAGE
appops set --uid com.XXX.YYY android:legacy_storage allow
This is not working because, probably, the application (i tried with Opera) is not requesting this permission during the installation. Also, most of the solutions I could find are related to apps under development, not apps installed from the store. E.g. https://stackoverflow.com/questions/62782648/android-11-scoped-storage-permissions
A workaround I could find is to move all the files in
/storage/SD_CARD_ID/Android/data/com.XXX.YYY/files, however, this means that I have to copy these files each time I install a new app and for each app I use, which is quite stupid if I have GB's of MP3 or other media. This is also quite tedious to enter the full path in the URL bar as it is not possible to navigate to or open this folder easily.
I am therefore trying to find a way to enable the permission by default for all apps, or at least find a simple way to do it via the GUI. For instance, I tried to tweak
/etc/permissions/platforms.xml with some more or less random tries as I could not find any documentation about the syntax of this file, but nothing worked.