Add operator<< for printing some dispatcher structs
When working on dispatcher code, it's very convenient to be able to
quickly print some of the dispatcher structs, like TouchState,
TouchedWindow, etc. Add operator<< to some of these structs in this CL.
This removes the need to memorize the specific function that needs to be
called, like "dump", "getDescription", etc.
Bug: 211379801
Test: none
Change-Id: I663b217a3449daa34476ac6f28f188cdf0618278
diff --git a/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp
index cb369a8..fa8f548 100644
--- a/services/inputflinger/dispatcher/Entry.cpp
+++ b/services/inputflinger/dispatcher/Entry.cpp
@@ -269,6 +269,11 @@
return msg;
}
+std::ostream& operator<<(std::ostream& out, const MotionEntry& motionEntry) {
+ out << motionEntry.getDescription();
+ return out;
+}
+
// --- SensorEntry ---
SensorEntry::SensorEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,