From f10d0399bf5f519dff414a9d195a0eaacb37f9b7 Mon Sep 17 00:00:00 2001 From: Aaron Whyte Date: Fri, 28 Mar 2014 14:42:39 -0700 Subject: [PATCH] Made secure-adb's new-public-key activity configurable. Some devices do not have lockscreens themselves, so the plan is to have them do RPCs to companion devices that can have lockscreens, for allowing or rejecting unwhitelisted adb public keys. Change-Id: I6f7504313074e6748c0bd467a29ac3a311036f4d --- core/res/res/values/config.xml | 7 +++++++ core/res/res/values/symbols.xml | 1 + .../server/usb/UsbDebuggingManager.java | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 5007f7a81cb4f..45a2c80c0c1b3 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1331,6 +1331,12 @@ Example: com.google.android.myapp/.resolver.MyResolverActivity --> + + com.android.systemui/com.android.systemui.usb.UsbDebuggingActivity + ;com.android.settings; @@ -1413,4 +1419,5 @@ 1 - The device DOES have a permanent menu key; ignore autodetection. 2 - The device DOES NOT have a permanent menu key; ignore autodetection. --> 0 + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 093eb3bd0a811..323494aa751e9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1625,6 +1625,7 @@ + diff --git a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java index ce953a4b134e7..f73d4259489ea 100644 --- a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java +++ b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java @@ -17,8 +17,10 @@ package com.android.server.usb; import android.content.ActivityNotFoundException; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.os.Handler; @@ -244,15 +246,18 @@ public class UsbDebuggingManager implements Runnable { } private void showConfirmationDialog(String key, String fingerprints) { - Intent dialogIntent = new Intent(); + Intent intent = new Intent(); - dialogIntent.setClassName("com.android.systemui", - "com.android.systemui.usb.UsbDebuggingActivity"); - dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - dialogIntent.putExtra("key", key); - dialogIntent.putExtra("fingerprints", fingerprints); + ComponentName componentName = ComponentName.unflattenFromString( + Resources.getSystem().getString( + com.android.internal.R.string.config_customAdbPublicKeyActivity)); + intent.setClassName(componentName.getPackageName(), + componentName.getClassName()); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra("key", key); + intent.putExtra("fingerprints", fingerprints); try { - mContext.startActivity(dialogIntent); + mContext.startActivity(intent); } catch (ActivityNotFoundException e) { Slog.e(TAG, "unable to start UsbDebuggingActivity"); }