diff --git a/api/current.txt b/api/current.txt index 380d641e07db1..7c0de77b7cbbc 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12651,15 +12651,14 @@ package android.hardware.usb { public class UsbConfiguration implements android.os.Parcelable { method public int describeContents(); - method public int getAttributes(); method public int getId(); method public android.hardware.usb.UsbInterface getInterface(int); method public int getInterfaceCount(); method public int getMaxPower(); method public java.lang.String getName(); + method public boolean isRemoteWakeup(); + method public boolean isSelfPowered(); method public void writeToParcel(android.os.Parcel, int); - field public static final int ATTR_REMOTE_WAKEUP_MASK = 32; // 0x20 - field public static final int ATTR_SELF_POWERED_MASK = 64; // 0x40 field public static final android.os.Parcelable.Creator CREATOR; } diff --git a/core/java/android/hardware/usb/UsbConfiguration.java b/core/java/android/hardware/usb/UsbConfiguration.java index 92d6f75964cec..da5c12854273f 100644 --- a/core/java/android/hardware/usb/UsbConfiguration.java +++ b/core/java/android/hardware/usb/UsbConfiguration.java @@ -44,13 +44,13 @@ public class UsbConfiguration implements Parcelable { * Mask for "self-powered" bit in the configuration's attributes. * @see #getAttributes */ - public static final int ATTR_SELF_POWERED_MASK = 1 << 6; + private static final int ATTR_SELF_POWERED = 1 << 6; /** * Mask for "remote wakeup" bit in the configuration's attributes. * @see #getAttributes */ - public static final int ATTR_REMOTE_WAKEUP_MASK = 1 << 5; + private static final int ATTR_REMOTE_WAKEUP = 1 << 5; /** * UsbConfiguration should only be instantiated by UsbService implementation @@ -83,19 +83,23 @@ public class UsbConfiguration implements Parcelable { } /** - * Returns the configuration's attributes field. - * This field contains a bit field with the following flags: + * Returns the self-powered attribute value configuration's attributes field. + * This attribute indicates that the device has a power source other than the USB connection. * - * Bit 7: always set to 1 - * Bit 6: self-powered - * Bit 5: remote wakeup enabled - * Bit 0-4: reserved - * @see #ATTR_SELF_POWERED_MASK - * @see #ATTR_REMOTE_WAKEUP_MASK - * @return the configuration's attributes + * @return the configuration's self-powered attribute */ - public int getAttributes() { - return mAttributes; + public boolean isSelfPowered() { + return (mAttributes & ATTR_SELF_POWERED) != 0; + } + + /** + * Returns the remote-wakeup attribute value configuration's attributes field. + * This attributes that the device may signal the host to wake from suspend. + * + * @return the configuration's remote-wakeup attribute + */ + public boolean isRemoteWakeup() { + return (mAttributes & ATTR_REMOTE_WAKEUP) != 0; } /** diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java index 628395159fc07..c062b3a311526 100644 --- a/core/java/android/hardware/usb/UsbDeviceConnection.java +++ b/core/java/android/hardware/usb/UsbDeviceConnection.java @@ -104,7 +104,7 @@ public class UsbDeviceConnection { * Sets the current {@link android.hardware.usb.UsbInterface}. * Used to select between two interfaces with the same ID but different alternate setting. * - * @return true if the interface was successfully released + * @return true if the interface was successfully selected */ public boolean setInterface(UsbInterface intf) { return native_set_interface(intf.getId(), intf.getAlternateSetting());