diff --git a/api/current.txt b/api/current.txt index c005726eb8c95..2ec1533483c50 100644 --- a/api/current.txt +++ b/api/current.txt @@ -10594,11 +10594,11 @@ package android.hardware.usb { } public class UsbDeviceConnection { - method public deprecated int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int); + method public int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int); method public int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int, int); method public boolean claimInterface(android.hardware.usb.UsbInterface, boolean); method public void close(); - method public deprecated int controlTransfer(int, int, int, int, byte[], int, int); + method public int controlTransfer(int, int, int, int, byte[], int, int); method public int controlTransfer(int, int, int, int, byte[], int, int, int); method public int getFileDescriptor(); method public byte[] getRawDescriptors(); diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java index 0856e2736d0a8..b2034b2636c9a 100644 --- a/core/java/android/hardware/usb/UsbDeviceConnection.java +++ b/core/java/android/hardware/usb/UsbDeviceConnection.java @@ -107,6 +107,11 @@ public class UsbDeviceConnection { * {@link UsbConstants#USB_DIR_OUT}, then the transfer is a write, * and if it is {@link UsbConstants#USB_DIR_IN}, then the transfer * is a read. + *
+ * This method transfers data starting from index 0 in the buffer. + * To specify a different offset, use + * {@link #controlTransfer(int, int, int, int, byte[], int, int, int)}. + *
* * @param requestType request type for this transaction * @param request request ID for this transaction @@ -118,11 +123,7 @@ public class UsbDeviceConnection { * @param timeout in milliseconds * @return length of data transferred (or zero) for success, * or negative value for failure - * - * @deprecated Use {@link #controlTransfer(int, int, int, int, byte[], int, int, int)} - * which accepts a buffer start index. */ - @Deprecated public int controlTransfer(int requestType, int request, int value, int index, byte[] buffer, int length, int timeout) { return controlTransfer(requestType, request, value, index, buffer, 0, length, timeout); @@ -142,22 +143,27 @@ public class UsbDeviceConnection { * @param index index field for this transaction * @param buffer buffer for data portion of transaction, * or null if no data needs to be sent or received - * @param start the index of the first byte in the buffer to send or receive + * @param offset the index of the first byte in the buffer to send or receive * @param length the length of the data to send or receive * @param timeout in milliseconds * @return length of data transferred (or zero) for success, * or negative value for failure */ public int controlTransfer(int requestType, int request, int value, int index, - byte[] buffer, int start, int length, int timeout) { - checkBounds(buffer, start, length); + byte[] buffer, int offset, int length, int timeout) { + checkBounds(buffer, offset, length); return native_control_request(requestType, request, value, index, - buffer, start, length, timeout); + buffer, offset, length, timeout); } /** * Performs a bulk transaction on the given endpoint. - * The direction of the transfer is determined by the direction of the endpoint + * The direction of the transfer is determined by the direction of the endpoint. + *+ * This method transfers data starting from index 0 in the buffer. + * To specify a different offset, use + * {@link #bulkTransfer(UsbEndpoint, byte[], int, int, int)}. + *
* * @param endpoint the endpoint for this transaction * @param buffer buffer for data to send or receive @@ -165,11 +171,7 @@ public class UsbDeviceConnection { * @param timeout in milliseconds * @return length of data transferred (or zero) for success, * or negative value for failure - * - * @deprecated Use {@link #bulkTransfer(UsbEndpoint, byte[], int, int, int)} - * which accepts a buffer start index. */ - @Deprecated public int bulkTransfer(UsbEndpoint endpoint, byte[] buffer, int length, int timeout) { return bulkTransfer(endpoint, buffer, 0, length, timeout); @@ -177,20 +179,20 @@ public class UsbDeviceConnection { /** * Performs a bulk transaction on the given endpoint. - * The direction of the transfer is determined by the direction of the endpoint + * The direction of the transfer is determined by the direction of the endpoint. * * @param endpoint the endpoint for this transaction * @param buffer buffer for data to send or receive - * @param start the index of the first byte in the buffer to send or receive + * @param offset the index of the first byte in the buffer to send or receive * @param length the length of the data to send or receive * @param timeout in milliseconds * @return length of data transferred (or zero) for success, * or negative value for failure */ public int bulkTransfer(UsbEndpoint endpoint, - byte[] buffer, int start, int length, int timeout) { - checkBounds(buffer, start, length); - return native_bulk_request(endpoint.getAddress(), buffer, start, length, timeout); + byte[] buffer, int offset, int length, int timeout) { + checkBounds(buffer, offset, length); + return native_bulk_request(endpoint.getAddress(), buffer, offset, length, timeout); } /** @@ -235,9 +237,9 @@ public class UsbDeviceConnection { private native boolean native_claim_interface(int interfaceID, boolean force); private native boolean native_release_interface(int interfaceID); private native int native_control_request(int requestType, int request, int value, - int index, byte[] buffer, int start, int length, int timeout); + int index, byte[] buffer, int offset, int length, int timeout); private native int native_bulk_request(int endpoint, byte[] buffer, - int start, int length, int timeout); + int offset, int length, int timeout); private native UsbRequest native_request_wait(); private native String native_get_serial(); }