diff options
author | Robin Cutshaw <robin.cutshaw@gmail.com> | 2012-05-01 19:45:25 -0400 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2012-11-29 12:40:59 -0800 |
commit | 575ca85c147f1521480ea98aca13aa3b1ec38884 (patch) | |
tree | e534e33301bb22d1da2667dd160789c58c1f19c5 /core/java/android/hardware | |
parent | 9ed4abd875852524c5dd366f30b5b7bda93f0da3 (diff) | |
download | frameworks_base-575ca85c147f1521480ea98aca13aa3b1ec38884.zip frameworks_base-575ca85c147f1521480ea98aca13aa3b1ec38884.tar.gz frameworks_base-575ca85c147f1521480ea98aca13aa3b1ec38884.tar.bz2 |
Added missing USB device descriptor fields needed for intent filters
The UsbDevice object is missing the ManufacturerName, ProductName, and
SerialNumber fields. These are needed by intent filters to further
qualify a USB device that is plugged in while in host mode. These
fields have been added in the jni UsbHostManager implementation and
propagated through UsbHostManager and UsbDevice implementations.
The UsbSettingsManager implementation has been modified to allow
manufacturer-name, product-name, and serial-number tags in intents.
File changes:
modified: api/current.txt
modified: core/java/android/hardware/usb/UsbDevice.java
modified: services/java/com/android/server/usb/UsbHostManager.java
modified: services/java/com/android/server/usb/UsbSettingsManager.java
modified: services/jni/com_android_server_UsbHostManager.cpp
Change-Id: I386884715d1b732b06a63feb77790be6b59b6fe6
Signed-off-by: Robin Cutshaw <robin.cutshaw@gmail.com>
Diffstat (limited to 'core/java/android/hardware')
-rw-r--r-- | core/java/android/hardware/usb/UsbDevice.java | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/core/java/android/hardware/usb/UsbDevice.java b/core/java/android/hardware/usb/UsbDevice.java index 9bd38f9..d1e63f6 100644 --- a/core/java/android/hardware/usb/UsbDevice.java +++ b/core/java/android/hardware/usb/UsbDevice.java @@ -46,6 +46,9 @@ public class UsbDevice implements Parcelable { private static final String TAG = "UsbDevice"; private final String mName; + private final String mManufacturerName; + private final String mProductName; + private final String mSerialNumber; private final int mVendorId; private final int mProductId; private final int mClass; @@ -58,13 +61,18 @@ public class UsbDevice implements Parcelable { * @hide */ public UsbDevice(String name, int vendorId, int productId, - int Class, int subClass, int protocol, Parcelable[] interfaces) { + int Class, int subClass, int protocol, + String manufacturerName, String productName, String serialNumber, + Parcelable[] interfaces) { mName = name; mVendorId = vendorId; mProductId = productId; mClass = Class; mSubclass = subClass; mProtocol = protocol; + mManufacturerName = manufacturerName; + mProductName = productName; + mSerialNumber = serialNumber; mInterfaces = interfaces; } @@ -80,6 +88,33 @@ public class UsbDevice implements Parcelable { } /** + * Returns the manufacturer name of the device. + * + * @return the manufacturer name + */ + public String getManufacturerName() { + return mManufacturerName; + } + + /** + * Returns the product name of the device. + * + * @return the product name + */ + public String getProductName() { + return mProductName; + } + + /** + * Returns the serial number of the device. + * + * @return the serial number name + */ + public String getSerialNumber() { + return mSerialNumber; + } + + /** * Returns a unique integer ID for the device. * This is a convenience for clients that want to use an integer to represent * the device, rather than the device name. @@ -176,7 +211,8 @@ public class UsbDevice implements Parcelable { return "UsbDevice[mName=" + mName + ",mVendorId=" + mVendorId + ",mProductId=" + mProductId + ",mClass=" + mClass + ",mSubclass=" + mSubclass + ",mProtocol=" + mProtocol + - ",mInterfaces=" + mInterfaces + "]"; + ",mManufacturerName=" + mManufacturerName + ",mProductName=" + mProductName + + ",mSerialNumber=" + mSerialNumber + ",mInterfaces=" + mInterfaces + "]"; } public static final Parcelable.Creator<UsbDevice> CREATOR = @@ -188,8 +224,12 @@ public class UsbDevice implements Parcelable { int clasz = in.readInt(); int subClass = in.readInt(); int protocol = in.readInt(); + String manufacturerName = in.readString(); + String productName = in.readString(); + String serialNumber = in.readString(); Parcelable[] interfaces = in.readParcelableArray(UsbInterface.class.getClassLoader()); - return new UsbDevice(name, vendorId, productId, clasz, subClass, protocol, interfaces); + return new UsbDevice(name, vendorId, productId, clasz, subClass, protocol, + manufacturerName, productName, serialNumber, interfaces); } public UsbDevice[] newArray(int size) { @@ -208,6 +248,9 @@ public class UsbDevice implements Parcelable { parcel.writeInt(mClass); parcel.writeInt(mSubclass); parcel.writeInt(mProtocol); + parcel.writeString(mManufacturerName); + parcel.writeString(mProductName); + parcel.writeString(mSerialNumber); parcel.writeParcelableArray(mInterfaces, 0); } |