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

Commit 9c180dd3 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Media: Fix MtpDevice call

The signature was changed last minute. Update the media side.

Bug: 26284424
Change-Id: Ia8fb665221f60d3eadd2c32831a12aa21c6c5e9c
parent 97dd67cc
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -375,15 +375,17 @@ android_mtp_MtpDevice_get_partial_object(JNIEnv *env,
    }

    JavaArrayWriter writer(env, array);
    const int64_t result = device->readPartialObject(
            objectID, offset, size, JavaArrayWriter::writeTo, &writer);

    if (result >= 0) {
        return static_cast<jint>(result);
    } else {
    uint32_t written_size;
    bool success = device->readPartialObject(
            objectID, offset, size, &written_size, JavaArrayWriter::writeTo, &writer);
    if (!success) {
        jniThrowException(env, "java/io/IOException", "Failed to read data.");
        return -1;
    }
    // Note: assumption here is that a negative value will be treated as unsigned on the Java
    //       level.
    // TODO: Make sure that actually holds.
    return static_cast<jint>(written_size);
}

static jbyteArray