summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpDatabase.h
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-07-12 08:49:01 -0400
committerMike Lockwood <lockwood@android.com>2010-07-12 14:01:22 -0400
commit4714b0766ecf48f09f39b4781a5c4deafc092d49 (patch)
treec9d8f729e7b71a08b1d55cf1b167e0babe0a2acd /media/mtp/MtpDatabase.h
parent66e6c1c85c33194b1a6fc5077bd78b53a5fe9d03 (diff)
downloadframeworks_av-4714b0766ecf48f09f39b4781a5c4deafc092d49.zip
frameworks_av-4714b0766ecf48f09f39b4781a5c4deafc092d49.tar.gz
frameworks_av-4714b0766ecf48f09f39b4781a5c4deafc092d49.tar.bz2
Integrate host to device file transfer with the media provider.
MTP file transfers happen in two stages. The SendObjectInfo command sends some information about the file and reserves an ObjectHandle for the new file. The file transfer is then performed using the SendObject command. To support this in the media provider, MtpDatabase.beginSendObject receives the information from SendObjectInfo and creates an row for it in the MTP objects table for the new file. After the file transfer has completed, then MtpDatabase.endSendObject is called. In endSendObject, we run the media scanner on the new file, which will add a row to the images, audio, video or audio playlist table. To avoid the media scanner creating a second row for the file in the MTP objects table, we pass the ObjectHandle created in beginSendObject to the media scanner, which then passes it to the media provider via the content values when it performs its insert. Change-Id: I1ebcc63d6bd4404b0d3a93c703a9d3c097381d3a Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpDatabase.h')
-rw-r--r--media/mtp/MtpDatabase.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 1566a11..7feb3dc 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -27,16 +27,25 @@ class MtpDatabase {
public:
virtual ~MtpDatabase() {}
- virtual MtpObjectHandle addFile(const char* path,
+ // called from SendObjectInfo to reserve a database entry for the incoming file
+ virtual MtpObjectHandle beginSendObject(const char* path,
MtpObjectFormat format,
MtpObjectHandle parent,
MtpStorageID storage,
uint64_t size,
time_t modified) = 0;
+ // called to report success or failure of the SendObject file transfer
+ // success should signal a notification of the new object's creation,
+ // failure should remove the database entry created in beginSendObject
+ virtual void endSendObject(const char* path,
+ MtpObjectHandle handle,
+ MtpObjectFormat format,
+ bool succeeded) = 0;
+
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
- MtpObjectFormat format,
- MtpObjectHandle parent) = 0;
+ MtpObjectFormat format,
+ MtpObjectHandle parent) = 0;
virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle,
MtpObjectProperty property,