InputMapper refactor: Change readerconfig pointer to const ref
We are refactoring Input-mapper to ensure they are configured at the
time of initialisation.
In this CL we are changing InputReaderConfiguration raw pointer to
a const reference and rename it to readerConfig for clarity.
Test: build, inputflinger_tests, presubmit checks
Bug: 256009910
Change-Id: Iae22c8cfba836bd311a51fca13d680456a61e604
diff --git a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
index fc00c48..f8dd3a8 100644
--- a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
@@ -118,21 +118,21 @@
}
std::optional<DisplayViewport> KeyboardInputMapper::findViewport(
- const InputReaderConfiguration* config) {
+ const InputReaderConfiguration& readerConfig) {
if (getDeviceContext().getAssociatedViewport()) {
return getDeviceContext().getAssociatedViewport();
}
// No associated display defined, try to find default display if orientationAware.
if (mParameters.orientationAware) {
- return config->getDisplayViewportByType(ViewportType::INTERNAL);
+ return readerConfig.getDisplayViewportByType(ViewportType::INTERNAL);
}
return std::nullopt;
}
std::list<NotifyArgs> KeyboardInputMapper::reconfigure(nsecs_t when,
- const InputReaderConfiguration* config,
+ const InputReaderConfiguration& config,
uint32_t changes) {
std::list<NotifyArgs> out = InputMapper::reconfigure(when, config, changes);
@@ -147,7 +147,7 @@
if (!changes || (changes & InputReaderConfiguration::CHANGE_KEYBOARD_LAYOUT_ASSOCIATION)) {
mKeyboardLayoutInfo =
- getValueByKey(config->keyboardLayoutAssociations, getDeviceContext().getLocation());
+ getValueByKey(config.keyboardLayoutAssociations, getDeviceContext().getLocation());
}
return out;