Fix ACCESS_MEDIA_LOCATION bypass via SAF picker

When an app uses a picker to access media files, the picker should respect the app's permissions. Currently, it is possible to bypass the ACCESS_MEDIA_LOCATION permission and get unredacted location data.

This change fixes this by having MediaProvider check the permissions of the app on whose behalf the media is being opened. When a `mediaCapabilitiesUid` is passed, MediaProvider now checks if that UID has the necessary permissions.

Bug: 326211886
Test: manual
Flag: EXEMPT BUGFIX
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:e5e47f93838e1e9a3a3a520f7c89229fc041a8c3
Merged-In: I7ad51535d5ae8a3803162f688c4794edbbcfb167
Change-Id: I7ad51535d5ae8a3803162f688c4794edbbcfb167
1 file changed