Android 4.4 contained a number of interesting and very powerful features for developers, many of which went unused or misunderstood for quite a long time. Since it was introduced in KitKat, The Storage Access Framework (SAF) may be one of the best examples of an API that has been underutilized, despite offering a great method to provide cleaner and more informative interfaces. I even theorized that it may ultimately take the place of file system access. A big limiting factor of the SAF has been its very granular interaction with files. With the L release, that hinderance is going away as the Storage Access Framework has been expanded to allow providers to grant full read and write access to entire subdirectories.
These extensions to the SAF allow apps to perform all of the normal file operations including: read, write, create, rename, and delete. Each of those actions will still depend upon the provider implementing them, but those options are there if developers allow them. Any app that is granted access to a folder isn't just limited to the files in that path, but all files and folders beneath it.
Now apps will be able to request access to large numbers of files for batch operations, like modifying groups of photos or merging multiple videos, without repeated taps for each desired file. This isn't going to cover every possible use case, but it brings the Storage Access Framework considerably closer to a complete solution. It'll be great to see what developers can do with this!
The L Developer Preview extends the Storage Access Framework to let users select an entire directory subtree, giving apps read/write access to all contained documents without requiring user confirmation for each item.
To select a directory subtree, build and send an
Intent. The system displays all
DocumentsProviderinstances that support subtree selection, letting the user browse and select a directory. The returned URI represents access to the selected subtree. You can then use
ContentResolver.query()to explore the subtree.
DocumentsContract.createDocument()method lets you create new documents or directories anywhere under the subtree. To manage existing documents, use
DocumentsContract.Document.COLUMN_FLAGSto verify provider support for these calls before issuing them.
If you're implementing a
DocumentsProviderand want to support subtree selection, implement
The L Developer Preview also introduces new package-specific directories on shared storage where your app can place media files for inclusion in
MediaStore. The new
android.content.Context.getExternalMediaDirs()returns paths to these directories on all shared storage devices. Similarly to
Context.getExternalFilesDir(), no additional permissions are needed by your app to access the returned paths. The platform periodically scans for new media in these directories, but you can also use
MediaScannerConnectionto explicitly scan for new content.
Source: Android Developer Docs