本文是基于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
默认其他模式,根据一下参考可更改值:
public static final StringUSB_FUNCTION_MASS_STORAGE=mass_storage;
public static final StringUSB_FUNCTION_ADB=adb;
public static final StringUSB_FUNCTION_RNDIS=rndis;
public static final StringUSB_FUNCTION_MTP=mtp;
public static final StringUSB_FUNCTION_PTP=ptp;
public static final StringUSB_FUNCTION_AUDIO_SOURCE=audio_source;
public static final StringUSB_FUNCTION_CHARGING=charging;