Handle content uris without id in checkUriPermission
Any app that has access to exactly 1 file to a collection (E.g.
Audio, Downloads, Files, Images or Videos) can gain access (read and
write) to all files in that collection without asking for extra
permissions. The app can do this by requesting the uri grant with
FLAG_GRANT_PREFIX_URI_PERMISSION on content uri to the collection.
Don't allow the apps grant FLAG_GRANT_PREFIX_URI_PERMISSION in this
If the app is granted the read UriPerimssion on the uri without id,
don't allow the app to get global access. Then, the app gets the same
query result of the uri without read UriPermission.
Test: atest ExternalStorageHostTest
Test: atest --test-mapping packages/providers/MediaProvider
1 file changed