MediaStore: Make definitions for Files table public
This provides a public API for the new MediaProvider support for
arbitrary file types. MediaProvider is no longer limited to supporting
only media (audio, video, image and playlist files).
This also allows querying across multiple media file types and supports
navigating the directory hierarchy of the media storage via database queries.
BUG: 2984284
Change-Id: I6222a6d601a4641cc7e544335e45d05b194532b1
Signed-off-by: Mike Lockwood <lockwood@google.com>
diff --git a/api/current.xml b/api/current.xml
index 0cf46eb..0df3891 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -157199,6 +157199,160 @@
>
</field>
</interface>
+<class name="MediaStore.Files"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="MediaStore.Files"
+ type="android.provider.MediaStore.Files"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="getContentUri"
+ return="android.net.Uri"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="volumeName" type="java.lang.String">
+</parameter>
+</method>
+<method name="getContentUri"
+ return="android.net.Uri"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="volumeName" type="java.lang.String">
+</parameter>
+<parameter name="rowId" type="long">
+</parameter>
+</method>
+</class>
+<interface name="MediaStore.Files.FileColumns"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.provider.MediaStore.MediaColumns">
+</implements>
+<field name="MEDIA_TYPE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""media_type""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MEDIA_TYPE_AUDIO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MEDIA_TYPE_IMAGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MEDIA_TYPE_NONE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MEDIA_TYPE_PLAYLIST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MEDIA_TYPE_VIDEO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MIME_TYPE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""mime_type""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="PARENT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""parent""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TITLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""title""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</interface>
<class name="MediaStore.Images"
extends="java.lang.Object"
abstract="false"
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index b74e76f..f111ef2 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -266,36 +266,62 @@
}
/**
- * Media provider table containing an index of all files in the storage.
- * This can be used by applications to find all documents of a particular type
- * and is also used internally by the device side MTP implementation.
- * @hide
+ * Media provider table containing an index of all files in the media storage,
+ * including non-media files. This should be used by applications that work with
+ * non-media file types (text, HTML, PDF, etc) as well as applications that need to
+ * work with multiple media file types in a single query.
*/
public static final class Files {
+ /**
+ * Get the content:// style URI for the files table on the
+ * given volume.
+ *
+ * @param volumeName the name of the volume to get the URI for
+ * @return the URI to the files table on the given volume
+ */
public static Uri getContentUri(String volumeName) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName +
"/file");
}
+ /**
+ * Get the content:// style URI for a single row in the files table on the
+ * given volume.
+ *
+ * @param volumeName the name of the volume to get the URI for
+ * @param rowId the file to get the URI for
+ * @return the URI to the files table on the given volume
+ */
public static final Uri getContentUri(String volumeName,
- long fileId) {
+ long rowId) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
- + "/file/" + fileId);
+ + "/file/" + rowId);
}
+ /**
+ * For use only by the MTP implementation.
+ * @hide
+ */
public static Uri getMtpObjectsUri(String volumeName) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName +
"/object");
}
+ /**
+ * For use only by the MTP implementation.
+ * @hide
+ */
public static final Uri getMtpObjectsUri(String volumeName,
long fileId) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
+ "/object/" + fileId);
}
- // Used to implement the MTP GetObjectReferences and SetObjectReferences commands.
+ /**
+ * Used to implement the MTP GetObjectReferences and SetObjectReferences commands.
+ * @hide
+ */
public static final Uri getMtpReferencesUri(String volumeName,
long fileId) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
@@ -310,6 +336,7 @@
/**
* The MTP format code of the file
* <P>Type: INTEGER</P>
+ * @hide
*/
public static final String FORMAT = "format";