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

Commit d60784cc authored by Kun Liang's avatar Kun Liang Committed by Gerrit - the friendly Code Review server
Browse files

USB: Don't add adb function when usb disconnected

When USB is disconnected, "adb" functions will be added even in
"charging" mode. This breaks "charging" mode's design.

Change-Id: I7ab62194a0acb97620e33da4839e0f6c87f60917
parent 14b7109d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ public class UsbDeviceManager {
            // with OEM specific mode.
            if (functions != null && makeDefault && !needsOemUsbOverride()) {

                if (!"charging".equals(functions)) {
                if (!UsbManager.USB_FUNCTION_CHARGING.equals(functions)) {
                    if (mAdbEnabled) {
                        functions = addFunction(functions, UsbManager.USB_FUNCTION_ADB);
                    } else {
@@ -495,11 +495,13 @@ public class UsbDeviceManager {
                // Override with bootmode specific usb mode if needed
                functions = processOemUsbOverride(functions);

                if (!UsbManager.USB_FUNCTION_CHARGING.equals(functions)) {
                    if (mAdbEnabled) {
                        functions = addFunction(functions, UsbManager.USB_FUNCTION_ADB);
                    } else {
                        functions = removeFunction(functions, UsbManager.USB_FUNCTION_ADB);
                    }
                }
                if (!mCurrentFunctions.equals(functions)) {
                    if (!setUsbConfig("none")) {
                        Slog.e(TAG, "Failed to disable USB");