MTP: Add support for restricting PTP to only certain subdirectories of the storage DO NOT MERGE
Bug: 5527220
Change-Id: I81d6de590ea3002118ba46eb4b6d5fe9061c998c
Signed-off-by: Mike Lockwood <lockwood@google.com>
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index dc6c011..1dcfb74 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -1053,11 +1053,14 @@
int result = mDatabase->getObjectFilePath(handle, filePath, fileLength, format);
if (result == MTP_RESPONSE_OK) {
LOGV("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() {