Optimize memory usage of InputEvent lookup.
Move the declaration of look up map to cpp file from header file to
avoid duplicate copies.
Bug: 165527068
Bug: 165398580
Bug: 165035349
Test: atest libinput_tests, atest inputflinger_tests
adb shell showmap <system_server pid> | grep input
Check libinput.so and libinput_reader.so size to be 300 and 372KB.
Change-Id: Ia80200b7889f16ce576637d746e64641f3f2a094
diff --git a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
index 57acba5..abd8aa9 100644
--- a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
@@ -73,14 +73,14 @@
dump += INDENT3 "Axes:\n";
for (const auto& [rawAxis, axis] : mAxes) {
- const char* label = getAxisLabel(axis.axisInfo.axis);
+ const char* label = InputEventLookup::getAxisLabel(axis.axisInfo.axis);
if (label) {
dump += StringPrintf(INDENT4 "%s", label);
} else {
dump += StringPrintf(INDENT4 "%d", axis.axisInfo.axis);
}
if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) {
- label = getAxisLabel(axis.axisInfo.highAxis);
+ label = InputEventLookup::getAxisLabel(axis.axisInfo.highAxis);
if (label) {
dump += StringPrintf(" / %s (split at %d)", label, axis.axisInfo.splitValue);
} else {