Merge changes from topic "b265900671"
* changes: DisplayPort alt mode and UsbPortStatus api doc fixes Change registerDisplayPortAltModeInfoListener to void method
This commit is contained in:
@@ -5962,7 +5962,7 @@ package android.hardware.usb {
|
||||
method public boolean isHotPlugDetectActive();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.DisplayPortAltModeInfo> CREATOR;
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_CAPABLE = 2; // 0x2
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_CAPABLE_DISABLED = 2; // 0x2
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_ENABLED = 3; // 0x3
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE = 1; // 0x1
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN = 0; // 0x0
|
||||
@@ -5980,7 +5980,7 @@ package android.hardware.usb {
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_USB) public java.util.List<android.hardware.usb.UsbPort> getPorts();
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void grantPermission(android.hardware.usb.UsbDevice, String);
|
||||
method public static boolean isUvcSupportEnabled();
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public boolean registerDisplayPortAltModeInfoListener(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.usb.UsbManager.DisplayPortAltModeInfoListener);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void registerDisplayPortAltModeInfoListener(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.usb.UsbManager.DisplayPortAltModeInfoListener);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void resetUsbGadget();
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void setCurrentFunctions(long);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void unregisterDisplayPortAltModeInfoListener(@NonNull android.hardware.usb.UsbManager.DisplayPortAltModeInfoListener);
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
* as one of its capabilities, however may not yet have entered DisplayPort Alt Mode or has been
|
||||
* configured for data transmission.
|
||||
*/
|
||||
public static final int DISPLAYPORT_ALT_MODE_STATUS_CAPABLE = 2;
|
||||
public static final int DISPLAYPORT_ALT_MODE_STATUS_CAPABLE_DISABLED = 2;
|
||||
|
||||
/**
|
||||
* Port Partners:
|
||||
@@ -113,7 +113,7 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
@IntDef(prefix = { "DISPLAYPORT_ALT_MODE_STATUS_" }, value = {
|
||||
DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_CAPABLE,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_CAPABLE_DISABLED,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_ENABLED,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@@ -150,10 +150,6 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
/**
|
||||
* Returns the DisplayPort Alt Mode Status for a port partner acting as a sink.
|
||||
*
|
||||
* @return {@link #DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_CAPABLE}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_ENABLED}
|
||||
*/
|
||||
public @DisplayPortAltModeStatus int getPartnerSinkStatus() {
|
||||
return mPartnerSinkStatus;
|
||||
@@ -162,10 +158,6 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
/**
|
||||
* Returns the DisplayPort Alt Mode Status for the attached cable
|
||||
*
|
||||
* @return {@link #DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_CAPABLE}
|
||||
* or {@link #DISPLAYPORT_ALT_MODE_STATUS_ENABLED}
|
||||
*/
|
||||
public @DisplayPortAltModeStatus int getCableStatus() {
|
||||
return mCableStatus;
|
||||
|
||||
@@ -1647,7 +1647,7 @@ public class UsbManager {
|
||||
/**
|
||||
* Registers the given listener to listen for DisplayPort Alt Mode changes.
|
||||
* <p>
|
||||
* If this method returns true, the caller should ensure to call
|
||||
* If this method returns without Exceptions, the caller should ensure to call
|
||||
* {@link #unregisterDisplayPortAltModeListener} when it no longer requires updates.
|
||||
*
|
||||
* @param executor Executor on which to run the listener.
|
||||
@@ -1655,14 +1655,14 @@ public class UsbManager {
|
||||
* changes. See {@link #DisplayPortAltModeInfoListener} for listener
|
||||
* details.
|
||||
*
|
||||
* @return true on successful register, false on failed register due to listener already being
|
||||
* registered or an internal error.
|
||||
* @throws IllegalStateException if listener has already been registered previously but not
|
||||
* unregistered or an unexpected system failure occurs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.MANAGE_USB)
|
||||
public boolean registerDisplayPortAltModeInfoListener(
|
||||
public void registerDisplayPortAltModeInfoListener(
|
||||
@NonNull @CallbackExecutor Executor executor,
|
||||
@NonNull DisplayPortAltModeInfoListener listener) {
|
||||
Objects.requireNonNull(executor, "registerDisplayPortAltModeInfoListener: "
|
||||
@@ -1678,15 +1678,15 @@ public class UsbManager {
|
||||
|
||||
if (mDisplayPortServiceListener == null) {
|
||||
if (!registerDisplayPortAltModeEventsIfNeededLocked()) {
|
||||
return false;
|
||||
throw new IllegalStateException("Unexpected failure registering service "
|
||||
+ "listener");
|
||||
}
|
||||
}
|
||||
if (mDisplayPortListeners.containsKey(listener)) {
|
||||
return false;
|
||||
throw new IllegalStateException("Listener has already been registered.");
|
||||
}
|
||||
|
||||
mDisplayPortListeners.put(listener, executor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import static android.hardware.usb.UsbPortStatus.COMPLIANCE_WARNING_MISSING_RP;
|
||||
import static android.hardware.usb.UsbPortStatus.COMPLIANCE_WARNING_OTHER;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_CAPABLE;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_CAPABLE_DISABLED;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_ENABLED;
|
||||
|
||||
import android.Manifest;
|
||||
@@ -807,8 +807,8 @@ public final class UsbPort {
|
||||
return "Unknown";
|
||||
case DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE:
|
||||
return "Not Capable";
|
||||
case DISPLAYPORT_ALT_MODE_STATUS_CAPABLE:
|
||||
return "Capable";
|
||||
case DISPLAYPORT_ALT_MODE_STATUS_CAPABLE_DISABLED:
|
||||
return "Capable-Disabled";
|
||||
case DISPLAYPORT_ALT_MODE_STATUS_ENABLED:
|
||||
return "Enabled";
|
||||
default:
|
||||
|
||||
@@ -311,7 +311,7 @@ public final class UsbPortStatus implements Parcelable {
|
||||
|
||||
/**
|
||||
* Indicates that the Type-C plug orientation cannot be
|
||||
* determined.
|
||||
* determined because the connected state of the device is unknown.
|
||||
*/
|
||||
public static final int PLUG_STATE_UNKNOWN = 0;
|
||||
|
||||
@@ -600,13 +600,8 @@ public final class UsbPortStatus implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the orientation state of the attached cable/adapter.
|
||||
* Returns the plug state of the attached cable/adapter.
|
||||
*
|
||||
* @return one of {@link #PLUG_STATE_UNKNOWN},
|
||||
* {@link #PLUG_STATE_UNPLUGGED},
|
||||
* {@link #PLUG_STATE_PLUGGED_ORIENTATION_UNKNOWN},
|
||||
* {@link #PLUG_STATE_PLUGGED_ORIENTATION_NORMAL},
|
||||
* {@link #PLUG_STATE_PLUGGED_ORIENTATION_FLIPPED},
|
||||
*/
|
||||
public @PlugState int getPlugState() {
|
||||
return mPlugState;
|
||||
|
||||
Reference in New Issue
Block a user