From 7b498ab8c2e26f18b8633707823087082898b19b Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 24 Jun 2020 16:18:38 -0700 Subject: [PATCH 1/2] AdbDebuggingManager: improve logging. Bug: http://b/159061108 Test: none Change-Id: Ie1bc4a924bd0443f4566743cc145cefdd07e2052 --- .../core/java/com/android/server/adb/AdbDebuggingManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/adb/AdbDebuggingManager.java b/services/core/java/com/android/server/adb/AdbDebuggingManager.java index df3b6880fdfbf..ed83a644cbfb2 100644 --- a/services/core/java/com/android/server/adb/AdbDebuggingManager.java +++ b/services/core/java/com/android/server/adb/AdbDebuggingManager.java @@ -878,6 +878,7 @@ public class AdbDebuggingManager { case MESSAGE_ADB_DENY: if (mThread != null) { + Slog.w(TAG, "Denying adb confirmation"); mThread.sendResponse("NO"); logAdbConnectionChanged(null, AdbProtoEnums.USER_DENIED, false); } @@ -887,7 +888,7 @@ public class AdbDebuggingManager { String key = (String) msg.obj; if ("trigger_restart_min_framework".equals( SystemProperties.get("vold.decrypt"))) { - Slog.d(TAG, "Deferring adb confirmation until after vold decrypt"); + Slog.w(TAG, "Deferring adb confirmation until after vold decrypt"); if (mThread != null) { mThread.sendResponse("NO"); logAdbConnectionChanged(key, AdbProtoEnums.DENIED_VOLD_DECRYPT, false); From 7b66783514ff6eecbb7033d4d318f2255983cea1 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 24 Jun 2020 16:55:35 -0700 Subject: [PATCH 2/2] UsbDebuggingActivity: notify failure in onDestroy, not onStop. On initial boot, the prompt can be shown and then get hidden, which would previously cause the initial public key authorization request to be spuriously rejected, if the adb client was running during boot. Move the rejection to onDestroy instead, so we only reject prompts that have no chance of being actually accepted. Bug: http://b/159061108 Test: manual Change-Id: I9acb1145b1f8a6c8d6f82d1c4459bcd86eb306df --- .../src/com/android/systemui/usb/UsbDebuggingActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java index bc2a55c8d5c49..7561af7702986 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java @@ -139,13 +139,18 @@ public class UsbDebuggingActivity extends AlertActivity if (mDisconnectedReceiver != null) { mBroadcastDispatcher.unregisterReceiver(mDisconnectedReceiver); } + super.onStop(); + } + + @Override + protected void onDestroy() { // If the ADB service has not yet been notified due to this dialog being closed in some // other way then notify the service to deny the connection to ensure system_server sends // a response to adbd. if (!mServiceNotified) { notifyService(false); } - super.onStop(); + super.onDestroy(); } @Override