summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/usb
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2014-05-20 08:08:37 -0700
committerMike Lockwood <lockwood@google.com>2014-05-20 11:14:58 -0700
commitfa2b3fc6cd15a3b6bbfef87288b97354edb42307 (patch)
tree0838741880f17c70a8cf55cdb1728bd5ca3d88bb /core/java/android/hardware/usb
parente4f1960652a50b99100f7ff68ed461524ca2b9f1 (diff)
downloadframeworks_base-fa2b3fc6cd15a3b6bbfef87288b97354edb42307.zip
frameworks_base-fa2b3fc6cd15a3b6bbfef87288b97354edb42307.tar.gz
frameworks_base-fa2b3fc6cd15a3b6bbfef87288b97354edb42307.tar.bz2
USB: Minor cleanup from API council review
Bug: 15089961 Change-Id: I8a22fad94d2a52d2270c89240b2a47bd1cef17b5
Diffstat (limited to 'core/java/android/hardware/usb')
-rw-r--r--core/java/android/hardware/usb/UsbConfiguration.java30
-rw-r--r--core/java/android/hardware/usb/UsbDeviceConnection.java2
2 files changed, 18 insertions, 14 deletions
diff --git a/core/java/android/hardware/usb/UsbConfiguration.java b/core/java/android/hardware/usb/UsbConfiguration.java
index 92d6f75..da5c128 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 6283951..c062b3a 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());