Add QUERY_ARG_RELATED_URI to aid media placement.

We normally have strict rules about where media can be created to
help ensure that the user's content stays organized.  (For example,
"image/jpeg" can only be placed inside DCIM/ or Pictures/.)

However, when inserting an SD card from another device, it's pretty
common to find media outside of these well-defined top-level
directories.  Apps have been able to read and write pre-existing
content in these locations, but this change now provides a way for
apps to create new media "adjacent" to this pre-existing content,
subject to the following rules:

-- The top level MIME type must be in agreement.
-- The relative path on the device must be in agreement.

When a developer wants to perform an insert() which would normally
be blocked, they can provide a QUERY_ARG_RELATED_URI to allow that
operation to succeed, if it meets the rules above.

Bug: 131643582
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I767f6c541707f3e4971fe923f6bf7b15b94cd32c
4 files changed