Loading core/api/test-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -1840,6 +1840,14 @@ package android.hardware.soundtrigger { } package android.hardware.usb { public final class UsbPort { method @FlaggedApi("android.hardware.usb.flags.enable_is_mode_change_supported_api") @RequiresPermission(android.Manifest.permission.MANAGE_USB) public boolean isModeChangeSupported(); } } package android.inputmethodservice { public abstract class AbstractInputMethodService extends android.window.WindowProviderService implements android.view.KeyEvent.Callback { Loading core/java/android/hardware/usb/IUsbManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,10 @@ interface IUsbManager /* Gets the status of the specified USB port. */ UsbPortStatus getPortStatus(in String portId); /* Returns if the specified USB port supports mode change. */ @EnforcePermission("MANAGE_USB") boolean isModeChangeSupported(in String portId); /* Sets the port's current role. */ void setPortRoles(in String portId, int powerRole, int dataRole); Loading core/java/android/hardware/usb/UsbManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -1473,6 +1473,21 @@ public class UsbManager { } } /** * Checks if the given port supports mode change. Should only be called by * {@link UsbPort#isModeChangeSupported}. * * @hide */ @RequiresPermission(Manifest.permission.MANAGE_USB) boolean isModeChangeSupported(UsbPort port) { try { return mService.isModeChangeSupported(port.getId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Should only be called by {@link UsbPort#setRoles}. * Loading core/java/android/hardware/usb/UsbPort.java +16 −0 Original line number Diff line number Diff line Loading @@ -65,11 +65,14 @@ import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_S import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.CheckResult; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.hardware.usb.flags.Flags; import android.hardware.usb.UsbOperationInternal; import android.hardware.usb.V1_0.Constants; import android.os.Binder; Loading Loading @@ -374,6 +377,19 @@ public final class UsbPort { return mUsbManager.getPortStatus(this); } /** * Returns whether this USB port supports mode change * * @return true if mode change is supported. * @hide */ @TestApi @RequiresPermission(Manifest.permission.MANAGE_USB) @FlaggedApi(Flags.FLAG_ENABLE_IS_MODE_CHANGE_SUPPORTED_API) public boolean isModeChangeSupported() { return mUsbManager.isModeChangeSupported(this); } /** * Queries USB Port to see if the port is capable of identifying * non compliant USB power source/cable/accessory. Loading core/java/android/hardware/usb/flags/usb_framework_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,10 @@ flag { description: "Feature flag for the api to check if a port is PD compliant" bug: "323470419" } flag { name: "enable_is_mode_change_supported_api" namespace: "usb" description: "Feature flag for the api to check if a port supports mode change" bug: "323470419" } Loading
core/api/test-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -1840,6 +1840,14 @@ package android.hardware.soundtrigger { } package android.hardware.usb { public final class UsbPort { method @FlaggedApi("android.hardware.usb.flags.enable_is_mode_change_supported_api") @RequiresPermission(android.Manifest.permission.MANAGE_USB) public boolean isModeChangeSupported(); } } package android.inputmethodservice { public abstract class AbstractInputMethodService extends android.window.WindowProviderService implements android.view.KeyEvent.Callback { Loading
core/java/android/hardware/usb/IUsbManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,10 @@ interface IUsbManager /* Gets the status of the specified USB port. */ UsbPortStatus getPortStatus(in String portId); /* Returns if the specified USB port supports mode change. */ @EnforcePermission("MANAGE_USB") boolean isModeChangeSupported(in String portId); /* Sets the port's current role. */ void setPortRoles(in String portId, int powerRole, int dataRole); Loading
core/java/android/hardware/usb/UsbManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -1473,6 +1473,21 @@ public class UsbManager { } } /** * Checks if the given port supports mode change. Should only be called by * {@link UsbPort#isModeChangeSupported}. * * @hide */ @RequiresPermission(Manifest.permission.MANAGE_USB) boolean isModeChangeSupported(UsbPort port) { try { return mService.isModeChangeSupported(port.getId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Should only be called by {@link UsbPort#setRoles}. * Loading
core/java/android/hardware/usb/UsbPort.java +16 −0 Original line number Diff line number Diff line Loading @@ -65,11 +65,14 @@ import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_S import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.CheckResult; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.hardware.usb.flags.Flags; import android.hardware.usb.UsbOperationInternal; import android.hardware.usb.V1_0.Constants; import android.os.Binder; Loading Loading @@ -374,6 +377,19 @@ public final class UsbPort { return mUsbManager.getPortStatus(this); } /** * Returns whether this USB port supports mode change * * @return true if mode change is supported. * @hide */ @TestApi @RequiresPermission(Manifest.permission.MANAGE_USB) @FlaggedApi(Flags.FLAG_ENABLE_IS_MODE_CHANGE_SUPPORTED_API) public boolean isModeChangeSupported() { return mUsbManager.isModeChangeSupported(this); } /** * Queries USB Port to see if the port is capable of identifying * non compliant USB power source/cable/accessory. Loading
core/java/android/hardware/usb/flags/usb_framework_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,10 @@ flag { description: "Feature flag for the api to check if a port is PD compliant" bug: "323470419" } flag { name: "enable_is_mode_change_supported_api" namespace: "usb" description: "Feature flag for the api to check if a port supports mode change" bug: "323470419" }