InputMapper: use a reference for InputDeviceInfo parameter
This makes the code a bit safer, especially since we never check for
this parameter being null.
Bug: 245989146
Test: atest inputflinger_tests
Test: dump motion ranges from a test app, check they're still there
Change-Id: I2754e57c8b261f86ad69891098c9762b96e9ec55
diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
index 2ff26ed..94cc145 100644
--- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
@@ -37,7 +37,7 @@
return mSource;
}
-void RotaryEncoderInputMapper::populateDeviceInfo(InputDeviceInfo* info) {
+void RotaryEncoderInputMapper::populateDeviceInfo(InputDeviceInfo& info) {
InputMapper::populateDeviceInfo(info);
if (mRotaryEncoderScrollAccumulator.haveRelativeVWheel()) {
@@ -52,8 +52,8 @@
"default to 1.0!\n");
}
mScalingFactor = scalingFactor.value_or(1.0f);
- info->addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f,
- res.value_or(0.0f) * mScalingFactor);
+ info.addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f,
+ res.value_or(0.0f) * mScalingFactor);
}
}