将USB的默认选项更改为MTP文件传输。 修改文件为frameworks/base/services/USB/Java/com/Android/server/USB/USB设备管理器. Java。
. @ overridepublicvoidhandlemessage (消息msg ) switch ) msg.what ) case msg _ update _ state 3360 mconnected=) MSE msg 更新用户通告(false; 更新数据库通告(false; 集成电路(mbootcompleted ) (更新用户总线连接评估功能); } if ((mcurrentfunctionsusbmanager.function _ accessory )!=0) {更新数据中心访问sory (; (if ) mbootcompleted ) if (! 已连接! has消息(msg _ accessory _ mode _ enter _ time out )! has messages (msg _ function _ switch _ time out )/restoredefaultswhenusbisdisconnectedif (! mscreenlockedmscreenunlockedfunctions!=USB manager.function _ none (setscreenunlockedfunctions ); } else//2021 10 24 felixmamodifyusbdefaultvalue//setenabled functions (USB manager.function _ none,false ); 已启用功能(USB manager.function _ MTP,false ); } } updateUsbFunctions (; } else { mpendingbootbroadcast=true; } break; }protectedvoidfinishboot((if ) mbootcompletedmcurrentusbfunctionsreceivedmsystemready (if ) mpendingbootbroadcast ) )是(if (! mscreenlockedmscreenunlockedfunctions!=USB manager.function _ none (setscreenunlockedfunctions ); } else//2021 10 24 felixmamodifyusbdefaultvalue//setenabled functions (USB manager.function _ none,false ); 已启用功能(USB manager.function _ MTP,false ); (if ) mcurrentaccessory!=null (musbdevicemanager.getcurrentsettings ().accessoryattached ) mcurrentaccessory ); }更新用户通告(假); 更新数据库通告(false; updateUsbFunctions (; } .