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

Commit 7b7f8aba authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "usb: Implement the AIDL in framework"

parents 47ef6a4e 74272e24
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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";
@@ -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);
                }
+1 −0
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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();
+103 −74

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -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