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

Commit a694b103 authored by jianzhou's avatar jianzhou Committed by Linux Build Service Account
Browse files

UsbManager: Add the support of USB charging only function

Add one function of USB charging mode without adb function enabled.

Change-Id: I8046607a1c9eb8ba9bf7ac8338dd165a72b738c4
CRs-Fixed: 997842
parent 5a9a2d95
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -244,6 +244,14 @@ public class UsbManager {
     */
    public static final String USB_FUNCTION_ACCESSORY = "accessory";

    /**
     * Name of the charging USB function.
     * Used in extras for the {@link #ACTION_USB_STATE} broadcast
     *
     * {@hide}
     */
    public static final String USB_FUNCTION_CHARGING = "charging";

    /**
     * Name of extra for {@link #ACTION_USB_PORT_CHANGED}
     * containing the {@link UsbPort} object for the port.
+3 −1
Original line number Diff line number Diff line
@@ -528,7 +528,9 @@ public class UsbDeviceManager {
        }

        private String applyAdbFunction(String functions) {
            if (mAdbEnabled) {
            //Not enable adb when it s charging mode
            if (mAdbEnabled &&
                !UsbManager.containsFunction(functions, UsbManager.USB_FUNCTION_CHARGING)) {
                functions = UsbManager.addFunction(functions, UsbManager.USB_FUNCTION_ADB);
            } else {
                functions = UsbManager.removeFunction(functions, UsbManager.USB_FUNCTION_ADB);
+1 −0
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@ public class UsbService extends IUsbManager.Stub {
            case UsbManager.USB_FUNCTION_MTP:
            case UsbManager.USB_FUNCTION_PTP:
            case UsbManager.USB_FUNCTION_RNDIS:
            case UsbManager.USB_FUNCTION_CHARGING:
                return true;
        }