Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22eb7471 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by Android (Google) Code Review
Browse files

Merge "Add support for reading into a file descriptor on MTP devices."

parents c054b102 025ffd9c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -698,6 +698,14 @@ bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int gro
    fchmod(fd, perm);
    umask(mask);

    bool result = readObject(handle, fd);
    ::close(fd);
    return result;
}

bool MtpDevice::readObject(MtpObjectHandle handle, int fd) {
    ALOGD("readObject: %d", fd);

    Mutex::Autolock autoLock(mMutex);
    bool result = false;

@@ -779,7 +787,6 @@ bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int gro
    }

fail:
    ::close(fd);
    return result;
}

+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public:
                                    size_t objectSize, void* clientData);
    bool                    readObject(MtpObjectHandle handle, const char* destPath, int group,
                                    int perm);
    bool                    readObject(MtpObjectHandle handle, int fd);

private:
    bool                    sendRequest(MtpOperationCode operation);