InputListener: Pass NotifyArgs by reference
Bug: 245989146
Test: Presubmit
Change-Id: I15af8a6737625a062f31acc1ab6974d52eb91d66
Merged-In: I15af8a6737625a062f31acc1ab6974d52eb91d66
diff --git a/services/inputflinger/InputProcessor.cpp b/services/inputflinger/InputProcessor.cpp
index 6c0bcff..7a84be9 100644
--- a/services/inputflinger/InputProcessor.cpp
+++ b/services/inputflinger/InputProcessor.cpp
@@ -419,63 +419,63 @@
mQueuedListener.flush();
}
-void InputProcessor::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) {
+void InputProcessor::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) {
// pass through
mQueuedListener.notifyConfigurationChanged(args);
mQueuedListener.flush();
}
-void InputProcessor::notifyKey(const NotifyKeyArgs* args) {
+void InputProcessor::notifyKey(const NotifyKeyArgs& args) {
// pass through
mQueuedListener.notifyKey(args);
mQueuedListener.flush();
}
-void InputProcessor::notifyMotion(const NotifyMotionArgs* args) {
+void InputProcessor::notifyMotion(const NotifyMotionArgs& args) {
{ // acquire lock
std::scoped_lock lock(mLock);
// MotionClassifier is only used for touch events, for now
- const bool sendToMotionClassifier = mMotionClassifier && isTouchEvent(*args);
+ const bool sendToMotionClassifier = mMotionClassifier && isTouchEvent(args);
if (!sendToMotionClassifier) {
mQueuedListener.notifyMotion(args);
} else {
- NotifyMotionArgs newArgs(*args);
+ NotifyMotionArgs newArgs(args);
const MotionClassification newClassification = mMotionClassifier->classify(newArgs);
- LOG_ALWAYS_FATAL_IF(args->classification != MotionClassification::NONE &&
+ LOG_ALWAYS_FATAL_IF(args.classification != MotionClassification::NONE &&
newClassification != MotionClassification::NONE,
"Conflicting classifications %s (new) and %s (old)!",
motionClassificationToString(newClassification),
- motionClassificationToString(args->classification));
+ motionClassificationToString(args.classification));
newArgs.classification = newClassification;
- mQueuedListener.notifyMotion(&newArgs);
+ mQueuedListener.notifyMotion(newArgs);
}
} // release lock
mQueuedListener.flush();
}
-void InputProcessor::notifySensor(const NotifySensorArgs* args) {
+void InputProcessor::notifySensor(const NotifySensorArgs& args) {
// pass through
mQueuedListener.notifySensor(args);
mQueuedListener.flush();
}
-void InputProcessor::notifyVibratorState(const NotifyVibratorStateArgs* args) {
+void InputProcessor::notifyVibratorState(const NotifyVibratorStateArgs& args) {
// pass through
mQueuedListener.notifyVibratorState(args);
mQueuedListener.flush();
}
-void InputProcessor::notifySwitch(const NotifySwitchArgs* args) {
+void InputProcessor::notifySwitch(const NotifySwitchArgs& args) {
// pass through
mQueuedListener.notifySwitch(args);
mQueuedListener.flush();
}
-void InputProcessor::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
+void InputProcessor::notifyDeviceReset(const NotifyDeviceResetArgs& args) {
{ // acquire lock
std::scoped_lock lock(mLock);
if (mMotionClassifier) {
- mMotionClassifier->reset(*args);
+ mMotionClassifier->reset(args);
}
} // release lock
@@ -484,7 +484,7 @@
mQueuedListener.flush();
}
-void InputProcessor::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) {
+void InputProcessor::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs& args) {
// pass through
mQueuedListener.notifyPointerCaptureChanged(args);
mQueuedListener.flush();