Loading media/mtp/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ cc_library_shared { shared_libs: [ "libasyncio", "libbase", "libutils", "liblog", "libusbhost", ], Loading media/mtp/IMtpDatabase.h +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android { class MtpDataPacket; class MtpProperty; class MtpObjectInfo; class MtpStringBuffer; class IMtpDatabase { public: Loading Loading @@ -86,7 +87,7 @@ public: virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0; virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle, MtpString& outFilePath, MtpStringBuffer& outFilePath, int64_t& outFileLength, MtpObjectFormat& outFormat) = 0; Loading media/mtp/MtpDataPacket.cpp +9 −8 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "MtpDataPacket.h" #include <algorithm> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <sys/types.h> Loading Loading @@ -129,7 +130,7 @@ Int8List* MtpDataPacket::getAInt8() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -145,7 +146,7 @@ UInt8List* MtpDataPacket::getAUInt8() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -161,7 +162,7 @@ Int16List* MtpDataPacket::getAInt16() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -177,7 +178,7 @@ UInt16List* MtpDataPacket::getAUInt16() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -193,7 +194,7 @@ Int32List* MtpDataPacket::getAInt32() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -209,7 +210,7 @@ UInt32List* MtpDataPacket::getAUInt32() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -225,7 +226,7 @@ Int64List* MtpDataPacket::getAInt64() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -241,7 +242,7 @@ UInt64List* MtpDataPacket::getAUInt64() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading media/mtp/MtpDebug.h +2 −2 Original line number Diff line number Diff line Loading @@ -18,10 +18,10 @@ #define _MTP_DEBUG_H // #define LOG_NDEBUG 0 #include <utils/Log.h> #include "MtpTypes.h" #include <log/log.h> namespace android { class MtpDebug { Loading media/mtp/MtpDevice.cpp +22 −22 Original line number Diff line number Diff line Loading @@ -262,7 +262,7 @@ void MtpDevice::initialize() { MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i]; MtpProperty* property = getDevicePropDesc(propCode); if (property) mDeviceProperties.push(property); mDeviceProperties.push_back(property); } } } Loading Loading @@ -327,7 +327,7 @@ const char* MtpDevice::getDeviceName() { } bool MtpDevice::openSession() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mSessionID = 0; mTransactionID = 0; Loading @@ -353,7 +353,7 @@ bool MtpDevice::closeSession() { } MtpDeviceInfo* MtpDevice::getDeviceInfo() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); if (!sendRequest(MTP_OPERATION_GET_DEVICE_INFO)) Loading @@ -372,7 +372,7 @@ MtpDeviceInfo* MtpDevice::getDeviceInfo() { } MtpStorageIDList* MtpDevice::getStorageIDs() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); if (!sendRequest(MTP_OPERATION_GET_STORAGE_IDS)) Loading @@ -387,7 +387,7 @@ MtpStorageIDList* MtpDevice::getStorageIDs() { } MtpStorageInfo* MtpDevice::getStorageInfo(MtpStorageID storageID) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, storageID); Loading @@ -408,7 +408,7 @@ MtpStorageInfo* MtpDevice::getStorageInfo(MtpStorageID storageID) { MtpObjectHandleList* MtpDevice::getObjectHandles(MtpStorageID storageID, MtpObjectFormat format, MtpObjectHandle parent) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, storageID); Loading @@ -426,7 +426,7 @@ MtpObjectHandleList* MtpDevice::getObjectHandles(MtpStorageID storageID, } MtpObjectInfo* MtpDevice::getObjectInfo(MtpObjectHandle handle) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); // FIXME - we might want to add some caching here Loading @@ -448,7 +448,7 @@ MtpObjectInfo* MtpDevice::getObjectInfo(MtpObjectHandle handle) { } void* MtpDevice::getThumbnail(MtpObjectHandle handle, int& outLength) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading @@ -463,7 +463,7 @@ void* MtpDevice::getThumbnail(MtpObjectHandle handle, int& outLength) { } MtpObjectHandle MtpDevice::sendObjectInfo(MtpObjectInfo* info) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); MtpObjectHandle parent = info->mParent; Loading Loading @@ -517,7 +517,7 @@ MtpObjectHandle MtpDevice::sendObjectInfo(MtpObjectInfo* info) { } bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); if (mLastSendObjectInfoTransactionID + 1 != mTransactionID || mLastSendObjectInfoObjectHandle != handle) { Loading @@ -537,7 +537,7 @@ bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) { } bool MtpDevice::deleteObject(MtpObjectHandle handle) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -572,7 +572,7 @@ MtpObjectHandle MtpDevice::getStorageID(MtpObjectHandle handle) { } MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, format); Loading @@ -589,7 +589,7 @@ MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format } MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, code); Loading @@ -609,7 +609,7 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, code); Loading @@ -633,7 +633,7 @@ bool MtpDevice::getObjectPropValue(MtpObjectHandle handle, MtpProperty* property if (property == nullptr) return false; Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -684,7 +684,7 @@ bool MtpDevice::readObjectInternal(MtpObjectHandle handle, ReadObjectCallback callback, const uint32_t* expectedLength, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -806,7 +806,7 @@ bool MtpDevice::readPartialObject(MtpObjectHandle handle, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading @@ -828,7 +828,7 @@ bool MtpDevice::readPartialObject64(MtpObjectHandle handle, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -908,7 +908,7 @@ MtpResponseCode MtpDevice::readResponse() { } int MtpDevice::submitEventRequest() { if (mEventMutex.tryLock()) { if (!mEventMutex.try_lock()) { // An event is being reaped on another thread. return -1; } Loading @@ -916,7 +916,7 @@ int MtpDevice::submitEventRequest() { // An event request was submitted, but no reapEventRequest called so far. return -1; } Mutex::Autolock autoLock(mEventMutexForInterrupt); std::lock_guard<std::mutex> lg(mEventMutexForInterrupt); mEventPacket.sendRequest(mRequestIntr); const int currentHandle = ++mCurrentEventHandle; mProcessingEvent = true; Loading @@ -925,7 +925,7 @@ int MtpDevice::submitEventRequest() { } int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { Mutex::Autolock autoLock(mEventMutex); std::lock_guard<std::mutex> lg(mEventMutex); if (!mProcessingEvent || mCurrentEventHandle != handle || !parameters) { return -1; } Loading @@ -940,7 +940,7 @@ int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { } void MtpDevice::discardEventRequest(int handle) { Mutex::Autolock autoLock(mEventMutexForInterrupt); std::lock_guard<std::mutex> lg(mEventMutexForInterrupt); if (mCurrentEventHandle != handle) { return; } Loading Loading
media/mtp/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ cc_library_shared { shared_libs: [ "libasyncio", "libbase", "libutils", "liblog", "libusbhost", ], Loading
media/mtp/IMtpDatabase.h +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android { class MtpDataPacket; class MtpProperty; class MtpObjectInfo; class MtpStringBuffer; class IMtpDatabase { public: Loading Loading @@ -86,7 +87,7 @@ public: virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0; virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle, MtpString& outFilePath, MtpStringBuffer& outFilePath, int64_t& outFileLength, MtpObjectFormat& outFormat) = 0; Loading
media/mtp/MtpDataPacket.cpp +9 −8 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "MtpDataPacket.h" #include <algorithm> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <sys/types.h> Loading Loading @@ -129,7 +130,7 @@ Int8List* MtpDataPacket::getAInt8() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -145,7 +146,7 @@ UInt8List* MtpDataPacket::getAUInt8() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -161,7 +162,7 @@ Int16List* MtpDataPacket::getAInt16() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -177,7 +178,7 @@ UInt16List* MtpDataPacket::getAUInt16() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -193,7 +194,7 @@ Int32List* MtpDataPacket::getAInt32() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -209,7 +210,7 @@ UInt32List* MtpDataPacket::getAUInt32() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -225,7 +226,7 @@ Int64List* MtpDataPacket::getAInt64() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading @@ -241,7 +242,7 @@ UInt64List* MtpDataPacket::getAUInt64() { delete result; return NULL; } result->push(value); result->push_back(value); } return result; } Loading
media/mtp/MtpDebug.h +2 −2 Original line number Diff line number Diff line Loading @@ -18,10 +18,10 @@ #define _MTP_DEBUG_H // #define LOG_NDEBUG 0 #include <utils/Log.h> #include "MtpTypes.h" #include <log/log.h> namespace android { class MtpDebug { Loading
media/mtp/MtpDevice.cpp +22 −22 Original line number Diff line number Diff line Loading @@ -262,7 +262,7 @@ void MtpDevice::initialize() { MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i]; MtpProperty* property = getDevicePropDesc(propCode); if (property) mDeviceProperties.push(property); mDeviceProperties.push_back(property); } } } Loading Loading @@ -327,7 +327,7 @@ const char* MtpDevice::getDeviceName() { } bool MtpDevice::openSession() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mSessionID = 0; mTransactionID = 0; Loading @@ -353,7 +353,7 @@ bool MtpDevice::closeSession() { } MtpDeviceInfo* MtpDevice::getDeviceInfo() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); if (!sendRequest(MTP_OPERATION_GET_DEVICE_INFO)) Loading @@ -372,7 +372,7 @@ MtpDeviceInfo* MtpDevice::getDeviceInfo() { } MtpStorageIDList* MtpDevice::getStorageIDs() { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); if (!sendRequest(MTP_OPERATION_GET_STORAGE_IDS)) Loading @@ -387,7 +387,7 @@ MtpStorageIDList* MtpDevice::getStorageIDs() { } MtpStorageInfo* MtpDevice::getStorageInfo(MtpStorageID storageID) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, storageID); Loading @@ -408,7 +408,7 @@ MtpStorageInfo* MtpDevice::getStorageInfo(MtpStorageID storageID) { MtpObjectHandleList* MtpDevice::getObjectHandles(MtpStorageID storageID, MtpObjectFormat format, MtpObjectHandle parent) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, storageID); Loading @@ -426,7 +426,7 @@ MtpObjectHandleList* MtpDevice::getObjectHandles(MtpStorageID storageID, } MtpObjectInfo* MtpDevice::getObjectInfo(MtpObjectHandle handle) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); // FIXME - we might want to add some caching here Loading @@ -448,7 +448,7 @@ MtpObjectInfo* MtpDevice::getObjectInfo(MtpObjectHandle handle) { } void* MtpDevice::getThumbnail(MtpObjectHandle handle, int& outLength) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading @@ -463,7 +463,7 @@ void* MtpDevice::getThumbnail(MtpObjectHandle handle, int& outLength) { } MtpObjectHandle MtpDevice::sendObjectInfo(MtpObjectInfo* info) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); MtpObjectHandle parent = info->mParent; Loading Loading @@ -517,7 +517,7 @@ MtpObjectHandle MtpDevice::sendObjectInfo(MtpObjectInfo* info) { } bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); if (mLastSendObjectInfoTransactionID + 1 != mTransactionID || mLastSendObjectInfoObjectHandle != handle) { Loading @@ -537,7 +537,7 @@ bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) { } bool MtpDevice::deleteObject(MtpObjectHandle handle) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -572,7 +572,7 @@ MtpObjectHandle MtpDevice::getStorageID(MtpObjectHandle handle) { } MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, format); Loading @@ -589,7 +589,7 @@ MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format } MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, code); Loading @@ -609,7 +609,7 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code, MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, code); Loading @@ -633,7 +633,7 @@ bool MtpDevice::getObjectPropValue(MtpObjectHandle handle, MtpProperty* property if (property == nullptr) return false; Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -684,7 +684,7 @@ bool MtpDevice::readObjectInternal(MtpObjectHandle handle, ReadObjectCallback callback, const uint32_t* expectedLength, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -806,7 +806,7 @@ bool MtpDevice::readPartialObject(MtpObjectHandle handle, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading @@ -828,7 +828,7 @@ bool MtpDevice::readPartialObject64(MtpObjectHandle handle, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); std::lock_guard<std::mutex> lg(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); Loading Loading @@ -908,7 +908,7 @@ MtpResponseCode MtpDevice::readResponse() { } int MtpDevice::submitEventRequest() { if (mEventMutex.tryLock()) { if (!mEventMutex.try_lock()) { // An event is being reaped on another thread. return -1; } Loading @@ -916,7 +916,7 @@ int MtpDevice::submitEventRequest() { // An event request was submitted, but no reapEventRequest called so far. return -1; } Mutex::Autolock autoLock(mEventMutexForInterrupt); std::lock_guard<std::mutex> lg(mEventMutexForInterrupt); mEventPacket.sendRequest(mRequestIntr); const int currentHandle = ++mCurrentEventHandle; mProcessingEvent = true; Loading @@ -925,7 +925,7 @@ int MtpDevice::submitEventRequest() { } int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { Mutex::Autolock autoLock(mEventMutex); std::lock_guard<std::mutex> lg(mEventMutex); if (!mProcessingEvent || mCurrentEventHandle != handle || !parameters) { return -1; } Loading @@ -940,7 +940,7 @@ int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { } void MtpDevice::discardEventRequest(int handle) { Mutex::Autolock autoLock(mEventMutexForInterrupt); std::lock_guard<std::mutex> lg(mEventMutexForInterrupt); if (mCurrentEventHandle != handle) { return; } Loading