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

Commit 5520812d authored by Kun Liang's avatar Kun Liang
Browse files

AppOps: Don't add "adb" if it is "charging" function

adb function is not allowed under "charging" mode. So we don't add
"adb" into functions in this case.

Change-Id: I7b12654b7a10b7dccefa73453dd1d4d5a1a67f36
parent e4087a5c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -461,11 +461,13 @@ public class UsbDeviceManager {
            // with OEM specific mode.
            if (functions != null && makeDefault && !needsOemUsbOverride()) {

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