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

Commit 1599ab8d authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Clarify UsbConnection#bulkTransfer api behavior"

parents 74cdd684 5e040ae4
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -213,9 +213,10 @@ public class UsbDeviceConnection {
     * </p>
     *
     * @param endpoint the endpoint for this transaction
     * @param buffer buffer for data to send or receive
     * @param buffer buffer for data to send or receive; can be {@code null} to wait for next
     *               transaction without reading data
     * @param length the length of the data to send or receive
     * @param timeout in milliseconds
     * @param timeout in milliseconds, 0 is infinite
     * @return length of data transferred (or zero) for success,
     * or negative value for failure
     */
@@ -232,7 +233,7 @@ public class UsbDeviceConnection {
     * @param buffer buffer for data 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
     * @param timeout in milliseconds, 0 is infinite
     * @return length of data transferred (or zero) for success,
     * or negative value for failure
     */
@@ -284,7 +285,7 @@ public class UsbDeviceConnection {

    private static void checkBounds(byte[] buffer, int start, int length) {
        final int bufferLength = (buffer != null ? buffer.length : 0);
        if (start < 0 || start + length > bufferLength) {
        if (length < 0 || start < 0 || start + length > bufferLength) {
            throw new IllegalArgumentException("Buffer start or length out of bounds.");
        }
    }