First pass at APIs for contributing new media.

MediaStore has long suffered from race conditions around creation
of new media.  For example, if developers write raw files before
inserting the MediaStore item, an in-progress media scan might pick
up the file before they could insert it.  Conversely, if developers
insert the item before writing the files, backup apps get confused
about the file not existing yet.

In addition, the new storage model in Q means that apps can't write
raw files directly to disk, so they need to insert the MediaStore
item first.

To solve this collection of issues, this CL introduces first-class
APIs for contribution of new "pending" media, which includes hiding
the pending media until explicitly published.  Apps can safely
resume pending sessions if they crash and restart, which is useful
when the media item is coming from a flaky network.  Apps can also
publish progress information about pending media, such as when a
panorama is taking several seconds to process.

Bug: 115377970
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: I6adee3c4ad1fb9db94906dd1293caaa1a09c6da0
3 files changed