Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5633e37e authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "USB: Minor cleanup from API council review"

parents f564c7fe fa2b3fc6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -12828,15 +12828,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;
  }
+17 −13
Original line number Diff line number Diff line
@@ -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;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -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());