Minor logging improvements in InputDispatcher and InputTransport
Small changes to improve human-readability of logging.
Bug: 193231132
Test: Manual, check logs
Change-Id: I17fa464798b537915d25b82c7b24d3d228448139
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index bdbd708..311b244 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -555,10 +555,10 @@
ATRACE_NAME(message.c_str());
}
ALOGD_IF(debugTransportPublisher(),
- "channel '%s' publisher ~ %s: seq=%u, deviceId=%d, source=%s, "
+ "channel '%s' publisher ~ %s: seq=%u, id=%d, deviceId=%d, source=%s, "
"action=%s, flags=0x%x, keyCode=%s, scanCode=%d, metaState=0x%x, repeatCount=%d,"
"downTime=%" PRId64 ", eventTime=%" PRId64,
- mChannel->getName().c_str(), __func__, seq, deviceId,
+ mChannel->getName().c_str(), __func__, seq, eventId, deviceId,
inputEventSourceToString(source).c_str(), KeyEvent::actionToString(action), flags,
KeyEvent::getLabel(keyCode), scanCode, metaState, repeatCount, downTime, eventTime);
@@ -608,13 +608,13 @@
if (debugTransportPublisher()) {
std::string transformString;
transform.dump(transformString, "transform", " ");
- ALOGD("channel '%s' publisher ~ %s: seq=%u, deviceId=%d, source=%s, "
+ ALOGD("channel '%s' publisher ~ %s: seq=%u, id=%d, deviceId=%d, source=%s, "
"displayId=%" PRId32 ", "
"action=%s, actionButton=0x%08x, flags=0x%x, edgeFlags=0x%x, "
"metaState=0x%x, buttonState=0x%x, classification=%s,"
"xPrecision=%f, yPrecision=%f, downTime=%" PRId64 ", eventTime=%" PRId64 ", "
"pointerCount=%" PRIu32 " \n%s",
- mChannel->getName().c_str(), __func__, seq, deviceId,
+ mChannel->getName().c_str(), __func__, seq, eventId, deviceId,
inputEventSourceToString(source).c_str(), displayId,
MotionEvent::actionToString(action).c_str(), actionButton, flags, edgeFlags,
metaState, buttonState, motionClassificationToString(classification), xPrecision,
@@ -680,8 +680,8 @@
mChannel->getName().c_str(), toString(hasFocus));
ATRACE_NAME(message.c_str());
}
- ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, hasFocus=%s",
- mChannel->getName().c_str(), __func__, seq, toString(hasFocus));
+ ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, id=%d, hasFocus=%s",
+ mChannel->getName().c_str(), __func__, seq, eventId, toString(hasFocus));
InputMessage msg;
msg.header.type = InputMessage::Type::FOCUS;
@@ -700,8 +700,8 @@
ATRACE_NAME(message.c_str());
}
ALOGD_IF(debugTransportPublisher(),
- "channel '%s' publisher ~ %s: seq=%u, pointerCaptureEnabled=%s",
- mChannel->getName().c_str(), __func__, seq, toString(pointerCaptureEnabled));
+ "channel '%s' publisher ~ %s: seq=%u, id=%d, pointerCaptureEnabled=%s",
+ mChannel->getName().c_str(), __func__, seq, eventId, toString(pointerCaptureEnabled));
InputMessage msg;
msg.header.type = InputMessage::Type::CAPTURE;
@@ -720,8 +720,8 @@
ATRACE_NAME(message.c_str());
}
ALOGD_IF(debugTransportPublisher(),
- "channel '%s' publisher ~ %s: seq=%u, x=%f, y=%f, isExiting=%s",
- mChannel->getName().c_str(), __func__, seq, x, y, toString(isExiting));
+ "channel '%s' publisher ~ %s: seq=%u, id=%d, x=%f, y=%f, isExiting=%s",
+ mChannel->getName().c_str(), __func__, seq, eventId, x, y, toString(isExiting));
InputMessage msg;
msg.header.type = InputMessage::Type::DRAG;
@@ -740,8 +740,9 @@
mChannel->getName().c_str(), toString(isInTouchMode));
ATRACE_NAME(message.c_str());
}
- ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, isInTouchMode=%s",
- mChannel->getName().c_str(), __func__, seq, toString(isInTouchMode));
+ ALOGD_IF(debugTransportPublisher(),
+ "channel '%s' publisher ~ %s: seq=%u, id=%d, isInTouchMode=%s",
+ mChannel->getName().c_str(), __func__, seq, eventId, toString(isInTouchMode));
InputMessage msg;
msg.header.type = InputMessage::Type::TOUCH_MODE;
@@ -752,15 +753,18 @@
}
android::base::Result<InputPublisher::ConsumerResponse> InputPublisher::receiveConsumerResponse() {
- ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s", mChannel->getName().c_str(),
- __func__);
-
InputMessage msg;
status_t result = mChannel->receiveMessage(&msg);
if (result) {
+ ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: %s",
+ mChannel->getName().c_str(), __func__, strerror(result));
return android::base::Error(result);
}
if (msg.header.type == InputMessage::Type::FINISHED) {
+ ALOGD_IF(debugTransportPublisher(),
+ "channel '%s' publisher ~ %s: finished: seq=%u, handled=%s",
+ mChannel->getName().c_str(), __func__, msg.header.seq,
+ toString(msg.body.finished.handled));
return Finished{
.seq = msg.header.seq,
.handled = msg.body.finished.handled,
@@ -769,6 +773,8 @@
}
if (msg.header.type == InputMessage::Type::TIMELINE) {
+ ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: timeline: id=%d",
+ mChannel->getName().c_str(), __func__, msg.body.timeline.eventId);
return Timeline{
.inputEventId = msg.body.timeline.eventId,
.graphicsTimeline = msg.body.timeline.graphicsTimeline,
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index ab6a116..43cac05 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -4072,14 +4072,15 @@
}
void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
- if (debugInboundEventDetails()) {
- ALOGD("notifyKey - eventTime=%" PRId64 ", deviceId=%d, source=0x%x, displayId=%" PRId32
- "policyFlags=0x%x, action=0x%x, "
- "flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%" PRId64,
- args->eventTime, args->deviceId, args->source, args->displayId, args->policyFlags,
- args->action, args->flags, args->keyCode, args->scanCode, args->metaState,
- args->downTime);
- }
+ ALOGD_IF(debugInboundEventDetails(),
+ "notifyKey - id=%" PRIx32 ", eventTime=%" PRId64
+ ", deviceId=%d, source=%s, displayId=%" PRId32
+ "policyFlags=0x%x, action=%s, flags=0x%x, keyCode=%s, scanCode=0x%x, metaState=0x%x, "
+ "downTime=%" PRId64,
+ args->id, args->eventTime, args->deviceId,
+ inputEventSourceToString(args->source).c_str(), args->displayId, args->policyFlags,
+ KeyEvent::actionToString(args->action), args->flags, KeyEvent::getLabel(args->keyCode),
+ args->scanCode, args->metaState, args->downTime);
if (!validateKeyEvent(args->action)) {
return;
}
@@ -4151,22 +4152,21 @@
void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) {
if (debugInboundEventDetails()) {
- ALOGD("notifyMotion - id=%" PRIx32 " eventTime=%" PRId64 ", deviceId=%d, source=0x%x, "
+ ALOGD("notifyMotion - id=%" PRIx32 " eventTime=%" PRId64 ", deviceId=%d, source=%s, "
"displayId=%" PRId32 ", 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,
- args->id, args->eventTime, args->deviceId, args->source, args->displayId,
- 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->id, args->eventTime, args->deviceId,
+ inputEventSourceToString(args->source).c_str(), args->displayId, 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);
for (uint32_t i = 0; i < args->pointerCount; i++) {
- ALOGD(" Pointer %d: id=%d, toolType=%d, "
- "x=%f, y=%f, pressure=%f, size=%f, "
- "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, "
- "orientation=%f",
- i, args->pointerProperties[i].id, args->pointerProperties[i].toolType,
+ 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",
+ i, args->pointerProperties[i].id,
+ motionToolTypeToString(args->pointerProperties[i].toolType),
args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X),
args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y),
args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE),