Mechanism for apps to gain write access to media.

For apps that aren't the default gallery or music app, the new storage
model in Q only allows them to read media they don't own.  We
recognize there's a valid use-case for editing or deleting media
that an app doesn't own, but we want to get the user involved to
confirm the access grant.

This is implemented using a RecoverableSecurityException, so
existing apps can continue gracefully handling a SecurityException
that they recognize.  Apps that have become aware of the new
permissions model can extract the RemoteAction and invoke it to
get the user involved and gain access.

Bug: 111892459
Test: atest android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation
Change-Id: Id410f32d860588e4d528e8c6e83a39a71ad2745c
4 files changed