路径:
android6.0\frameworks\base\packages\SystemUI\src\com\android\systemui\usb\UsbDebuggingActivity.java
在onCreate最后,添加:
//setupAlert();
doConfirm();
doConfirm模拟了onClick的流程:
public void doConfirm(){
try {
IBinder b = ServiceManager.getService(USB_SERVICE);
IUsbManager service = IUsbManager.Stub.asInterface(b);
service.allowUsbDebugging(true, mKey);
} catch (Exception e) {
Log.e(TAG, "Unable to notify Usb service", e);
}
finish();
}