From b210026e3d5c955628ca8b8b9191ade08891e9ef Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Wed, 22 Jul 2015 12:59:47 -0700 Subject: UsbDeviceManager: fix b/21429947 regression As discussed in b/21429947 (commit 674019065bceb4150190bfb1aa63cda9de0a8560), 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 fcf10f7c12cb3107bdfedce6f76a8c866d154f3c, the intent was that the persistent property would only hold the persistent adb state. Bug: 22447614 Bug: 21429947 Change-Id: I8b3690a1bafb7cea0d5a69d73c1065c7fc64c653 --- services/usb/java/com/android/server/usb/UsbDeviceManager.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'services') diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 1787b91..4cfa37a 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -49,10 +49,8 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.server.FgThread; import java.io.File; -import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.PrintWriter; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -807,8 +805,7 @@ public class UsbDeviceManager { } private String getDefaultFunctions() { - return SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, - UsbManager.USB_FUNCTION_ADB); + return mAdbEnabled ? UsbManager.USB_FUNCTION_ADB : UsbManager.USB_FUNCTION_MTP; } public void dump(IndentingPrintWriter pw) { -- cgit v1.1