Loading media/mtp/MtpDevice.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -778,7 +778,27 @@ bool MtpDevice::readPartialObject(MtpObjectHandle handle, ALOGE("Failed to send a read request."); return false; } return readData(callback, NULL /* expected size */, writtenSize, clientData); return readData(callback, nullptr /* expected size */, writtenSize, clientData); } bool MtpDevice::readPartialObject64(MtpObjectHandle handle, uint64_t offset, uint32_t size, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); mRequest.setParameter(2, 0xffffffff & offset); mRequest.setParameter(3, 0xffffffff & (offset >> 32)); mRequest.setParameter(4, size); if (!sendRequest(MTP_OPERATION_GET_PARTIAL_OBJECT_64)) { ALOGE("Failed to send a read request."); return false; } return readData(callback, nullptr /* expected size */, writtenSize, clientData); } bool MtpDevice::sendRequest(MtpOperationCode operation) { Loading media/mtp/MtpDevice.h +6 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ public: uint32_t *writtenSize, ReadObjectCallback callback, void* clientData); bool readPartialObject64(MtpObjectHandle handle, uint64_t offset, uint32_t size, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData); // Starts a request to read MTP event from MTP device. It returns a request handle that // can be used for blocking read or cancel. If other thread has already been processing an // event returns -1. Loading Loading
media/mtp/MtpDevice.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -778,7 +778,27 @@ bool MtpDevice::readPartialObject(MtpObjectHandle handle, ALOGE("Failed to send a read request."); return false; } return readData(callback, NULL /* expected size */, writtenSize, clientData); return readData(callback, nullptr /* expected size */, writtenSize, clientData); } bool MtpDevice::readPartialObject64(MtpObjectHandle handle, uint64_t offset, uint32_t size, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, handle); mRequest.setParameter(2, 0xffffffff & offset); mRequest.setParameter(3, 0xffffffff & (offset >> 32)); mRequest.setParameter(4, size); if (!sendRequest(MTP_OPERATION_GET_PARTIAL_OBJECT_64)) { ALOGE("Failed to send a read request."); return false; } return readData(callback, nullptr /* expected size */, writtenSize, clientData); } bool MtpDevice::sendRequest(MtpOperationCode operation) { Loading
media/mtp/MtpDevice.h +6 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ public: uint32_t *writtenSize, ReadObjectCallback callback, void* clientData); bool readPartialObject64(MtpObjectHandle handle, uint64_t offset, uint32_t size, uint32_t *writtenSize, ReadObjectCallback callback, void* clientData); // Starts a request to read MTP event from MTP device. It returns a request handle that // can be used for blocking read or cancel. If other thread has already been processing an // event returns -1. Loading