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/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp
index 0246d60..c8bc87f 100644
--- a/services/inputflinger/dispatcher/Entry.cpp
+++ b/services/inputflinger/dispatcher/Entry.cpp
@@ -23,6 +23,7 @@
#include <android-base/stringprintf.h>
#include <cutils/atomic.h>
+#include <ftl/enum.h>
#include <inttypes.h>
using android::base::StringPrintf;
@@ -261,9 +262,10 @@
std::string SensorEntry::getDescription() const {
std::string msg;
msg += StringPrintf("SensorEntry(deviceId=%d, source=%s, sensorType=%s, "
- "accuracy=0x%08x, hwTimestamp=%" PRId64,
+ "accuracy=%s, hwTimestamp=%" PRId64,
deviceId, inputEventSourceToString(source).c_str(),
- ftl::enum_string(sensorType).c_str(), accuracy, hwTimestamp);
+ ftl::enum_string(sensorType).c_str(), ftl::enum_string(accuracy).c_str(),
+ hwTimestamp);
if (IS_DEBUGGABLE_BUILD) {
for (size_t i = 0; i < values.size(); i++) {