input: fix -Wformat warnings
These occur when an enum value is formatted as an integer without a
cast. In all these cases the debug logs are nicer if we use the actual
name of the enum value, so wrap them all in ftl::enum_string calls.
Bug: 245989146
Test: Check there are no -Wformat warnings in the output of
$ m checkinput
Change-Id: I26333123e9fb445f1640c5e73757ddf4ad2d6e98
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 1869483..3ca6ccc 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -387,9 +387,9 @@
status_t InputChannel::sendMessage(const InputMessage* msg) {
ATRACE_NAME_IF(ATRACE_ENABLED(),
- StringPrintf("sendMessage(inputChannel=%s, seq=0x%" PRIx32 ", type=0x%" PRIx32
- ")",
- name.c_str(), msg->header.seq, msg->header.type));
+ StringPrintf("sendMessage(inputChannel=%s, seq=0x%" PRIx32 ", type=%s)",
+ name.c_str(), msg->header.seq,
+ ftl::enum_string(msg->header.type).c_str()));
const size_t msgLength = msg->size();
InputMessage cleanMsg;
msg->getSanitizedCopy(&cleanMsg);
@@ -458,9 +458,10 @@
ftl::enum_string(msg->header.type).c_str());
if (ATRACE_ENABLED()) {
// Add an additional trace point to include data about the received message.
- std::string message = StringPrintf("receiveMessage(inputChannel=%s, seq=0x%" PRIx32
- ", type=0x%" PRIx32 ")",
- name.c_str(), msg->header.seq, msg->header.type);
+ std::string message =
+ StringPrintf("receiveMessage(inputChannel=%s, seq=0x%" PRIx32 ", type=%s)",
+ name.c_str(), msg->header.seq,
+ ftl::enum_string(msg->header.type).c_str());
ATRACE_NAME(message.c_str());
}
return OK;