... the storage list view
1. Change to ExternalStorageProvider
When available volumes have changed, it now notifies on
"content://com.android.externalstorage.documents" rather than on
"content://com.android.externalstorage.documents/root/", because it'll also
affect "content://com.android.externalstorage.documents/document/*/children".
2. Change to DocumentUI
- DirectoryLoader now won't crash when a provider returns null.
- DirectoryFragment now closes itself (i.e. emulate a back press) when a load
failed.
- It now correctly reloads contents when a volume is ejected thanks to 1.
Bug 21472170
Change-Id: Icf4bbc2ebb9067313dbbb67083cd4115b0a75c58
Per UX, default strings should have space between value and units
resulting in "12.3 GB". Add a formatting variant that returns the
various components for callers who want to build their own strings.
For now there is only one mounted emulated volume at a time, and
it's always the primary storage, so give it the default rootId to
keep old Uris working.
Change-Id: Ifcc72a91a6b397ee65dc92642153286186eb64ac
Move code for checking file extensions and MIME types from
ExternalStorageProvider into android.os.FileUtils, so it can be used by
other clients (e.g. DownloadsProvider).
BUG=20157955
Change-Id: Ib16a16af723c21fb8d2912c8917dfd68653ea6fa
Send limited broadcast intent when certain volume state changes
occur; the only customer for now is ExternalStorageProvider.
Change notification flow to be less bumpy. Pick USB icon based on
disk type, and avoid using "generic" disk labels.
Bug: 19993667
Change-Id: I263bc9e9aae2ae57eb4d1afe76da686aee5475fb
Adds logic to ExternalStorageProvider to scan non-visible volumes,
such as USB OTG devices. We use internal paths when surfacing these
volumes, which also optimizes around the FUSE daemon for public
devices. Also dumps internal state when requested.
VolumeInfo now directly contains DiskInfo, which means it's
snapshotted when sending events, avoiding teardown races. Switch
notifications to use this DiskInfo directly.
Finish wiring up new volume state, including helper methods to make
it readable/writable state clearer. Handle disks and volumes with
spaces in their labels.
Bug: 19993667
Change-Id: I5c75e5658a6415976811477aebafee7694bde0f4
Roots use a flag to indicate they have settings, and DocumentsUI
offers to launch towards someone who handles a new Settings intent.
Slight rename of browse intent for clarity.
Bug: 19993667
Change-Id: I86302ec1cfac5e435d8bc5701bdb85fb9b0dcbae
When creating or renaming files on external storage, sanitize the
requested display names to be valid FAT filenames. This also fixes
a handful of directory traversal bugs.
Also relax logic around generating display names to allow any
extension which maps to the requested MIME type. Tests to verify.
Bug: 18512473, 18504132
Change-Id: I89e632019ee145f53d9d9d2050932f8939a756af
Some mounted storage volumes may not have a user-defined label. In
those cases, use the default description for the volume.
Bug: 17781505
Change-Id: I8558ba2615c2ff2647a5d44afaec83249df466ab
Cleans up API so it consistently refers to opening or working with a
subtree of documents. Also separates isChildDocument() support from
the concept of directory tree selection.
Bug: 15429194
Change-Id: Ice66a751ff4bd0cc4d34c44c5da13a0dc4186dc9
DocumentsProviders can mark documents as supporting rename, and they
have the opportunity to change the DOCUMENT_ID as a side effect of
the rename. This supports providers that embed the display name
into DOCUMENT_ID. Issues a URI permission grant to the new document,
if any.
Adds renaming support to platform ExternalStorageProvider. Also
adds directory deletion support.
Bug: 12350110
Change-Id: Ica4b1ae6769ee994f70f6b6b2402213eebd064e0
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
When filtering and sorting, guard against missing columns to avoid
crashing entire app.
Bug: 11377065
Change-Id: I04f035c918d743bcc84592f05e3ef9ad0ebfadce
While user is actively looking at a directory, subscribe to inotify
events and notify of content changes to trigger requeries. Reference
count the observers, since multiple cursors are regularly open during
requeries.
Fix leaking cursors on activity rotation; crazy loader ID generation
is no longer needed.
Bug: 10999396
Change-Id: Iddeb08a056fee80c93df8499874705bcd213a1e2
Also always lower-case extension to extract MIME type correctly,
we may want to fix in MimeUtils at some point.
Bug: 11354402
Change-Id: I77d0c06a663cd0c4320c41553ff1980b6f9a7778
When mutation operations are waiting for a storage backend, show a
spinner in place of the save button.
Bug: 11333249
Change-Id: I2b620b4532ad977a2b60d4bdc5caa55f89021456