一,MTK Android5.1
\frameworks\base\packages\SystemUI\src\com\android\systemui\usb\UsbDebuggingActivity.java
private class UsbDisconnectedReceiver extends BroadcastReceiver {
private final Activity mActivity;
public UsbDisconnectedReceiver(Activity activity) {
mActivity = activity;
}
@Override
public void onReceive(Context content, Intent intent) {
String action = intent.getAction();
if (!UsbManager.ACTION_USB_STATE.equals(action)) {
return;
}
//去usb调试授权弹窗
mActivity.finish();
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);
}
//boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
//if (!connected) {
// mActivity.finish();
//}
}
}