简体   繁体   中英

Is it possible for READ_EXTERNAL_STORAGE to give varying degrees of access, in Android 11 depending on the circumstance?

I have two apps, both do different things but both target sdk version 30, and request READ_EXTERNAL_STORAGE permission both in the manifest and during runtime. Both are brand new and had not been installed on the device previously.

Using a samsung phone running Android 11, I then checked the permission settings on both apps and discovered this discrepancy:

  • App #1 has its permission set to "allow access to media only," which was what I expected due to the recent changes to storage access. App #2 however, had its permission set to "Allow access to manage all files."
  • When App #1 prompts the user for read permission, the message that the system displays is "Allow ____ to access photos and media on your device?" But App #2 prompts "Allow ____ to access photos, files , and media on your device?"

Is this possible? App #2 definitely does not ever request MANAGE_EXTERNAL_STORAGE, both of them only request the read permission which does work. But App #2 has the same permissions to the system file manager, that clearly can't be right.

Could it be that App #2 uses a library that uses MANAGE_EXTERNAL_STORAGE? You could compare the AndroidManifest of both apps after they are build. They are not always the same as the AndroidManifest that you wrote yourself for the app. Libraries can define their own required permissions and that will get merged into the final AndroidManifest

Found the issue. App #2 was built using androiddeployqt which for some reason was overriding the target sdk version I specified, so it was really an sdk level 28 app. I forced it to target the correct version and it now functions as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM