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
case.
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
Bug: 194539422
Bug: 197302116
Change-Id: Id6349b7b49cf682c6703333bc96f1b7046b7700e
Merged-In: Id6349b7b49cf682c6703333bc96f1b7046b7700e
1 file changed