Android去除默认USB调试授权确认框

--- 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);

+            }

+          //<

你可能感兴趣的:(Android去除默认USB调试授权确认框)