summaryrefslogtreecommitdiff
path: root/include/input/PrintTools.h
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2022-10-03 21:51:26 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2022-10-27 14:44:45 +0000
commit07525ef5964f8a0a5b4d9949ab5f7fd17f0e2393 (patch)
tree935256047a5a56e2944856612353430f2d8a616f /include/input/PrintTools.h
parentda20b174810825da0a1bf2e84942cb73f38f4dd4 (diff)
Determine the bluetooth address of an input device from its uniqueId
Since the Android Bluetooth stack sets a Bluetooth HID device's unique ID as the Bluetooth address, attempt to parse the address from an input device's uniqueId when connected over the Bluetooth bus. DD: go/inputdevice-battery-notifications Bug: 243005009 Test: manual, check dumpsys output Change-Id: I710868f2b202e6cebf8b6a3853a6a5c79f3bc671
Diffstat (limited to 'include/input/PrintTools.h')
-rw-r--r--include/input/PrintTools.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/input/PrintTools.h b/include/input/PrintTools.h
index 55f730b287..e24344b3f1 100644
--- a/include/input/PrintTools.h
+++ b/include/input/PrintTools.h
@@ -24,16 +24,20 @@
namespace android {
template <typename T>
-std::string constToString(const T& v) {
+inline std::string constToString(const T& v) {
return std::to_string(v);
}
+inline std::string constToString(const std::string& s) {
+ return s;
+}
+
/**
* Convert an optional type to string.
*/
template <typename T>
-std::string toString(const std::optional<T>& optional,
- std::string (*toString)(const T&) = constToString) {
+inline std::string toString(const std::optional<T>& optional,
+ std::string (*toString)(const T&) = constToString) {
return optional ? toString(*optional) : "<not set>";
}