环境
开发板:RK3288
系统:Android7.1
开发环境:Ubuntu14
修改源码
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
@@ -93,10 +93,20 @@ public class UsbDebuggingActivity extends AlertActivity
if (!UsbManager.ACTION_USB_STATE.equals(action)) {
return;
}
- boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
+ boolean connected = false;//
+ //intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
if (!connected) {
mActivity.finish();
}
+ //allowUsbDebugging
+ 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);
+ }
+ //<
网友评论