1、找到
frameworks / base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
2、修改
final StorageManager storageManager = StorageManager.from(mContext);
final StorageVolume primary = storageManager.getPrimaryVolume();
massStorageSupported = primary != null && primary.allowMassStorage();
mUseUsbNotification = !massStorageSupported && mContext.getResources().getBoolean(
com.android.internal.R.bool.config_usbChargingMessage);
// make sure the ADB_ENABLED setting value matches the current state
try {
+ Settings.Global.putInt(mContentResolver,
+ Settings.Global.ADB_ENABLED, 1);
} catch (SecurityException e) {
// If UserManager.DISALLOW_DEBUGGING_FEATURES is on, that this setting can't be changed.
Slog.d(TAG, "ADB_ENABLED is restricted.");
}
mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
}