diff options
author | 2023-08-23 17:20:13 +0000 | |
---|---|---|
committer | 2023-09-12 15:45:03 +0000 | |
commit | 8c7cb5935292b2a887619a9f4a2265ac61720aa5 (patch) | |
tree | f57646b6fae93e6e7ee8f2bae594262d3a28aa57 /include/input/PrintTools.h | |
parent | 3821b0df36c612755b711d8d5a7b63377d7cf5d9 (diff) |
TouchpadInputMapper: add timer provider
Adding a timer provider allows the Gestures library to perform some
asynchronous tasks, including ones which improve tap-to-click detection.
Bug: 297192727
Test: set the
persist.device_config.aconfig_flags.input.com.android.input.flags.enable_gestures_library_timer_provider
sysprop to true, restart, then make fast tap-to-click gestures
(where the finger is contacting for fewer than 3 frames) on the
touchpad, and check they're reported immediately
Change-Id: Ib9b8dacc71c88b6fd47bdd747f90ef6a44b37cc4
Diffstat (limited to 'include/input/PrintTools.h')
-rw-r--r-- | include/input/PrintTools.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/include/input/PrintTools.h b/include/input/PrintTools.h index 0e3fbb1982..63c0e40e4e 100644 --- a/include/input/PrintTools.h +++ b/include/input/PrintTools.h @@ -75,11 +75,12 @@ std::string dumpSet(const std::set<T>& v, std::string (*toString)(const T&) = co } /** - * Convert a map to string. Both keys and values of the map should be integral type. + * Convert a map or multimap to string. Both keys and values of the map should be integral type. */ -template <typename K, typename V> -std::string dumpMap(const std::map<K, V>& map, std::string (*keyToString)(const K&) = constToString, - std::string (*valueToString)(const V&) = constToString) { +template <typename T> +std::string dumpMap(const T& map, + std::string (*keyToString)(const typename T::key_type&) = constToString, + std::string (*valueToString)(const typename T::mapped_type&) = constToString) { std::string out; for (const auto& [k, v] : map) { if (!out.empty()) { @@ -104,15 +105,13 @@ std::string dumpMapKeys(const std::map<K, V>& map, return out.empty() ? "{}" : (out + "}"); } -/** - * Convert a vector to a string. The values of the vector should be of a type supported by - * constToString. - */ +/** Convert a vector to a string. */ template <typename T> -std::string dumpVector(std::vector<T> values) { - std::string dump = constToString(values[0]); +std::string dumpVector(const std::vector<T>& values, + std::string (*valueToString)(const T&) = constToString) { + std::string dump = valueToString(values[0]); for (size_t i = 1; i < values.size(); i++) { - dump += ", " + constToString(values[i]); + dump += ", " + valueToString(values[i]); } return dump; } |