Android连接USB默认选中MTP模式,并删除"为设备充电选项"
Android系统默认连接USB会显示:正在通过USB为此设备充电,需求是删除“为设备充电选项”,那默认选中就需要改成MTP模式。
RK3399平台 7.1.2中测试成功
//默认选中MTP模式 更改UsbDeviceManager.java
a/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
public class UsbDeviceManager {
private UsbManager mUsbManager;
public void handleMessage(Message msg) {
SomeArgs args;
switch (msg.what) {
case MSG_UPDATE_STATE:
mConnected = (msg.arg1 == 1);
mConfigured = (msg.arg2 == 1);
updateUsbNotification();
updateAdbNotification();
if (UsbManager.containsFunction(mCurrentFunctions,
...... ......
} else if (!mConnected) {
// restore defaults when USB is discon