| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.media.midi; | 5 package org.chromium.midi; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.hardware.usb.UsbConstants; | 8 import android.hardware.usb.UsbConstants; |
| 9 import android.hardware.usb.UsbDevice; | 9 import android.hardware.usb.UsbDevice; |
| 10 import android.hardware.usb.UsbDeviceConnection; | 10 import android.hardware.usb.UsbDeviceConnection; |
| 11 import android.hardware.usb.UsbEndpoint; | 11 import android.hardware.usb.UsbEndpoint; |
| 12 import android.hardware.usb.UsbInterface; | 12 import android.hardware.usb.UsbInterface; |
| 13 import android.hardware.usb.UsbManager; | 13 import android.hardware.usb.UsbManager; |
| 14 import android.hardware.usb.UsbRequest; | 14 import android.hardware.usb.UsbRequest; |
| 15 import android.os.Build; | 15 import android.os.Build; |
| 16 import android.os.Handler; | 16 import android.os.Handler; |
| 17 import android.util.SparseArray; | 17 import android.util.SparseArray; |
| 18 | 18 |
| 19 import org.chromium.base.annotations.CalledByNative; | 19 import org.chromium.base.annotations.CalledByNative; |
| 20 import org.chromium.base.annotations.JNINamespace; | 20 import org.chromium.base.annotations.JNINamespace; |
| 21 | 21 |
| 22 import java.nio.ByteBuffer; | 22 import java.nio.ByteBuffer; |
| 23 import java.util.Arrays; | 23 import java.util.Arrays; |
| 24 import java.util.HashMap; | 24 import java.util.HashMap; |
| 25 import java.util.Map; | 25 import java.util.Map; |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Owned by its native counterpart declared in usb_midi_device_android.h. | 28 * Owned by its native counterpart declared in usb_midi_device_android.h. |
| 29 * Refer to that class for general comments. | 29 * Refer to that class for general comments. |
| 30 */ | 30 */ |
| 31 @JNINamespace("media::midi") | 31 @JNINamespace("midi") |
| 32 class UsbMidiDeviceAndroid { | 32 class UsbMidiDeviceAndroid { |
| 33 /** | 33 /** |
| 34 * A connection handle for this device. | 34 * A connection handle for this device. |
| 35 */ | 35 */ |
| 36 private final UsbDeviceConnection mConnection; | 36 private final UsbDeviceConnection mConnection; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * A map from endpoint number to UsbEndpoint. | 39 * A map from endpoint number to UsbEndpoint. |
| 40 */ | 40 */ |
| 41 private final SparseArray<UsbEndpoint> mEndpointMap; | 41 private final SparseArray<UsbEndpoint> mEndpointMap; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 if (buffer.get(i) == 0) { | 317 if (buffer.get(i) == 0) { |
| 318 return i; | 318 return i; |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 return position; | 321 return position; |
| 322 } | 322 } |
| 323 | 323 |
| 324 private static native void nativeOnData( | 324 private static native void nativeOnData( |
| 325 long nativeUsbMidiDeviceAndroid, int endpointNumber, byte[] data); | 325 long nativeUsbMidiDeviceAndroid, int endpointNumber, byte[] data); |
| 326 } | 326 } |
| OLD | NEW |