From d81a805a4c410201adc19bd44328c8902ca20687 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Fri, 17 Apr 2020 14:42:25 -0700 Subject: [PATCH] adbconnection: silence logspam. Userdebug devices enable JDWP for every process, so if adbd is turned off manually, we get an error message for every single process on the system. Bug: http://b/154319466 Test: manual Change-Id: Ia702974d371e35497573c31e22cfb2b572334590 --- adb/libs/adbconnection/adbconnection_client.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/adb/libs/adbconnection/adbconnection_client.cpp b/adb/libs/adbconnection/adbconnection_client.cpp index c13234218..7e1614835 100644 --- a/adb/libs/adbconnection/adbconnection_client.cpp +++ b/adb/libs/adbconnection/adbconnection_client.cpp @@ -140,7 +140,13 @@ AdbConnectionClientContext* adbconnection_client_new( int rc = connect(ctx->control_socket_.get(), reinterpret_cast(&addr), addr_len); if (rc != 0) { - PLOG(ERROR) << "failed to connect to jdwp control socket"; + if (errno == ECONNREFUSED) { + // On userdebug devices, every Java process is debuggable, so if adbd is explicitly turned + // off, this would spew enormous amounts of red-herring errors. + LOG(DEBUG) << "failed to connect to jdwp control socket, adbd not running?"; + } else { + PLOG(ERROR) << "failed to connect to jdwp control socket"; + } return nullptr; }