屏蔽USB插入时的弹出窗口

屏蔽USB插入时的弹出窗口

frameworks/base/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java

@@ -94,9 +94,16 @@ public class UsbDebuggingActivity extends AlertActivity
             if (!UsbManager.ACTION_USB_STATE.equals(action)) {
                 return;
             }
-            boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
-            if (!connected) {
+            //boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
+                       boolean connected = false;//直接关闭对话框
+            //if (!connected) {
                 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);
             }
         }
     }
上一篇:zookeeper简介及基操


下一篇:Connected Graph