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

Commit 376c5a8d authored by Daichi Hirono's avatar Daichi Hirono Committed by Android (Google) Code Review
Browse files

Merge "Implement MtpDevice#getPartialObject64 in Java API."

parents 4f93c58b 038832b9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23126,6 +23126,7 @@ package android.mtp {
    field public static final int OPERATION_GET_OBJECT_PROP_VALUE = 38915; // 0x9803
    field public static final int OPERATION_GET_OBJECT_REFERENCES = 38928; // 0x9810
    field public static final int OPERATION_GET_PARTIAL_OBJECT = 4123; // 0x101b
    field public static final int OPERATION_GET_PARTIAL_OBJECT_64 = 38337; // 0x95c1
    field public static final int OPERATION_GET_STORAGE_INFO = 4101; // 0x1005
    field public static final int OPERATION_GET_STORAGE_I_DS = 4100; // 0x1004
    field public static final int OPERATION_GET_THUMB = 4106; // 0x100a
@@ -23163,6 +23164,7 @@ package android.mtp {
    method public android.mtp.MtpObjectInfo getObjectInfo(int);
    method public long getParent(int);
    method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException;
    method public long getPartialObject64(int, long, long, byte[]) throws java.io.IOException;
    method public long getStorageId(int);
    method public int[] getStorageIds();
    method public android.mtp.MtpStorageInfo getStorageInfo(int);
+2 −0
Original line number Diff line number Diff line
@@ -24545,6 +24545,7 @@ package android.mtp {
    field public static final int OPERATION_GET_OBJECT_PROP_VALUE = 38915; // 0x9803
    field public static final int OPERATION_GET_OBJECT_REFERENCES = 38928; // 0x9810
    field public static final int OPERATION_GET_PARTIAL_OBJECT = 4123; // 0x101b
    field public static final int OPERATION_GET_PARTIAL_OBJECT_64 = 38337; // 0x95c1
    field public static final int OPERATION_GET_STORAGE_INFO = 4101; // 0x1005
    field public static final int OPERATION_GET_STORAGE_I_DS = 4100; // 0x1004
    field public static final int OPERATION_GET_THUMB = 4106; // 0x100a
@@ -24582,6 +24583,7 @@ package android.mtp {
    method public android.mtp.MtpObjectInfo getObjectInfo(int);
    method public long getParent(int);
    method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException;
    method public long getPartialObject64(int, long, long, byte[]) throws java.io.IOException;
    method public long getStorageId(int);
    method public int[] getStorageIds();
    method public android.mtp.MtpStorageInfo getStorageInfo(int);
+2 −0
Original line number Diff line number Diff line
@@ -23135,6 +23135,7 @@ package android.mtp {
    field public static final int OPERATION_GET_OBJECT_PROP_VALUE = 38915; // 0x9803
    field public static final int OPERATION_GET_OBJECT_REFERENCES = 38928; // 0x9810
    field public static final int OPERATION_GET_PARTIAL_OBJECT = 4123; // 0x101b
    field public static final int OPERATION_GET_PARTIAL_OBJECT_64 = 38337; // 0x95c1
    field public static final int OPERATION_GET_STORAGE_INFO = 4101; // 0x1005
    field public static final int OPERATION_GET_STORAGE_I_DS = 4100; // 0x1004
    field public static final int OPERATION_GET_THUMB = 4106; // 0x100a
@@ -23172,6 +23173,7 @@ package android.mtp {
    method public android.mtp.MtpObjectInfo getObjectInfo(int);
    method public long getParent(int);
    method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException;
    method public long getPartialObject64(int, long, long, byte[]) throws java.io.IOException;
    method public long getStorageId(int);
    method public int[] getStorageIds();
    method public android.mtp.MtpStorageInfo getStorageInfo(int);
+2 −0
Original line number Diff line number Diff line
@@ -690,4 +690,6 @@ public final class MtpConstants {
    public static final int OPERATION_SET_OBJECT_REFERENCES = 0x9811;
    /** Operation code for Skip */
    public static final int OPERATION_SKIP = 0x9820;
    /** Operation code for GetPartialObject64 */
    public static final int OPERATION_GET_PARTIAL_OBJECT_64 = 0x95C1;
}
+23 −0
Original line number Diff line number Diff line
@@ -179,6 +179,27 @@ public final class MtpDevice {
        return native_get_partial_object(objectHandle, offset, size, buffer);
    }

    /**
     * Obtains object bytes in the specified range and writes it to an array.
     * This call may block for an arbitrary amount of time depending on the size
     * of the data and speed of the devices.
     *
     * This is a vender-extended operation supported by Android that enables us to pass
     * unsigned 64-bit offset. Check if the MTP device supports the operation by using
     * {@link MtpDeviceInfo#getOperationsSupported()}.
     *
     * @param objectHandle handle of the object to read
     * @param offset Start index of reading range. It must be a non-negative value.
     * @param size Size of reading range. It must be a non-negative value at most 0xffffffff.
     * @param buffer Array to write data.
     * @return Size of bytes that are actually read.
     * @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT_64
     */
    public long getPartialObject64(int objectHandle, long offset, long size, byte[] buffer)
            throws IOException {
        return native_get_partial_object_64(objectHandle, offset, size, buffer);
    }

    /**
     * Returns the thumbnail data for an object as a byte array.
     * The size and format of the thumbnail data can be determined via
@@ -347,6 +368,8 @@ public final class MtpDevice {
    private native byte[] native_get_object(int objectHandle, long objectSize);
    private native long native_get_partial_object(
            int objectHandle, long offset, long objectSize, byte[] buffer) throws IOException;
    private native int native_get_partial_object_64(
            int objectHandle, long offset, long objectSize, byte[] buffer) throws IOException;
    private native byte[] native_get_thumbnail(int objectHandle);
    private native boolean native_delete_object(int objectHandle);
    private native int native_get_parent(int objectHandle);
Loading