InputMapper: pass RawEvent references instead of pointers
We never pass null values here, so changing to references makes this
clearer.
Change-Id: I82d5359e244a93560bcbef477c89fef016168abb
Test: atest inputflinger_test
Test: m checkinput
Test: manually test basic functionality on a multi-touch screen, touchpad, mouse, and drawing tablet
Bug: 245989146
Flag: EXEMPT refactor
diff --git a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
index 5ce4d30..41e018d 100644
--- a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
@@ -259,29 +259,29 @@
return InputMapper::reset(when);
}
-std::list<NotifyArgs> JoystickInputMapper::process(const RawEvent* rawEvent) {
+std::list<NotifyArgs> JoystickInputMapper::process(const RawEvent& rawEvent) {
std::list<NotifyArgs> out;
- switch (rawEvent->type) {
+ switch (rawEvent.type) {
case EV_ABS: {
- auto it = mAxes.find(rawEvent->code);
+ auto it = mAxes.find(rawEvent.code);
if (it != mAxes.end()) {
Axis& axis = it->second;
float newValue, highNewValue;
switch (axis.axisInfo.mode) {
case AxisInfo::MODE_INVERT:
- newValue = (axis.rawAxisInfo.maxValue - rawEvent->value) * axis.scale +
+ newValue = (axis.rawAxisInfo.maxValue - rawEvent.value) * axis.scale +
axis.offset;
highNewValue = 0.0f;
break;
case AxisInfo::MODE_SPLIT:
- if (rawEvent->value < axis.axisInfo.splitValue) {
- newValue = (axis.axisInfo.splitValue - rawEvent->value) * axis.scale +
+ if (rawEvent.value < axis.axisInfo.splitValue) {
+ newValue = (axis.axisInfo.splitValue - rawEvent.value) * axis.scale +
axis.offset;
highNewValue = 0.0f;
- } else if (rawEvent->value > axis.axisInfo.splitValue) {
+ } else if (rawEvent.value > axis.axisInfo.splitValue) {
newValue = 0.0f;
highNewValue =
- (rawEvent->value - axis.axisInfo.splitValue) * axis.highScale +
+ (rawEvent.value - axis.axisInfo.splitValue) * axis.highScale +
axis.highOffset;
} else {
newValue = 0.0f;
@@ -289,7 +289,7 @@
}
break;
default:
- newValue = rawEvent->value * axis.scale + axis.offset;
+ newValue = rawEvent.value * axis.scale + axis.offset;
highNewValue = 0.0f;
break;
}
@@ -300,9 +300,9 @@
}
case EV_SYN:
- switch (rawEvent->code) {
+ switch (rawEvent.code) {
case SYN_REPORT:
- out += sync(rawEvent->when, rawEvent->readTime, /*force=*/false);
+ out += sync(rawEvent.when, rawEvent.readTime, /*force=*/false);
break;
}
break;