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

Commit b210026e authored by Nick Kralevich's avatar Nick Kralevich
Browse files

UsbDeviceManager: fix b/21429947 regression

As discussed in b/21429947 (commit
67401906), MTP must always be
enabled, even if access to the underlying MTP data is disabled.
Otherwise, Android will not enumerate on the USB bus, and won't
receive notifications from the kernel about USB state changes. This
effectively prevents using MTP functionality on user builds, or
on userdebug/eng builds with adb turned off.

Always ensure that MTP is the default driver mode.

Get rid of one use of the persistent property. The persistent property
was already pulled from a number of devices, and as explained in
commit fcf10f7c, the intent was that
the persistent property would only hold the persistent adb state.

Bug: 22447614
Bug: 21429947
Change-Id: I8b3690a1bafb7cea0d5a69d73c1065c7fc64c653
parent db71828c
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -49,10 +49,8 @@ import com.android.internal.util.IndentingPrintWriter;
import com.android.server.FgThread;
import com.android.server.FgThread;


import java.io.File;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.LinkedList;
import java.util.List;
import java.util.List;
@@ -807,8 +805,7 @@ public class UsbDeviceManager {
        }
        }


        private String getDefaultFunctions() {
        private String getDefaultFunctions() {
            return SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY,
            return mAdbEnabled ? UsbManager.USB_FUNCTION_ADB : UsbManager.USB_FUNCTION_MTP;
                    UsbManager.USB_FUNCTION_ADB);
        }
        }


        public void dump(IndentingPrintWriter pw) {
        public void dump(IndentingPrintWriter pw) {