Loading cmds/svc/src/com/android/commands/svc/UsbCommand.java +9 −1 Original line number Diff line number Diff line Loading @@ -29,12 +29,18 @@ import android.os.ServiceManager; import java.util.function.Consumer; import java.util.concurrent.Executor; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public class UsbCommand extends Svc.Command { public UsbCommand() { super("usb"); } /** * Counter for tracking UsbOperation operations. */ private static final AtomicInteger sUsbOperationCount = new AtomicInteger(); @Override public String shortHelp() { return "Control Usb state"; Loading Loading @@ -92,8 +98,10 @@ public class UsbCommand extends Svc.Command { if ("setFunctions".equals(args[1])) { try { int operationId = sUsbOperationCount.incrementAndGet(); System.out.println("setCurrentFunctions opId:" + operationId); usbMgr.setCurrentFunctions(UsbManager.usbFunctionsFromString( args.length >= 3 ? args[2] : "")); args.length >= 3 ? args[2] : ""), operationId); } catch (RemoteException e) { System.err.println("Error communicating with UsbManager: " + e); } Loading core/api/module-lib-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ package android.hardware.usb { field public static final int GADGET_HAL_V1_0 = 10; // 0xa field public static final int GADGET_HAL_V1_1 = 11; // 0xb field public static final int GADGET_HAL_V1_2 = 12; // 0xc field public static final int GADGET_HAL_V2_0 = 20; // 0x14 field public static final int USB_DATA_TRANSFER_RATE_10G = 10240; // 0x2800 field public static final int USB_DATA_TRANSFER_RATE_20G = 20480; // 0x5000 field public static final int USB_DATA_TRANSFER_RATE_40G = 40960; // 0xa000 Loading core/java/android/hardware/usb/IUsbManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -122,10 +122,10 @@ interface IUsbManager boolean isFunctionEnabled(String function); /* Sets the current USB function. */ void setCurrentFunctions(long functions); void setCurrentFunctions(long functions, int operationId); /* Compatibility version of setCurrentFunctions(long). */ void setCurrentFunction(String function, boolean usbDataUnlocked); void setCurrentFunction(String function, boolean usbDataUnlocked, int operationId); /* Gets the current USB functions. */ long getCurrentFunctions(); Loading core/java/android/hardware/usb/UsbManager.java +103 −74 File changed.Preview size limit exceeded, changes collapsed. Show changes services/usb/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -33,5 +33,6 @@ java_library_static { "android.hardware.usb.gadget-V1.0-java", "android.hardware.usb.gadget-V1.1-java", "android.hardware.usb.gadget-V1.2-java", "android.hardware.usb.gadget-V1-java", ], } Loading
cmds/svc/src/com/android/commands/svc/UsbCommand.java +9 −1 Original line number Diff line number Diff line Loading @@ -29,12 +29,18 @@ import android.os.ServiceManager; import java.util.function.Consumer; import java.util.concurrent.Executor; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public class UsbCommand extends Svc.Command { public UsbCommand() { super("usb"); } /** * Counter for tracking UsbOperation operations. */ private static final AtomicInteger sUsbOperationCount = new AtomicInteger(); @Override public String shortHelp() { return "Control Usb state"; Loading Loading @@ -92,8 +98,10 @@ public class UsbCommand extends Svc.Command { if ("setFunctions".equals(args[1])) { try { int operationId = sUsbOperationCount.incrementAndGet(); System.out.println("setCurrentFunctions opId:" + operationId); usbMgr.setCurrentFunctions(UsbManager.usbFunctionsFromString( args.length >= 3 ? args[2] : "")); args.length >= 3 ? args[2] : ""), operationId); } catch (RemoteException e) { System.err.println("Error communicating with UsbManager: " + e); } Loading
core/api/module-lib-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ package android.hardware.usb { field public static final int GADGET_HAL_V1_0 = 10; // 0xa field public static final int GADGET_HAL_V1_1 = 11; // 0xb field public static final int GADGET_HAL_V1_2 = 12; // 0xc field public static final int GADGET_HAL_V2_0 = 20; // 0x14 field public static final int USB_DATA_TRANSFER_RATE_10G = 10240; // 0x2800 field public static final int USB_DATA_TRANSFER_RATE_20G = 20480; // 0x5000 field public static final int USB_DATA_TRANSFER_RATE_40G = 40960; // 0xa000 Loading
core/java/android/hardware/usb/IUsbManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -122,10 +122,10 @@ interface IUsbManager boolean isFunctionEnabled(String function); /* Sets the current USB function. */ void setCurrentFunctions(long functions); void setCurrentFunctions(long functions, int operationId); /* Compatibility version of setCurrentFunctions(long). */ void setCurrentFunction(String function, boolean usbDataUnlocked); void setCurrentFunction(String function, boolean usbDataUnlocked, int operationId); /* Gets the current USB functions. */ long getCurrentFunctions(); Loading
core/java/android/hardware/usb/UsbManager.java +103 −74 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/usb/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -33,5 +33,6 @@ java_library_static { "android.hardware.usb.gadget-V1.0-java", "android.hardware.usb.gadget-V1.1-java", "android.hardware.usb.gadget-V1.2-java", "android.hardware.usb.gadget-V1-java", ], }