Verify permissions are only held by media stack.

The WRITE_MEDIA_STORAGE permission is a very powerful permission that
grants raw storage access to all devices, and as such it's only
appropriate to be granted to the media stack. Any apps with a
user-visible component (such as Camera or Gallery apps) must go
through public MediaStore APIs, to ensure that users have meaningful
permission controls.

For example, if the end user revokes the "Music" permission from an
app, but that app still has raw access to music via
WRITE_MEDIA_STORAGE, that would be a privacy incident.

Bug: 118402224
Test: atest android.permission.cts.ProviderPermissionTest
Change-Id: Iaf649689ff9e6d4eabbdb242852c179500654b56
2 files changed