diff --git a/alps/build/make/tools/post_process_props.py b/alps/build/make/tools/post_process_props.py
index cb48d37dc16..9ddd5d76771 100755
--- a/alps/build/make/tools/post_process_props.py
+++ b/alps/build/make/tools/post_process_props.py
@@ -47,16 +47,12 @@ def mangle_default_prop(prop):
val = "adb"
else:
val = val + ",adb"
- if "mtp" not in val:
- val = "mtp," + val
prop.put("persist.sys.usb.config", val)
# UsbDeviceManager expects a value here. If it doesn't get it, it will
# default to "adb". That might not the right policy there, but it's better
# to be explicit.
if not prop.get("persist.sys.usb.config"):
- prop.put("persist.sys.usb.config", "mtp");
- if prop.get("ro.adb.secure") == "0":
- prop.put("persist.sys.usb.config", "mtp,adb");
+ prop.put("persist.sys.usb.config", "none");
def validate(prop):
"""Validate the properties.
diff --git a/alps/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/alps/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
old mode 100644
new mode 100755
index 02f7df55cbb..5f4131d386c
--- a/alps/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/alps/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -510,7 +510,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
mScreenUnlockedFunctions = UsbManager.usbFunctionsFromString(
mSettings.getString(
String.format(Locale.ENGLISH, UNLOCKED_CONFIG_PREF, mCurrentUser),
- UsbManager.usbFunctionsToString(UsbManager.FUNCTION_MTP)));//modified by dhy..
+ ""));
}
// We do not show the USB notification if the primary volume supports mass storage.
@@ -766,7 +766,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
}
private void setScreenUnlockedFunctions() {
- setEnabledFunctions(mScreenUnlockedFunctions, true);
+ setEnabledFunctions(mScreenUnlockedFunctions, false);
}
private static class AdbTransport extends IAdbTransport.Stub {
@@ -821,10 +821,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
&& mScreenUnlockedFunctions != UsbManager.FUNCTION_NONE) {
setScreenUnlockedFunctions();
} else {
- // dhy modify begin: Set MTP as default when USB cable connected
- //setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
- setEnabledFunctions(UsbManager.FUNCTION_MTP, true);
- //dhy modify end.
+ setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
}
}
updateUsbFunctions();
@@ -918,10 +915,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
// If the screen is unlocked, also set current functions.
setScreenUnlockedFunctions();
} else {
- // dhy modify begin: Set MTP as default when USB cable connected
- //setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
- setEnabledFunctions(UsbManager.FUNCTION_MTP, true);
- //dhy modify end.
+ setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
}
break;
case MSG_UPDATE_SCREEN_LOCK:
@@ -986,10 +980,10 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
mCurrentUser = msg.arg1;
mScreenLocked = true;
mScreenUnlockedFunctions = UsbManager.FUNCTION_NONE;
- if (mSettings != null) {//modified by dhy..
+ if (mSettings != null) {
mScreenUnlockedFunctions = UsbManager.usbFunctionsFromString(
mSettings.getString(String.format(Locale.ENGLISH,
- UNLOCKED_CONFIG_PREF, mCurrentUser), UsbManager.usbFunctionsToString(UsbManager.FUNCTION_MTP)));
+ UNLOCKED_CONFIG_PREF, mCurrentUser), ""));
}
setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
}
@@ -1017,10 +1011,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
&& mScreenUnlockedFunctions != UsbManager.FUNCTION_NONE) {
setScreenUnlockedFunctions();
} else {
- // dhy modify begin: Set MTP as default when USB cable connected
- //setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
- setEnabledFunctions(UsbManager.FUNCTION_MTP, true);
- //dhy modify end.
+ setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
}
if (mCurrentAccessory != null) {
mUsbDeviceManager.getCurrentSettings().accessoryAttached(mCurrentAccessory);
@@ -1042,7 +1033,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
}
protected void updateUsbNotification(boolean force) {
- if (mNotificationManager == null || !mUseUsbNotification
+ if (mNotificationManager == null || mUseUsbNotification
|| ("0".equals(getSystemProperty("persist.charging.notify", "")))) {
return;
}
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsController.java b/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsController.java
old mode 100644
new mode 100755
index 31bca1241ec..9792905ce2f
--- a/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsController.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsController.java
@@ -43,10 +43,10 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
static final Map<Long, Integer> FUNCTIONS_MAP = new LinkedHashMap<>();
static {
- FUNCTIONS_MAP.put(UsbManager.FUNCTION_MTP, R.string.usb_use_file_transfers);
- FUNCTIONS_MAP.put(UsbManager.FUNCTION_RNDIS, R.string.usb_use_tethering);
- FUNCTIONS_MAP.put(UsbManager.FUNCTION_MIDI, R.string.usb_use_MIDI);
- FUNCTIONS_MAP.put(UsbManager.FUNCTION_PTP, R.string.usb_use_photo_transfers);
+ //FUNCTIONS_MAP.put(UsbManager.FUNCTION_MTP, R.string.usb_use_file_transfers);
+ // FUNCTIONS_MAP.put(UsbManager.FUNCTION_RNDIS, R.string.usb_use_tethering);
+ // FUNCTIONS_MAP.put(UsbManager.FUNCTION_MIDI, R.string.usb_use_MIDI);
+ //FUNCTIONS_MAP.put(UsbManager.FUNCTION_PTP, R.string.usb_use_photo_transfers);
FUNCTIONS_MAP.put(UsbManager.FUNCTION_NONE, R.string.usb_use_charging_only);
}
相关修改文件以及说明:
build/make/tools/post_process_props.py 用于把USB 连接模式改成只充电
vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsController.java 去掉 usb 链接时候 可以选择传输文件的菜单项。
frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java 用于把MTP 模式改成只充电模式 。
最后 客户连 插上USB 的通知 也想去掉 ,不想有任何提示 。
protected void updateUsbNotification(boolean force) {
- if (mNotificationManager == null || !mUseUsbNotification
+ if (mNotificationManager == null || mUseUsbNotification