本文是基于Android5.1的代码
device\mediatek\common\device.mk
关键字:persist.sys.usb.config
# default usb function
ifeq ($(strip $(MTK_MASS_STORAGE)),yes)
ADDITIONAL_DEFAULT_PROPERTIES += persist.sys.usb.config=mtp
else
ADDITIONAL_DEFAULT_PROPERTIES += persist.sys.usb.config=mtp
endif
默认其他模式,根据一下参考可更改值:
<span style="color:#999999;">public static final String USB_FUNCTION_MASS_STORAGE = mass_storage;public static final String USB_FUNCTION_ADB = adb;public static final String USB_FUNCTION_RNDIS = rndis;public static final String USB_FUNCTION_MTP = mtp;public static final String USB_FUNCTION_PTP = ptp;public static final String USB_FUNCTION_AUDIO_SOURCE = audio_source;public static final String USB_FUNCTION_CHARGING = charging;