summaryrefslogtreecommitdiffstats
path: root/media/mtp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2011-12-01 16:58:41 -0500
committerMike Lockwood <lockwood@google.com>2011-12-02 11:08:39 -0500
commita9a46c1f53129be8fe1f3f0a6ea868d7b4c8f8f7 (patch)
tree27c6aed77ee974054e91426386a8daa23ca4bab6 /media/mtp
parent44c190826d72589f5c9e13d69e32673bd8bd7c64 (diff)
downloadframeworks_av-a9a46c1f53129be8fe1f3f0a6ea868d7b4c8f8f7.zip
frameworks_av-a9a46c1f53129be8fe1f3f0a6ea868d7b4c8f8f7.tar.gz
frameworks_av-a9a46c1f53129be8fe1f3f0a6ea868d7b4c8f8f7.tar.bz2
MTP: Add support for restricting PTP to only certain subdirectories of the storage
Bug: 5527220 Change-Id: If68e7481617ecb62abd24e2d89e6b7dfdf95ba2b Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'media/mtp')
-rw-r--r--media/mtp/MtpServer.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 51eb97f..1334e6c 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -1053,11 +1053,14 @@ MtpResponseCode MtpServer::doDeleteObject() {
int result = mDatabase->getObjectFilePath(handle, filePath, fileLength, format);
if (result == MTP_RESPONSE_OK) {
ALOGV("deleting %s", (const char *)filePath);
- deletePath((const char *)filePath);
- return mDatabase->deleteFile(handle);
- } else {
- return result;
+ result = mDatabase->deleteFile(handle);
+ // Don't delete the actual files unless the database deletion is allowed
+ if (result == MTP_RESPONSE_OK) {
+ deletePath((const char *)filePath);
+ }
}
+
+ return result;
}
MtpResponseCode MtpServer::doGetObjectPropDesc() {