Add directory selection to DocumentsProvider.

Introduce new ACTION_PICK_DIRECTORY that allows users to grant access
to an entire document subtree.  Instead of requiring grants for each
individual document, this leverages new prefix URI permission grants
by defining new "via"-style URIs:

content://com.example/via/12/document/24/

This references document 24 by using a prefix grant given for
document 12.  Internally, we use isChildDocument() to enforce that
24 is actually a descendant (child, grandchild, etc) of 12.  Since
this is an optional API, providers indicate support with
Root.FLAG_SUPPORTS_DIR_SELECTION.

Extend DocumentsUI to support picking directories.  Expose
createDocument() API to work with returned directories.

Offer to canonicalize via-style URIs into direct URIs, generating
exact permission grants along the way.  Override openAssetFile()
to pass through CancellationSignal.  Move testing code into ApiDemos.

Bug: 10607375
Change-Id: Ifffc1cff878870f8152eb6ca0199c5d014b9cb07
14 files changed