diff options
author | Mike Lockwood <lockwood@android.com> | 2011-01-18 11:06:19 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-01-18 11:07:11 -0800 |
commit | aa95240d9096f97aa2e2022fae8764a4386c8951 (patch) | |
tree | ee23a4189c0152e2d5528887d5861566ef5ada6f /media | |
parent | ccb3506ed1845121b94f4e27244e61a46eb19815 (diff) | |
download | frameworks_av-aa95240d9096f97aa2e2022fae8764a4386c8951.zip frameworks_av-aa95240d9096f97aa2e2022fae8764a4386c8951.tar.gz frameworks_av-aa95240d9096f97aa2e2022fae8764a4386c8951.tar.bz2 |
MTP: Fix problems with modification dates for folders and non-media files
Also removed an unnecessary parameter to MtpDatabase.endSendobject()
BUG: 3352142
Change-Id: I6fd812dcba4814956bc8bc1cbd6bd5c868197790
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media')
-rw-r--r-- | media/mtp/MtpDatabase.h | 1 | ||||
-rw-r--r-- | media/mtp/MtpServer.cpp | 13 |
2 files changed, 4 insertions, 10 deletions
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h index 6dcb931..4d9a1ae 100644 --- a/media/mtp/MtpDatabase.h +++ b/media/mtp/MtpDatabase.h @@ -42,7 +42,6 @@ public: virtual void endSendObject(const char* path, MtpObjectHandle handle, MtpObjectFormat format, - int64_t size, bool succeeded) = 0; virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp index 236cd0a..b1bd145 100644 --- a/media/mtp/MtpServer.cpp +++ b/media/mtp/MtpServer.cpp @@ -700,6 +700,9 @@ MtpResponseCode MtpServer::doSendObjectInfo() { if (ret && ret != -EEXIST) return MTP_RESPONSE_GENERAL_ERROR; chown((const char *)path, getuid(), mFileGroup); + + // SendObject does not get sent for directories, so call endSendObject here instead + mDatabase->endSendObject(path, handle, MTP_FORMAT_ASSOCIATION, MTP_RESPONSE_OK); } else { mSendObjectFilePath = path; // save the handle for the SendObject call, which should follow @@ -718,7 +721,6 @@ MtpResponseCode MtpServer::doSendObject() { MtpResponseCode result = MTP_RESPONSE_OK; mode_t mask; int ret; - uint64_t actualSize = -1; if (mSendObjectHandle == kInvalidObjectHandle) { LOGE("Expected SendObjectInfo before SendObject"); @@ -761,18 +763,11 @@ MtpResponseCode MtpServer::doSendObject() { result = MTP_RESPONSE_TRANSACTION_CANCELLED; else result = MTP_RESPONSE_GENERAL_ERROR; - } else if (mSendObjectFileSize == 0xFFFFFFFF) { - // actual size is likely > 4 gig so stat the file to compute actual length - struct stat s; - if (lstat(mSendObjectFilePath, &s) == 0) { - actualSize = s.st_size; - LOGD("actualSize: %lld\n", actualSize); - } } done: mDatabase->endSendObject(mSendObjectFilePath, mSendObjectHandle, mSendObjectFormat, - actualSize, result == MTP_RESPONSE_OK); + result == MTP_RESPONSE_OK); mSendObjectHandle = kInvalidObjectHandle; mSendObjectFormat = 0; return result; |