Loading core/api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1915,6 +1915,10 @@ package android.hardware.soundtrigger { package android.hardware.usb { public class UsbManager { method public boolean isUvcGadgetSupportEnabled(); } 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(); } Loading core/java/android/hardware/usb/IUsbManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,9 @@ interface IUsbManager /* Returns true if the specified USB function is enabled. */ boolean isFunctionEnabled(String function); /* Returns true if UVC gadget support is enabled. */ boolean isUvcGadgetSupportEnabled(); /* Sets the current USB function. */ @EnforcePermission("MANAGE_USB") void setCurrentFunctions(long functions, int operationId); Loading core/java/android/hardware/usb/UsbManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.PendingIntent; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; Loading Loading @@ -1436,6 +1438,21 @@ public class UsbManager { } } /** * Returns true if the specified UVC gadget function support is enabled. * <p> * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. public boolean isUvcGadgetSupportEnabled() { try { return mService.isUvcGadgetSupportEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Sets the current USB functions when in device mode. * <p> Loading Loading @@ -1641,6 +1658,7 @@ public class UsbManager { } } // TODO: b/396680593 Deprecate to de-dup with isUvcGadgetSupportEnabled() /** * Returns whether UVC is advertised to be supported or not. SELinux * enforces that this function returns {@code false} when called from a Loading services/usb/java/com/android/server/usb/UsbService.java +6 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.os.Bundle; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.service.usb.UsbServiceDumpProto; Loading Loading @@ -694,6 +695,11 @@ public class UsbService extends IUsbManager.Stub { return (getCurrentFunctions() & UsbManager.usbFunctionsFromString(function)) != 0; } @Override public boolean isUvcGadgetSupportEnabled() { return SystemProperties.getBoolean("ro.usb.uvc.enabled", false); } @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_USB) @Override public long getCurrentFunctions() { Loading Loading
core/api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1915,6 +1915,10 @@ package android.hardware.soundtrigger { package android.hardware.usb { public class UsbManager { method public boolean isUvcGadgetSupportEnabled(); } 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(); } Loading
core/java/android/hardware/usb/IUsbManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,9 @@ interface IUsbManager /* Returns true if the specified USB function is enabled. */ boolean isFunctionEnabled(String function); /* Returns true if UVC gadget support is enabled. */ boolean isUvcGadgetSupportEnabled(); /* Sets the current USB function. */ @EnforcePermission("MANAGE_USB") void setCurrentFunctions(long functions, int operationId); Loading
core/java/android/hardware/usb/UsbManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.PendingIntent; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; Loading Loading @@ -1436,6 +1438,21 @@ public class UsbManager { } } /** * Returns true if the specified UVC gadget function support is enabled. * <p> * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. public boolean isUvcGadgetSupportEnabled() { try { return mService.isUvcGadgetSupportEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Sets the current USB functions when in device mode. * <p> Loading Loading @@ -1641,6 +1658,7 @@ public class UsbManager { } } // TODO: b/396680593 Deprecate to de-dup with isUvcGadgetSupportEnabled() /** * Returns whether UVC is advertised to be supported or not. SELinux * enforces that this function returns {@code false} when called from a Loading
services/usb/java/com/android/server/usb/UsbService.java +6 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.os.Bundle; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.service.usb.UsbServiceDumpProto; Loading Loading @@ -694,6 +695,11 @@ public class UsbService extends IUsbManager.Stub { return (getCurrentFunctions() & UsbManager.usbFunctionsFromString(function)) != 0; } @Override public boolean isUvcGadgetSupportEnabled() { return SystemProperties.getBoolean("ro.usb.uvc.enabled", false); } @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_USB) @Override public long getCurrentFunctions() { Loading