summaryrefslogtreecommitdiff
path: root/include/input/PrintTools.h
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2022-09-08 22:03:30 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2022-09-09 20:19:39 +0000
commitc13ff081db31e93ee3b0a96bb007704c61d10a02 (patch)
treec9b0d3ea2930da7e0c4935a32fd54b5977a6ab30 /include/input/PrintTools.h
parent5404600a170f7d095ee51a7469aaab900e9491b7 (diff)
Resolve associated display and pointer display in CursorInputMapper
An InputDevice can be associated with a display, in which case it should only generate events for that display. A mouse generally generates events for whichever display is currently showing the mouse cursor. In the case where a mouse InputDevice is associated with a display, we need to make sure that it only generates events when the mouse cursor is on the associated display. Additionally, any display-dependent configuration, such as orientation, should depend on whichever display the device is configured for. Bug: 236075874 Test: atest inputflinger_tests Change-Id: I1021c121c1eae768585124d312f5187be90da666
Diffstat (limited to 'include/input/PrintTools.h')
-rw-r--r--include/input/PrintTools.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/input/PrintTools.h b/include/input/PrintTools.h
index 0a75278494..55f730b287 100644
--- a/include/input/PrintTools.h
+++ b/include/input/PrintTools.h
@@ -17,6 +17,7 @@
#pragma once
#include <map>
+#include <optional>
#include <set>
#include <string>
@@ -28,6 +29,15 @@ std::string constToString(const T& v) {
}
/**
+ * Convert an optional type to string.
+ */
+template <typename T>
+std::string toString(const std::optional<T>& optional,
+ std::string (*toString)(const T&) = constToString) {
+ return optional ? toString(*optional) : "<not set>";
+}
+
+/**
* Convert a set of integral types to string.
*/
template <typename T>