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

Commit 2a2ece97 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "asynchronous_resetUsbPort" into tm-dev am: 901ab795 am: 478f09b4

parents a0aa0403 478f09b4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;

import java.util.function.Consumer;
import java.util.concurrent.Executor;
import java.util.List;

public class UsbCommand extends Svc.Command {
@@ -81,6 +83,13 @@ public class UsbCommand extends Svc.Command {
            IUsbManager usbMgr = IUsbManager.Stub.asInterface(ServiceManager.getService(
                    Context.USB_SERVICE));

            Executor executor = context.getMainExecutor();
            Consumer<Integer> consumer = new Consumer<Integer>(){
                public void accept(Integer status){
                    System.out.println("Consumer status: " + status);
                };
            };

            if ("setFunctions".equals(args[1])) {
                try {
                    usbMgr.setCurrentFunctions(UsbManager.usbFunctionsFromString(
@@ -179,7 +188,7 @@ public class UsbCommand extends Svc.Command {
                        if (port != null && portStatus.isConnected()) {
                            System.err.println(
                                    "Reset the USB port: port" + portNum);
                            port.resetUsbPort();
                            port.resetUsbPort(executor, consumer);
                        } else {
                            System.err.println(
                                    "There is no available reset USB port");