summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michael Kwan <mkwan@google.com> 2015-11-16 12:59:37 -0800
committer Michael Kwan <mkwan@google.com> 2015-11-16 14:05:29 -0800
commit8d6630b87c93f569bbf5fc5b426fe2a1c2ff2ceb (patch)
treeb0aea78ace845780b7baad3643b2f7b46c700b16
parent062c629e5c6270da232bbd2800966ab5dc6c615f (diff)
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
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 81ca6a362bd5..089a0d0c1082 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -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;
}