From ae4ff289d1ac2ac4f5a5b5bac9c4eb3b837a464b Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 23 Aug 2022 16:21:39 +0000 Subject: Improve EventHub const-correctness Ensure that all methods that "get" state from event hub are const-correct. While some "set" methods can also be const in event hub because they write to the system (side effect) instead of changing state, we leave these as non-const to make it easier for testing. Bug: None Test: atest inputflinger_tests Change-Id: I086b50458203a2395b1960e2bc1102610a3c0801 --- libs/input/KeyLayoutMap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/input/KeyLayoutMap.cpp') diff --git a/libs/input/KeyLayoutMap.cpp b/libs/input/KeyLayoutMap.cpp index 59cc7d1dcd..31aed517dd 100644 --- a/libs/input/KeyLayoutMap.cpp +++ b/libs/input/KeyLayoutMap.cpp @@ -185,7 +185,8 @@ status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t usageCode, } // Return pair of sensor type and sensor data index, for the input device abs code -base::Result> KeyLayoutMap::mapSensor(int32_t absCode) { +base::Result> KeyLayoutMap::mapSensor( + int32_t absCode) const { auto it = mSensorsByAbsCode.find(absCode); if (it == mSensorsByAbsCode.end()) { ALOGD_IF(DEBUG_MAPPING, "mapSensor: absCode=%d, ~ Failed.", absCode); -- cgit v1.2.3-59-g8ed1b