summaryrefslogtreecommitdiffstats
path: root/services/usb
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-06-12 17:19:12 -0700
committerNick Kralevich <nnk@google.com>2015-06-12 17:21:25 -0700
commit43965fe5cecd2bc8e139f4cbd012e5d6407ac7f6 (patch)
tree3d14dc057dc809795573df076d1fb396ed39e081 /services/usb
parente61fc94b9b6d4ccba60cca9ac0e0a67539f18780 (diff)
downloadframeworks_base-43965fe5cecd2bc8e139f4cbd012e5d6407ac7f6.zip
frameworks_base-43965fe5cecd2bc8e139f4cbd012e5d6407ac7f6.tar.gz
frameworks_base-43965fe5cecd2bc8e139f4cbd012e5d6407ac7f6.tar.bz2
UsbDeviceManager: Modify default function handling
When adb is enabled, there's no need to also enable MTP mode. ADB mode enabled is sufficient to get connect messages from the kernel driver. This change modifies getDefaultFunctions() to return adb mode if adb is enabled, but mtp when it's not enabled. Also stop using "none" mode as the default. "none" should only be used when toggling the driver. Bug: 21429947 Change-Id: I767491417c6c69a120fcf4f3d6ec0c73311a1a60
Diffstat (limited to 'services/usb')
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 588f8c6..3d610b2 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -352,7 +352,7 @@ public class UsbDeviceManager {
SystemProperties.get(UsbManager.ADB_PERSISTENT_PROPERTY, "adb"),
UsbManager.USB_FUNCTION_ADB);
- mCurrentFunctions = mAdbEnabled ? "adb" : UsbManager.USB_FUNCTION_MTP;
+ mCurrentFunctions = getDefaultFunctions();
String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim();
updateState(state);
@@ -474,7 +474,7 @@ public class UsbDeviceManager {
if (DEBUG) Slog.d(TAG, "setEnabledFunctions " + functions);
if (functions == null) {
- functions = "none";
+ functions = getDefaultFunctions();
}
if (mAdbEnabled) {
@@ -795,7 +795,7 @@ public class UsbDeviceManager {
}
private String getDefaultFunctions() {
- return UsbManager.USB_FUNCTION_MTP;
+ return mAdbEnabled ? UsbManager.USB_FUNCTION_ADB : UsbManager.USB_FUNCTION_MTP;
}
public void dump(FileDescriptor fd, PrintWriter pw) {