diff options
author | 2024-07-01 16:38:17 -0700 | |
---|---|---|
committer | 2024-07-06 20:38:21 +0000 | |
commit | 4125ea4e8677dbc13e8adbbbba742cc3fbed54a6 (patch) | |
tree | afb9be3aa338cca7509b88b0334994fdba9ef0b3 | |
parent | 7e24bed9892ec977d4808b7736ea99b65bf418c7 (diff) |
Remove some logging information from InputDispatcher
Currently, we are often printing information like "edgeFlags" and
"xPrecision"/"yPrecision". Over the years, I've never found that
information useful, and it clutters the logs.
Separately, we are labeling input channels like "(server) and
"(client)", which is also never useful. After the input channels were
refactored several years ago, it's pretty hard to mix those up:
dispatcher always has a unique_ptr of the InputChannel, so there's
little risk of it leaking elsewhere.
In this CL, those pieces of logs are removed to make it easier to read
the various dumps and logs.
Bug: 347700797
Flag: EXEMPT refactor
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_break_on_failure --gtest_filter="*SpyThatPreventsSplittingWithApplication*"
Change-Id: I7414a6c35a7a1bc1c779d51cd7243b30356f803e
-rw-r--r-- | libs/input/InputTransport.cpp | 6 | ||||
-rw-r--r-- | libs/input/tests/InputChannel_test.cpp | 6 | ||||
-rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 21 | ||||
-rw-r--r-- | services/inputflinger/dispatcher/InputState.cpp | 4 |
4 files changed, 12 insertions, 25 deletions
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp index bac681df85..4d21d8c987 100644 --- a/libs/input/InputTransport.cpp +++ b/libs/input/InputTransport.cpp @@ -375,13 +375,11 @@ status_t InputChannel::openInputChannelPair(const std::string& name, sp<IBinder> token = sp<BBinder>::make(); - std::string serverChannelName = name + " (server)"; android::base::unique_fd serverFd(sockets[0]); - outServerChannel = InputChannel::create(serverChannelName, std::move(serverFd), token); + outServerChannel = InputChannel::create(name, std::move(serverFd), token); - std::string clientChannelName = name + " (client)"; android::base::unique_fd clientFd(sockets[1]); - outClientChannel = InputChannel::create(clientChannelName, std::move(clientFd), token); + outClientChannel = InputChannel::create(name, std::move(clientFd), token); return OK; } diff --git a/libs/input/tests/InputChannel_test.cpp b/libs/input/tests/InputChannel_test.cpp index 435bdcde2d..25356cfcf0 100644 --- a/libs/input/tests/InputChannel_test.cpp +++ b/libs/input/tests/InputChannel_test.cpp @@ -65,11 +65,7 @@ TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) { ASSERT_EQ(OK, result) << "should have successfully opened a channel pair"; - // Name - EXPECT_STREQ("channel name (server)", serverChannel->getName().c_str()) - << "server channel should have suffixed name"; - EXPECT_STREQ("channel name (client)", clientChannel->getName().c_str()) - << "client channel should have suffixed name"; + EXPECT_EQ(serverChannel->getName(), clientChannel->getName()); // Server->Client communication InputMessage serverMsg = {}; diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index a2e50d7d87..a0c9b6de89 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -2114,19 +2114,16 @@ void InputDispatcher::logOutboundMotionDetails(const char* prefix, const MotionE if (DEBUG_OUTBOUND_EVENT_DETAILS) { ALOGD("%seventTime=%" PRId64 ", deviceId=%d, source=%s, displayId=%s, policyFlags=0x%x, " "action=%s, actionButton=0x%x, flags=0x%x, " - "metaState=0x%x, buttonState=0x%x," - "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%" PRId64, + "metaState=0x%x, buttonState=0x%x, downTime=%" PRId64, prefix, entry.eventTime, entry.deviceId, inputEventSourceToString(entry.source).c_str(), entry.displayId.toString().c_str(), entry.policyFlags, MotionEvent::actionToString(entry.action).c_str(), - entry.actionButton, entry.flags, entry.metaState, entry.buttonState, entry.edgeFlags, - entry.xPrecision, entry.yPrecision, entry.downTime); + entry.actionButton, entry.flags, entry.metaState, entry.buttonState, entry.downTime); for (uint32_t i = 0; i < entry.getPointerCount(); i++) { ALOGD(" Pointer %d: id=%d, toolType=%s, " "x=%f, y=%f, pressure=%f, size=%f, " - "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, " - "orientation=%f", + "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, orientation=%f", i, entry.pointerProperties[i].id, ftl::enum_string(entry.pointerProperties[i].toolType).c_str(), entry.pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), @@ -4548,13 +4545,12 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { ALOGD("notifyMotion - id=%" PRIx32 " eventTime=%" PRId64 ", deviceId=%d, source=%s, " "displayId=%s, policyFlags=0x%x, " "action=%s, actionButton=0x%x, flags=0x%x, metaState=0x%x, buttonState=0x%x, " - "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, xCursorPosition=%f, " - "yCursorPosition=%f, downTime=%" PRId64, + "xCursorPosition=%f, yCursorPosition=%f, downTime=%" PRId64, args.id, args.eventTime, args.deviceId, inputEventSourceToString(args.source).c_str(), args.displayId.toString().c_str(), args.policyFlags, MotionEvent::actionToString(args.action).c_str(), args.actionButton, args.flags, - args.metaState, args.buttonState, args.edgeFlags, args.xPrecision, args.yPrecision, - args.xCursorPosition, args.yCursorPosition, args.downTime); + args.metaState, args.buttonState, args.xCursorPosition, args.yCursorPosition, + args.downTime); for (uint32_t i = 0; i < args.getPointerCount(); i++) { ALOGD(" Pointer %d: id=%d, toolType=%s, x=%f, y=%f, pressure=%f, size=%f, " "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, orientation=%f", @@ -6024,17 +6020,12 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) const { dump += StringPrintf(INDENT3 "OutboundQueue: length=%zu\n", connection->outboundQueue.size()); dump += dumpQueue(connection->outboundQueue, currentTime); - - } else { - dump += INDENT3 "OutboundQueue: <empty>\n"; } if (!connection->waitQueue.empty()) { dump += StringPrintf(INDENT3 "WaitQueue: length=%zu\n", connection->waitQueue.size()); dump += dumpQueue(connection->waitQueue, currentTime); - } else { - dump += INDENT3 "WaitQueue: <empty>\n"; } std::string inputStateDump = streamableToString(connection->inputState); if (!inputStateDump.empty()) { diff --git a/services/inputflinger/dispatcher/InputState.cpp b/services/inputflinger/dispatcher/InputState.cpp index dfbe02f332..4df23c54d6 100644 --- a/services/inputflinger/dispatcher/InputState.cpp +++ b/services/inputflinger/dispatcher/InputState.cpp @@ -647,7 +647,9 @@ std::ostream& operator<<(std::ostream& out, const InputState& state) { if (!state.mMotionMementos.empty()) { out << "mMotionMementos: "; for (const InputState::MotionMemento& memento : state.mMotionMementos) { - out << "{deviceId= " << memento.deviceId << ", hovering=" << memento.hovering << "}, "; + out << "{deviceId=" << memento.deviceId + << ", hovering=" << std::to_string(memento.hovering) + << ", downTime=" << memento.downTime << "}, "; } } return out; |