Merge "MidiDeviceInfo: Add version string property" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index 96e5018..0aeda1c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17267,6 +17267,7 @@
field public static final java.lang.String PROPERTY_PRODUCT = "product";
field public static final java.lang.String PROPERTY_SERIAL_NUMBER = "serial_number";
field public static final java.lang.String PROPERTY_USB_DEVICE = "usb_device";
+ field public static final java.lang.String PROPERTY_VERSION = "version";
field public static final int TYPE_BLUETOOTH = 3; // 0x3
field public static final int TYPE_USB = 1; // 0x1
field public static final int TYPE_VIRTUAL = 2; // 0x2
diff --git a/api/system-current.txt b/api/system-current.txt
index 8cce95c..d931493 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -18559,6 +18559,7 @@
field public static final java.lang.String PROPERTY_PRODUCT = "product";
field public static final java.lang.String PROPERTY_SERIAL_NUMBER = "serial_number";
field public static final java.lang.String PROPERTY_USB_DEVICE = "usb_device";
+ field public static final java.lang.String PROPERTY_VERSION = "version";
field public static final int TYPE_BLUETOOTH = 3; // 0x3
field public static final int TYPE_USB = 1; // 0x1
field public static final int TYPE_VIRTUAL = 2; // 0x2
diff --git a/media/java/android/media/midi/MidiDeviceInfo.java b/media/java/android/media/midi/MidiDeviceInfo.java
index af108eb..35374ed 100644
--- a/media/java/android/media/midi/MidiDeviceInfo.java
+++ b/media/java/android/media/midi/MidiDeviceInfo.java
@@ -69,6 +69,13 @@
public static final String PROPERTY_PRODUCT = "product";
/**
+ * Bundle key for the device's version property.
+ * Used with the {@link android.os.Bundle} returned by {@link #getProperties}
+ * Matches the USB device version number for USB MIDI devices.
+ */
+ public static final String PROPERTY_VERSION = "version";
+
+ /**
* Bundle key for the device's serial number property.
* Used with the {@link android.os.Bundle} returned by {@link #getProperties}
* Matches the USB device serial number for USB MIDI devices.
diff --git a/services/usb/java/com/android/server/usb/UsbAlsaManager.java b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
index daccf95..27c97d0 100644
--- a/services/usb/java/com/android/server/usb/UsbAlsaManager.java
+++ b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
@@ -401,6 +401,7 @@
Bundle properties = new Bundle();
String manufacturer = usbDevice.getManufacturerName();
String product = usbDevice.getProductName();
+ String version = usbDevice.getVersion();
String name;
if (manufacturer == null || manufacturer.isEmpty()) {
name = product;
@@ -412,6 +413,7 @@
properties.putString(MidiDeviceInfo.PROPERTY_NAME, name);
properties.putString(MidiDeviceInfo.PROPERTY_MANUFACTURER, manufacturer);
properties.putString(MidiDeviceInfo.PROPERTY_PRODUCT, product);
+ properties.putString(MidiDeviceInfo.PROPERTY_VERSION, version);
properties.putString(MidiDeviceInfo.PROPERTY_SERIAL_NUMBER,
usbDevice.getSerialNumber());
properties.putInt(MidiDeviceInfo.PROPERTY_ALSA_CARD, alsaDevice.mCard);