OSDN Git Service

Undeprecate old UsbDeviceConnection methods.
authorJeff Brown <jeffbrown@google.com>
Fri, 19 Apr 2013 02:15:17 +0000 (19:15 -0700)
committerJeff Brown <jeffbrown@google.com>
Fri, 19 Apr 2013 02:17:35 +0000 (19:17 -0700)
Per api review, retain the overloads that do not accept a
buffer start offset.

Bug: 8656781
Change-Id: Ie00aca7d3a4708700c5ddf60e3309e609788a67f

api/current.txt
core/java/android/hardware/usb/UsbDeviceConnection.java

index abf767a..f53f0f0 100644 (file)
@@ -10589,11 +10589,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();
index 0856e27..b2034b2 100644 (file)
@@ -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.
+     * <p>
+     * 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)}.
+     * </p>
      *
      * @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.
+     * <p>
+     * This method transfers data starting from index 0 in the buffer.
+     * To specify a different offset, use
+     * {@link #bulkTransfer(UsbEndpoint, byte[], int, int, int)}.
+     * </p>
      *
      * @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();
 }