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/TouchedWindow.h b/services/inputflinger/dispatcher/TouchedWindow.h
index 0a38f9f..3f760c0 100644
--- a/services/inputflinger/dispatcher/TouchedWindow.h
+++ b/services/inputflinger/dispatcher/TouchedWindow.h
@@ -20,6 +20,7 @@
#include <input/Input.h>
#include <utils/BitSet.h>
#include <bitset>
+#include <ostream>
#include <set>
#include "InputTarget.h"
@@ -92,5 +93,7 @@
static std::string deviceStateToString(const TouchedWindow::DeviceState& state);
};
+std::ostream& operator<<(std::ostream& out, const TouchedWindow& window);
+
} // namespace inputdispatcher
} // namespace android