Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java

Issue 1857033002: Include USB device version in chrome.usb.Device fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_browsertest.cc ('k') | device/usb/mock_usb_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java
diff --git a/device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java b/device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java
index 92e4e1481cf4340241fe441012a429b2bc49af5e..38b78e5763a95926e35a2872d0ecf39d5eea1703 100644
--- a/device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java
+++ b/device/usb/android/java/src/org/chromium/device/usb/ChromeUsbDevice.java
@@ -37,6 +37,21 @@ final class ChromeUsbDevice {
}
@CalledByNative
+ private int getDeviceClass() {
+ return mDevice.getDeviceClass();
+ }
+
+ @CalledByNative
+ private int getDeviceSubclass() {
+ return mDevice.getDeviceSubclass();
+ }
+
+ @CalledByNative
+ private int getDeviceProtocol() {
+ return mDevice.getDeviceProtocol();
+ }
+
+ @CalledByNative
private int getVendorId() {
return mDevice.getVendorId();
}
@@ -46,6 +61,19 @@ final class ChromeUsbDevice {
return mDevice.getProductId();
}
+ @TargetApi(Build.VERSION_CODES.M)
+ @CalledByNative
+ private int getDeviceVersion() {
+ // The Android framework generates this string with:
+ // Integer.toString(version >> 8) + "." + (version & 0xFF)
+ //
+ // This is not technically correct because the low nibble is actually
+ // two separate version components (per spec). This undoes it at least.
+ String[] parts = mDevice.getVersion().split("\\.");
+ assert parts.length == 2;
+ return Integer.parseInt(parts[0]) << 8 | Integer.parseInt(parts[1]);
+ }
+
@CalledByNative
private String getManufacturerName() {
return mDevice.getManufacturerName();
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_browsertest.cc ('k') | device/usb/mock_usb_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698