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

Commit 83d97c8c authored by Gloria Wang's avatar Gloria Wang Committed by Android (Google) Code Review
Browse files

Merge "64-bit file size/offset support for DRM framework"

parents 18439bee 5fc3edb1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ status_t DrmEngineBase::consumeRights(
}

status_t DrmEngineBase::setPlaybackStatus(
    int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
    int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
    return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
}

@@ -116,7 +116,7 @@ DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) {
}

status_t DrmEngineBase::openDecryptSession(
    int uniqueId, DecryptHandle* decryptHandle, int fd, int offset, int length) {
    int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
    return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
}

@@ -146,7 +146,7 @@ status_t DrmEngineBase::finalizeDecryptUnit(
}

ssize_t DrmEngineBase::pread(
    int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset) {
    int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) {
    return onPread(uniqueId, decryptHandle, buffer, numBytes, offset);
}
+12 −12
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ status_t BpDrmManagerService::consumeRights(
}

status_t BpDrmManagerService::setPlaybackStatus(
            int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
            int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
    LOGV("setPlaybackStatus");
    Parcel data, reply;

@@ -429,7 +429,7 @@ DrmConvertedStatus* BpDrmManagerService::convertData(
    if (0 != reply.dataAvail()) {
        //Filling DRM Converted Status
        const int statusCode = reply.readInt32();
        const int offset = reply.readInt32();
        const off64_t offset = reply.readInt64();

        DrmBuffer* convertedData = NULL;
        if (0 != reply.dataAvail()) {
@@ -461,7 +461,7 @@ DrmConvertedStatus* BpDrmManagerService::closeConvertSession(int uniqueId, int c
    if (0 != reply.dataAvail()) {
        //Filling DRM Converted Status
        const int statusCode = reply.readInt32();
        const int offset = reply.readInt32();
        const off64_t offset = reply.readInt64();

        DrmBuffer* convertedData = NULL;
        if (0 != reply.dataAvail()) {
@@ -515,15 +515,15 @@ status_t BpDrmManagerService::getAllSupportInfo(
}

DecryptHandle* BpDrmManagerService::openDecryptSession(
            int uniqueId, int fd, int offset, int length) {
            int uniqueId, int fd, off64_t offset, off64_t length) {
    LOGV("Entering BpDrmManagerService::openDecryptSession");
    Parcel data, reply;

    data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
    data.writeInt32(uniqueId);
    data.writeFileDescriptor(fd);
    data.writeInt32(offset);
    data.writeInt32(length);
    data.writeInt64(offset);
    data.writeInt64(length);

    remote()->transact(OPEN_DECRYPT_SESSION, data, &reply);

@@ -697,7 +697,7 @@ status_t BpDrmManagerService::finalizeDecryptUnit(

ssize_t BpDrmManagerService::pread(
            int uniqueId, DecryptHandle* decryptHandle, void* buffer,
            ssize_t numBytes, off_t offset) {
            ssize_t numBytes, off64_t offset) {
    LOGV("read");
    Parcel data, reply;
    int result;
@@ -717,7 +717,7 @@ ssize_t BpDrmManagerService::pread(
    }

    data.writeInt32(numBytes);
    data.writeInt32(offset);
    data.writeInt64(offset);

    remote()->transact(PREAD, data, &reply);
    result = reply.readInt32();
@@ -1121,7 +1121,7 @@ status_t BnDrmManagerService::onTransact(
        if (NULL != drmConvertedStatus) {
            //Filling Drm Converted Ststus
            reply->writeInt32(drmConvertedStatus->statusCode);
            reply->writeInt32(drmConvertedStatus->offset);
            reply->writeInt64(drmConvertedStatus->offset);

            if (NULL != drmConvertedStatus->convertedData) {
                const DrmBuffer* convertedData = drmConvertedStatus->convertedData;
@@ -1150,7 +1150,7 @@ status_t BnDrmManagerService::onTransact(
        if (NULL != drmConvertedStatus) {
            //Filling Drm Converted Ststus
            reply->writeInt32(drmConvertedStatus->statusCode);
            reply->writeInt32(drmConvertedStatus->offset);
            reply->writeInt64(drmConvertedStatus->offset);

            if (NULL != drmConvertedStatus->convertedData) {
                const DrmBuffer* convertedData = drmConvertedStatus->convertedData;
@@ -1210,7 +1210,7 @@ status_t BnDrmManagerService::onTransact(
        const int fd = data.readFileDescriptor();

        DecryptHandle* handle
            = openDecryptSession(uniqueId, fd, data.readInt32(), data.readInt32());
            = openDecryptSession(uniqueId, fd, data.readInt64(), data.readInt64());

        if (NULL != handle) {
            reply->writeInt32(handle->decryptId);
@@ -1415,7 +1415,7 @@ status_t BnDrmManagerService::onTransact(
        const int numBytes = data.readInt32();
        char* buffer = new char[numBytes];

        const off_t offset = data.readInt32();
        const off64_t offset = data.readInt64();

        ssize_t result = pread(uniqueId, &handle, buffer, numBytes, offset);
        reply->writeInt32(result);
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ String8 ReadWriteUtils::readBytes(const String8& filePath) {
        struct stat sb;

        if (fstat(fd, &sb) == 0 && sb.st_size > 0) {
            int length = sb.st_size;
            off64_t length = sb.st_size;
            char* bytes = new char[length];
            if (length == read(fd, (void*) bytes, length)) {
                string.append(bytes, length);
@@ -57,7 +57,7 @@ String8 ReadWriteUtils::readBytes(const String8& filePath) {
int ReadWriteUtils::readBytes(const String8& filePath, char** buffer) {
    FILE* file = NULL;
    file = fopen(filePath.string(), "r");
    int length = 0;
    off64_t length = 0;

    if (NULL != file) {
        int fd = fileno(file);
+3 −3
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ status_t DrmManager::consumeRights(
}

status_t DrmManager::setPlaybackStatus(
    int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
    int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
    status_t result = DRM_ERROR_UNKNOWN;
    if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
        IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
@@ -370,7 +370,7 @@ status_t DrmManager::getAllSupportInfo(
    return DRM_NO_ERROR;
}

DecryptHandle* DrmManager::openDecryptSession(int uniqueId, int fd, int offset, int length) {
DecryptHandle* DrmManager::openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length) {
    Mutex::Autolock _l(mDecryptLock);
    status_t result = DRM_ERROR_CANNOT_HANDLE;
    Vector<String8> plugInIdList = mPlugInManager.getPlugInIdList();
@@ -470,7 +470,7 @@ status_t DrmManager::finalizeDecryptUnit(
}

ssize_t DrmManager::pread(int uniqueId, DecryptHandle* decryptHandle,
            void* buffer, ssize_t numBytes, off_t offset) {
            void* buffer, ssize_t numBytes, off64_t offset) {
    ssize_t result = DECRYPT_FILE_ERROR;

    if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
+3 −3
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ status_t DrmManagerService::consumeRights(
}

status_t DrmManagerService::setPlaybackStatus(
            int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
            int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
    LOGV("Entering setPlaybackStatus");
    return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
}
@@ -170,7 +170,7 @@ status_t DrmManagerService::getAllSupportInfo(
}

DecryptHandle* DrmManagerService::openDecryptSession(
            int uniqueId, int fd, int offset, int length) {
            int uniqueId, int fd, off64_t offset, off64_t length) {
    LOGV("Entering DrmManagerService::openDecryptSession");
    return mDrmManager->openDecryptSession(uniqueId, fd, offset, length);
}
@@ -206,7 +206,7 @@ status_t DrmManagerService::finalizeDecryptUnit(
}

ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle,
            void* buffer, ssize_t numBytes, off_t offset) {
            void* buffer, ssize_t numBytes, off64_t offset) {
    LOGV("Entering pread");
    return mDrmManager->pread(uniqueId, decryptHandle, buffer, numBytes, offset);
}
Loading