diff options
Diffstat (limited to 'core/java')
| -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 ae6118c..b0ba9c1 100644 --- a/core/java/android/hardware/usb/UsbDevice.java +++ b/core/java/android/hardware/usb/UsbDevice.java @@ -42,6 +42,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; @@ -54,13 +57,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; } @@ -76,6 +84,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. @@ -172,7 +207,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 = @@ -184,8 +220,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) { @@ -204,6 +244,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); } |
