diff options
author | Quarx2k <agent00791@gmail.com> | 2013-03-31 21:24:24 +0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-04-13 05:53:02 -0700 |
commit | ea45df8f8c9c9cb0809ce6caf71bc55b7667d994 (patch) | |
tree | 927a13b75c3188488e6c722e7fb199625b508183 | |
parent | 9f94d8defa183a987749a1528c69de3893928ee2 (diff) | |
download | frameworks_base-ea45df8f8c9c9cb0809ce6caf71bc55b7667d994.zip frameworks_base-ea45df8f8c9c9cb0809ce6caf71bc55b7667d994.tar.gz frameworks_base-ea45df8f8c9c9cb0809ce6caf71bc55b7667d994.tar.bz2 |
Add UsbDebuggingManager and UsbDebuggingActivity to LegacyUsbManager
The UsbDebuggingManager listens to adbd requests and displays a dialog
when the public key authentification fails, for the user to confirm if it
wants to allow USB debugging from the attached host. If the user chooses
to always allow USB debugging, the UsbDebuggingManager writes the public
key to adbd's config file so that the public key authenfication succeeds
next time.
Change-Id: I819b8a0428ba34b68dadeb9fa67c53abb9a85fbc
-rw-r--r-- | services/java/com/android/server/usb/LegacyUsbDeviceManager.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/services/java/com/android/server/usb/LegacyUsbDeviceManager.java b/services/java/com/android/server/usb/LegacyUsbDeviceManager.java index dd9ba66..f143379 100644 --- a/services/java/com/android/server/usb/LegacyUsbDeviceManager.java +++ b/services/java/com/android/server/usb/LegacyUsbDeviceManager.java @@ -107,6 +107,7 @@ public class LegacyUsbDeviceManager extends UsbDeviceManager { private boolean mUseUsbNotification; private boolean mAdbEnabled; private boolean mLegacy = false; + private UsbDebuggingManager mDebuggingManager; private class AdbSettingsObserver extends ContentObserver { public AdbSettingsObserver() { @@ -165,6 +166,9 @@ public class LegacyUsbDeviceManager extends UsbDeviceManager { Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mHandler = new LegacyUsbHandler(thread.getLooper()); + if ("1".equals(SystemProperties.get("ro.adb.secure"))) { + mDebuggingManager = new UsbDebuggingManager(context); + } } public void setCurrentSettings(UsbSettingsManager settings) { @@ -552,6 +556,9 @@ public class LegacyUsbDeviceManager extends UsbDeviceManager { if (mCurrentAccessory != null) { getCurrentSettings().accessoryAttached(mCurrentAccessory); } + if (mDebuggingManager != null) { + mDebuggingManager.setAdbEnabled(mAdbEnabled); + } break; } } @@ -673,4 +680,25 @@ public class LegacyUsbDeviceManager extends UsbDeviceManager { } } } + + public void allowUsbDebugging(boolean alwaysAllow, String publicKey) { + if (mDebuggingManager != null) { + mDebuggingManager.allowUsbDebugging(alwaysAllow, publicKey); + } + } + + public void denyUsbDebugging() { + if (mDebuggingManager != null) { + mDebuggingManager.denyUsbDebugging(); + } + } + + public void dump(FileDescriptor fd, PrintWriter pw) { + if (mHandler != null) { + mHandler.dump(fd, pw); + } + if (mDebuggingManager != null) { + mDebuggingManager.dump(fd, pw); + } + } } |