Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -22552,7 +22552,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int); api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -24107,7 +24107,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int); api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -22560,7 +22560,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int); core/java/com/android/internal/util/Preconditions.java +27 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,33 @@ public class Preconditions { return value; } /** * Ensures that the argument long value is within the inclusive range. * * @param value a long value * @param lower the lower endpoint of the inclusive range * @param upper the upper endpoint of the inclusive range * @param valueName the name of the argument to use if the check fails * * @return the validated long value * * @throws IllegalArgumentException if {@code value} was not within the range */ public static long checkArgumentInRange(long value, long lower, long upper, String valueName) { if (value < lower) { throw new IllegalArgumentException( String.format( "%s is out of range of [%d, %d] (too low)", valueName, lower, upper)); } else if (value > upper) { throw new IllegalArgumentException( String.format( "%s is out of range of [%d, %d] (too high)", valueName, lower, upper)); } return value; } /** * Ensures that the array is not {@code null}, and none of its elements are {@code null}. * Loading media/java/android/mtp/MtpDevice.java +9 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.hardware.usb.UsbDeviceConnection; import android.os.CancellationSignal; import android.os.ParcelFileDescriptor; import com.android.internal.util.Preconditions; import java.io.IOException; /** Loading Loading @@ -164,12 +166,14 @@ public final class MtpDevice { * of the data and speed of the devices. * * @param objectHandle handle of the object to read * @param offset Start index of reading range. * @param size Size of reading range. * @param offset Start index of reading range. It must be a non-negative value at most * 0xffffffff. * @param size Size of reading range. It must be a non-negative value at most 0xffffffff. If * 0xffffffff is specified, the method obtains the full bytes of object. * @param buffer Array to write data. * @return Size of bytes that are actually read. */ public int getPartialObject(int objectHandle, int offset, int size, byte[] buffer) public long getPartialObject(int objectHandle, long offset, long size, byte[] buffer) throws IOException { return native_get_partial_object(objectHandle, offset, size, buffer); } Loading Loading @@ -340,8 +344,8 @@ public final class MtpDevice { private native int[] native_get_object_handles(int storageId, int format, int objectHandle); private native MtpObjectInfo native_get_object_info(int objectHandle); private native byte[] native_get_object(int objectHandle, int objectSize); private native int native_get_partial_object( int objectHandle, int offset, int objectSize, byte[] buffer) throws IOException; private native long native_get_partial_object( 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 long native_get_parent(int objectHandle); Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -22552,7 +22552,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int);
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -24107,7 +24107,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int);
api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -22560,7 +22560,7 @@ package android.mtp { method public int[] getObjectHandles(int, int, int); method public android.mtp.MtpObjectInfo getObjectInfo(int); method public long getParent(int); method public int getPartialObject(int, int, int, byte[]) throws java.io.IOException; method public long getPartialObject(int, long, long, byte[]) throws java.io.IOException; method public long getStorageId(int); method public int[] getStorageIds(); method public android.mtp.MtpStorageInfo getStorageInfo(int);
core/java/com/android/internal/util/Preconditions.java +27 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,33 @@ public class Preconditions { return value; } /** * Ensures that the argument long value is within the inclusive range. * * @param value a long value * @param lower the lower endpoint of the inclusive range * @param upper the upper endpoint of the inclusive range * @param valueName the name of the argument to use if the check fails * * @return the validated long value * * @throws IllegalArgumentException if {@code value} was not within the range */ public static long checkArgumentInRange(long value, long lower, long upper, String valueName) { if (value < lower) { throw new IllegalArgumentException( String.format( "%s is out of range of [%d, %d] (too low)", valueName, lower, upper)); } else if (value > upper) { throw new IllegalArgumentException( String.format( "%s is out of range of [%d, %d] (too high)", valueName, lower, upper)); } return value; } /** * Ensures that the array is not {@code null}, and none of its elements are {@code null}. * Loading
media/java/android/mtp/MtpDevice.java +9 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.hardware.usb.UsbDeviceConnection; import android.os.CancellationSignal; import android.os.ParcelFileDescriptor; import com.android.internal.util.Preconditions; import java.io.IOException; /** Loading Loading @@ -164,12 +166,14 @@ public final class MtpDevice { * of the data and speed of the devices. * * @param objectHandle handle of the object to read * @param offset Start index of reading range. * @param size Size of reading range. * @param offset Start index of reading range. It must be a non-negative value at most * 0xffffffff. * @param size Size of reading range. It must be a non-negative value at most 0xffffffff. If * 0xffffffff is specified, the method obtains the full bytes of object. * @param buffer Array to write data. * @return Size of bytes that are actually read. */ public int getPartialObject(int objectHandle, int offset, int size, byte[] buffer) public long getPartialObject(int objectHandle, long offset, long size, byte[] buffer) throws IOException { return native_get_partial_object(objectHandle, offset, size, buffer); } Loading Loading @@ -340,8 +344,8 @@ public final class MtpDevice { private native int[] native_get_object_handles(int storageId, int format, int objectHandle); private native MtpObjectInfo native_get_object_info(int objectHandle); private native byte[] native_get_object(int objectHandle, int objectSize); private native int native_get_partial_object( int objectHandle, int offset, int objectSize, byte[] buffer) throws IOException; private native long native_get_partial_object( 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 long native_get_parent(int objectHandle); Loading