Add dump for InputState and InputTarget
These are useful when you want to print these variables for debugging.
Currently, InputState isn't even shown in the dispatcher dump. Include
it there.
Also, update some types to use DeviceId.
Bug: 211379801
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: Ifc983a653d9f1f546b71b8404f67caa1c89d3b01
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index fd97309..da7a2a4 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -119,6 +119,10 @@
return systemTime(SYSTEM_TIME_MONOTONIC);
}
+bool isEmpty(const std::stringstream& ss) {
+ return ss.rdbuf()->in_avail() == 0;
+}
+
inline const std::string binderToString(const sp<IBinder>& binder) {
if (binder == nullptr) {
return "<null>";
@@ -5779,6 +5783,12 @@
} else {
dump += INDENT3 "WaitQueue: <empty>\n";
}
+ std::stringstream inputStateDump;
+ inputStateDump << connection->inputState;
+ if (!isEmpty(inputStateDump)) {
+ dump += INDENT3 "InputState: ";
+ dump += inputStateDump.str() + "\n";
+ }
}
} else {
dump += INDENT "Connections: <none>\n";