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/reader/mapper/InputMapper.cpp b/services/inputflinger/reader/mapper/InputMapper.cpp
index 0692dbb..b6c5c98 100644
--- a/services/inputflinger/reader/mapper/InputMapper.cpp
+++ b/services/inputflinger/reader/mapper/InputMapper.cpp
@@ -20,6 +20,8 @@
#include <sstream>
+#include <ftl/enum.h>
+
#include "InputDevice.h"
#include "input/PrintTools.h"
@@ -133,7 +135,7 @@
dump += StringPrintf(INDENT4 "When: %" PRId64 "\n", state.when);
dump += StringPrintf(INDENT4 "Pressure: %s\n", toString(state.pressure).c_str());
dump += StringPrintf(INDENT4 "Button State: 0x%08x\n", state.buttons);
- dump += StringPrintf(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType);
+ dump += StringPrintf(INDENT4 "Tool Type: %s\n", ftl::enum_string(state.toolType).c_str());
}
} // namespace android