summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2025-01-24 15:24:27 -0800
committer Siarhei Vishniakou <svv@google.com> 2025-01-29 13:38:28 -0800
commite7ffef74e0b965e4d0240bc9b3809cdc10785361 (patch)
treea4b53a0baffc2fe792431e7d67f885086600c32c /include
parent07978260d95c59b6fab022650ddd7162ff35a84b (diff)
Move external MultiTouch test into InputMapperUnitTest
This test is broken because it relies on an incorrect ACTION_CANCEL event being generated. Move this test over to the new InputMapperUnitTest infra before fixing it in subsequent CLs. Bug: 378308551 Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Flag: TEST_ONLY Change-Id: I016fb66f7fcbe957cd5b6e8ca86513cb8c372cd3
Diffstat (limited to 'include')
-rw-r--r--include/input/PrintTools.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/input/PrintTools.h b/include/input/PrintTools.h
index 3470be4dce..71c215f723 100644
--- a/include/input/PrintTools.h
+++ b/include/input/PrintTools.h
@@ -19,13 +19,18 @@
#include <bitset>
#include <map>
#include <optional>
-#include <set>
+#include <ranges>
#include <sstream>
#include <string>
#include <vector>
namespace android {
+namespace internal {
+template <typename T>
+concept Container = std::ranges::range<T>;
+}
+
template <size_t N>
std::string bitsetToString(const std::bitset<N>& bitset) {
if (bitset.none()) {
@@ -72,10 +77,12 @@ inline std::string toString(const std::optional<T>& optional,
/**
* Convert a set of integral types to string.
*/
-template <typename T>
-std::string dumpSet(const std::set<T>& v, std::string (*toString)(const T&) = constToString) {
+template <internal::Container T>
+std::string dumpContainer(
+ const T& container,
+ std::string (*toString)(const std::ranges::range_value_t<T>&) = constToString) {
std::string out;
- for (const T& entry : v) {
+ for (const auto& entry : container) {
out += out.empty() ? "{" : ", ";
out += toString(entry);
}