OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.device.usb; | 5 package org.chromium.device.usb; |
6 | 6 |
| 7 import android.annotation.SuppressLint; |
7 import android.hardware.usb.UsbEndpoint; | 8 import android.hardware.usb.UsbEndpoint; |
8 import android.hardware.usb.UsbInterface; | 9 import android.hardware.usb.UsbInterface; |
9 | 10 |
10 import org.chromium.base.Log; | 11 import org.chromium.base.Log; |
11 import org.chromium.base.annotations.CalledByNative; | 12 import org.chromium.base.annotations.CalledByNative; |
12 import org.chromium.base.annotations.JNINamespace; | 13 import org.chromium.base.annotations.JNINamespace; |
13 | 14 |
14 /** | 15 /** |
15 * Exposes android.hardware.usb.UsbInterface as necessary for C++ | 16 * Exposes android.hardware.usb.UsbInterface as necessary for C++ |
16 * device::UsbInterfaceAndroid. | 17 * device::UsbInterfaceAndroid. |
(...skipping 14 matching lines...) Expand all Loading... |
31 @CalledByNative | 32 @CalledByNative |
32 private static ChromeUsbInterface create(UsbInterface iface) { | 33 private static ChromeUsbInterface create(UsbInterface iface) { |
33 return new ChromeUsbInterface(iface); | 34 return new ChromeUsbInterface(iface); |
34 } | 35 } |
35 | 36 |
36 @CalledByNative | 37 @CalledByNative |
37 private int getInterfaceNumber() { | 38 private int getInterfaceNumber() { |
38 return mInterface.getId(); | 39 return mInterface.getId(); |
39 } | 40 } |
40 | 41 |
| 42 // TODO(crbug.com/635567): Fix this properly. |
| 43 @SuppressLint("NewApi") |
41 @CalledByNative | 44 @CalledByNative |
42 private int getAlternateSetting() { | 45 private int getAlternateSetting() { |
43 return mInterface.getAlternateSetting(); | 46 return mInterface.getAlternateSetting(); |
44 } | 47 } |
45 | 48 |
46 @CalledByNative | 49 @CalledByNative |
47 private int getInterfaceClass() { | 50 private int getInterfaceClass() { |
48 return mInterface.getInterfaceClass(); | 51 return mInterface.getInterfaceClass(); |
49 } | 52 } |
50 | 53 |
(...skipping 10 matching lines...) Expand all Loading... |
61 @CalledByNative | 64 @CalledByNative |
62 private UsbEndpoint[] getEndpoints() { | 65 private UsbEndpoint[] getEndpoints() { |
63 int count = mInterface.getEndpointCount(); | 66 int count = mInterface.getEndpointCount(); |
64 UsbEndpoint[] endpoints = new UsbEndpoint[count]; | 67 UsbEndpoint[] endpoints = new UsbEndpoint[count]; |
65 for (int i = 0; i < count; ++i) { | 68 for (int i = 0; i < count; ++i) { |
66 endpoints[i] = mInterface.getEndpoint(i); | 69 endpoints[i] = mInterface.getEndpoint(i); |
67 } | 70 } |
68 return endpoints; | 71 return endpoints; |
69 } | 72 } |
70 } | 73 } |
OLD | NEW |