As far as I can tell from the documentation and testing with the new
Storage Access Framework and Intent.ACTION_OPEN_DOCUMENT, there doesn't
seem to be a way (via an extra or otherwise) to pass with the Intent
request to open a document to only return documents from providers that
support writing (i.e. have FLAG_SUPPORTS_WRITE set). Instead, we are
forced to check a document selection made by the user (via a metadata
query) to determine if the document supports write before we attempt to
open an OutputStream or ParcelFileDescriptor in "w" mode. Is this correct,
or have I overlooked something?
This seems to be a large missing piece in the new Storage Access Framework
when attempting to allow a user to open an existing document to be edited
as it forces the user to make a selection first, then have us check if they
can write, throw and error if they cannot, and force them to pick again.
Furthermore, we cannot say that it is uncommon for documents providers not
to support writing, because even the system media documents provider (i.e.
the source for images/videos) does not support write and will throw and
IllegalArgumentException ("Media is read-only") when one attempts to write
to one of its files (as an image editing app, the most common example used
in the docs, would attempt to do). Is there a proper method with the new
SAF of limiting selections to writable providers only?
Feedback appreciated for anything I may have missed here. As it stands,
suggesting that developers use ACTION_OPEN_DOCUMENT for in-place editing
doesn't seem like a viable approach.
Dave Smith
@devuwired
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.