'what is requestRawExternalStorageAccess in SDK 31?

after updating compileSdk to 31 from 30 I found out requestRawExternalStorageAccess in manifest.

see this:

enter image description here

so I'm wondering what is use of this line in <application> tag of manifest?



Solution 1:[1]

This flag can only be used by apps holding

Manifest.permission.MANAGE_EXTERNAL_STORAGE permission or
android.app.role#SYSTEM_GALLERY role.

When the flag is set, all file path access on external storage will bypass database operations that update MediaStore collection. Raw external storage access as a side effect can improve performance of bulk file path operations but can cause unexpected behavior in apps due to inconsistencies in MediaStore collection and lower file system. When the flag is set, app should scan the file after file path operations to ensure consistency of MediaStore collection.

The flag can be set to false if the app doesn't do many bulk file path operations or if app prefers the system to ensure the consistency of the MediaStore collection for file path operations without scanning the file.

The default value is true if

app has Manifest.permission.MANAGE_EXTERNAL_STORAGE permission and targets targetSDK<=30.
app has android.app.role#SYSTEM_GALLERY role and targetSDK<=29
false otherwise.

docs

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nasib