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

Commit 8d6630b8 authored by Michael Kwan's avatar Michael Kwan
Browse files

DO NOT MERGE ANYWHERE - Hack to disable MTP mode on Clockwork devices.

Android currently forces USB into MTP mode if there was no modes
specified. This causes issues on Clockwork devices as they do not
support MTP.

The hack stops this behaviour, and also sets MTP mode back to none.

Bug: 25547826
Bug: 25582050
Bug: 25244201
Change-Id: I772e35d0a5db51b17e9d71c59e6a157dabb1d296
parent 062c629e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -332,9 +332,11 @@ public class UsbDeviceManager {
                // Restore default functions.
                mCurrentFunctions = SystemProperties.get(USB_CONFIG_PROPERTY,
                        UsbManager.USB_FUNCTION_NONE);
                if (UsbManager.USB_FUNCTION_NONE.equals(mCurrentFunctions)) {
                    mCurrentFunctions = UsbManager.USB_FUNCTION_MTP;
                // HACK START FOR DEVICES WITHOUT SUPPORT MTP, WATCH ONLY, DO NOT MERGE BACK TO AOSP
                if (UsbManager.USB_FUNCTION_MTP.equals(mCurrentFunctions)) {
                    mCurrentFunctions = UsbManager.USB_FUNCTION_NONE;
                }
                // HACK ENDS (mkwan@ added 2015-11-16)
                mCurrentFunctionsApplied = mCurrentFunctions.equals(
                        SystemProperties.get(USB_STATE_PROPERTY));
                mAdbEnabled = UsbManager.containsFunction(getDefaultFunctions(),
@@ -838,9 +840,11 @@ public class UsbDeviceManager {
        private String getDefaultFunctions() {
            String func = SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY,
                    UsbManager.USB_FUNCTION_NONE);
            if (UsbManager.USB_FUNCTION_NONE.equals(func)) {
                func = UsbManager.USB_FUNCTION_MTP;
            // HACK START FOR DEVICES WITHOUT SUPPORT MTP, WATCH ONLY, DO NOT MERGE BACK TO AOSP
            if (UsbManager.USB_FUNCTION_MTP.equals(func)) {
                func = UsbManager.USB_FUNCTION_NONE;
            }
            // HACK ENDS (mkwan@ added 2015-11-16)
            return func;
        }