三行代码去Android USB ADB调试确认对话框

Android 5.1.1补丁如下:
frameworks/base/packages/SystemUI/res/values/strings.xml:    Allow USB debugging?
frameworks/base/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java:         ap.mTitle = getString(R.string.usb_debugging_title);
frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java allowUsbDebugging
frameworks/base/services/usb/java/com/android/server/usb/UsbDebuggingManager.java MESSAGE_ADB_CONFIRM
frameworks/base/core/res/res/values/config.xml config_customAdbPublicKeyConfirmationComponent


--- a/base/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
+++ b/base/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
@@ -90,7 +90,9 @@ public class UsbDebuggingManager implements Runnable {
                 if (buffer[0] == 'P' && buffer[1] == 'K') {
                     String key = new String(Arrays.copyOfRange(buffer, 2, count));
                     Slog.d(TAG, "Received public key: " + key);
-                    Message msg = mHandler.obtainMessage(UsbDebuggingHandler.MESSAGE_ADB_CONFIRM);
+                    Message msg = mHandler.obtainMessage(UsbDebuggingHandler.MESSAGE_ADB_ALLOW);
+                    mFingerprints = getFingerprints(key);
+                    msg.arg1 = 1;
                     msg.obj = key;
                     mHandler.sendMessage(msg);
                 }

你可能感兴趣的:(Android)