Allow non-RES apps to read files using File APIs if they have uri grant

Allow apps without READ_EXTERNAL_STORAGE permission to read files using
File APIs if they have read permission granted on the URI corresponding
to the file.

`getRedactionRangesForFuse` is always called in `onFileOpenForFuse`
after all the checks have passed that the calling uid can access this
file. No need to do duplicate checks in `getRedactionRangesForFuse`
again, `getRedactionRangesForFuse` only returns redaction ranges
assuming that other checks have already passed. (Add isTrashed explicit
check, as that was previously done implicitly by query into MediaStore
db by the caller, query does not return trashed items that are not owned
by the caller).

Add URI checks for other formats of MediaStore Uris, MediaProvider
grants read and write access on these Uri formats when apps use
MediaStore.createWriteRequest API.

Bug: 178599505
Test: atest ExternalStorageHostTest
Test: atest CtsScopedStorageDeviceOnlyTest
Change-Id: I03e418786f802c483ba18966c54306155ef79f92
Merged-In: I03e418786f802c483ba18966c54306155ef79f92
(cherry picked from commit 50614b34b55874b6fc9a447963b042916d683d7d)
1 file changed