MTP: Use media provider database to implement MTP device support.

Uses a new "MTP objects" table in the media provider to support basic
enumeration of the external storage file system.
Support for accessing audio, video and image metadata in the existing
media provider tables will be added in a later commit.

The C++ MtpDatabase class is now abstract, to support a proxy subclass that
calls through JNI to the Java MtpDatabase class in the media provider.

Change-Id: I90f0db5f3acc5d35ae78c27a8507edff16d14305
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2010-07-03 00:44:05 -04:00
parent 2d6c9e9c4e
commit d21eac9c70
14 changed files with 823 additions and 63 deletions

View File

@@ -239,6 +239,44 @@ public final class MediaStore {
public static final String MIME_TYPE = "mime_type";
}
/**
* Media provider interface used by MTP implementation.
* @hide
*/
public static final class MtpObjects {
public static Uri getContentUri(String volumeName) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName +
"/object");
}
public static final Uri getContentUri(String volumeName,
long objectId) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
+ "/object/" + objectId);
}
/**
* Fields for master table for all media files.
* Table also contains MediaColumns._ID, DATA, SIZE and DATE_MODIFIED.
*/
public interface ObjectColumns extends MediaColumns {
/**
* The MTP format code of the file
* <P>Type: INTEGER</P>
*/
public static final String FORMAT = "format";
/**
* The index of the parent directory of the file
* <P>Type: INTEGER</P>
*/
public static final String PARENT = "parent";
}
}
/**
* This class is used internally by Images.Thumbnails and Video.Thumbnails, it's not intended
* to be accessed elsewhere.