USB: Minor cleanup from API council review

Bug: 15089961
Change-Id: I8a22fad94d2a52d2270c89240b2a47bd1cef17b5
This commit is contained in:
Mike Lockwood
2014-05-20 08:08:37 -07:00
parent e4f1960652
commit fa2b3fc6cd
3 changed files with 20 additions and 17 deletions

View File

@@ -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;
}

View File

@@ -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;
}
/**

View File

@@ -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());