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/libs/input/Input.cpp b/libs/input/Input.cpp
index fc73de3..51910fe 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -135,11 +135,11 @@
// --- KeyEvent ---
const char* KeyEvent::getLabel(int32_t keyCode) {
- return getLabelByKeyCode(keyCode);
+ return InputEventLookup::getLabelByKeyCode(keyCode);
}
int32_t KeyEvent::getKeyCodeFromLabel(const char* label) {
- return getKeyCodeByLabel(label);
+ return InputEventLookup::getKeyCodeByLabel(label);
}
void KeyEvent::initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,
@@ -692,11 +692,11 @@
}
const char* MotionEvent::getLabel(int32_t axis) {
- return getAxisLabel(axis);
+ return InputEventLookup::getAxisLabel(axis);
}
int32_t MotionEvent::getAxisFromLabel(const char* label) {
- return getAxisByLabel(label);
+ return InputEventLookup::getAxisByLabel(label);
}
const char* MotionEvent::actionToString(int32_t action) {