InputListener: Pass NotifyArgs by reference
Bug: 245989146
Test: Presubmit
Change-Id: I15af8a6737625a062f31acc1ab6974d52eb91d66
Merged-In: I15af8a6737625a062f31acc1ab6974d52eb91d66
diff --git a/services/inputflinger/UnwantedInteractionBlocker.cpp b/services/inputflinger/UnwantedInteractionBlocker.cpp
index 6d43e8d..02bc47d 100644
--- a/services/inputflinger/UnwantedInteractionBlocker.cpp
+++ b/services/inputflinger/UnwantedInteractionBlocker.cpp
@@ -329,24 +329,24 @@
: mQueuedListener(listener), mEnablePalmRejection(enablePalmRejection) {}
void UnwantedInteractionBlocker::notifyConfigurationChanged(
- const NotifyConfigurationChangedArgs* args) {
+ const NotifyConfigurationChangedArgs& args) {
mQueuedListener.notifyConfigurationChanged(args);
mQueuedListener.flush();
}
-void UnwantedInteractionBlocker::notifyKey(const NotifyKeyArgs* args) {
+void UnwantedInteractionBlocker::notifyKey(const NotifyKeyArgs& args) {
mQueuedListener.notifyKey(args);
mQueuedListener.flush();
}
-void UnwantedInteractionBlocker::notifyMotion(const NotifyMotionArgs* args) {
- ALOGD_IF(DEBUG_INBOUND_MOTION, "%s: %s", __func__, args->dump().c_str());
+void UnwantedInteractionBlocker::notifyMotion(const NotifyMotionArgs& args) {
+ ALOGD_IF(DEBUG_INBOUND_MOTION, "%s: %s", __func__, args.dump().c_str());
{ // acquire lock
std::scoped_lock lock(mLock);
const std::vector<NotifyMotionArgs> processedArgs =
- mPreferStylusOverTouchBlocker.processMotion(*args);
+ mPreferStylusOverTouchBlocker.processMotion(args);
for (const NotifyMotionArgs& loopArgs : processedArgs) {
- notifyMotionLocked(&loopArgs);
+ notifyMotionLocked(loopArgs);
}
} // release lock
@@ -356,56 +356,56 @@
void UnwantedInteractionBlocker::enqueueOutboundMotionLocked(const NotifyMotionArgs& args) {
ALOGD_IF(DEBUG_OUTBOUND_MOTION, "%s: %s", __func__, args.dump().c_str());
- mQueuedListener.notifyMotion(&args);
+ mQueuedListener.notifyMotion(args);
}
-void UnwantedInteractionBlocker::notifyMotionLocked(const NotifyMotionArgs* args) {
- auto it = mPalmRejectors.find(args->deviceId);
- const bool sendToPalmRejector = it != mPalmRejectors.end() && isFromTouchscreen(args->source);
+void UnwantedInteractionBlocker::notifyMotionLocked(const NotifyMotionArgs& args) {
+ auto it = mPalmRejectors.find(args.deviceId);
+ const bool sendToPalmRejector = it != mPalmRejectors.end() && isFromTouchscreen(args.source);
if (!sendToPalmRejector) {
- enqueueOutboundMotionLocked(*args);
+ enqueueOutboundMotionLocked(args);
return;
}
- std::vector<NotifyMotionArgs> processedArgs = it->second.processMotion(*args);
+ std::vector<NotifyMotionArgs> processedArgs = it->second.processMotion(args);
for (const NotifyMotionArgs& loopArgs : processedArgs) {
enqueueOutboundMotionLocked(loopArgs);
}
}
-void UnwantedInteractionBlocker::notifySwitch(const NotifySwitchArgs* args) {
+void UnwantedInteractionBlocker::notifySwitch(const NotifySwitchArgs& args) {
mQueuedListener.notifySwitch(args);
mQueuedListener.flush();
}
-void UnwantedInteractionBlocker::notifySensor(const NotifySensorArgs* args) {
+void UnwantedInteractionBlocker::notifySensor(const NotifySensorArgs& args) {
mQueuedListener.notifySensor(args);
mQueuedListener.flush();
}
-void UnwantedInteractionBlocker::notifyVibratorState(const NotifyVibratorStateArgs* args) {
+void UnwantedInteractionBlocker::notifyVibratorState(const NotifyVibratorStateArgs& args) {
mQueuedListener.notifyVibratorState(args);
mQueuedListener.flush();
}
-void UnwantedInteractionBlocker::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
+void UnwantedInteractionBlocker::notifyDeviceReset(const NotifyDeviceResetArgs& args) {
{ // acquire lock
std::scoped_lock lock(mLock);
- auto it = mPalmRejectors.find(args->deviceId);
+ auto it = mPalmRejectors.find(args.deviceId);
if (it != mPalmRejectors.end()) {
AndroidPalmFilterDeviceInfo info = it->second.getPalmFilterDeviceInfo();
// Re-create the object instead of resetting it
mPalmRejectors.erase(it);
- mPalmRejectors.emplace(args->deviceId, info);
+ mPalmRejectors.emplace(args.deviceId, info);
}
mQueuedListener.notifyDeviceReset(args);
- mPreferStylusOverTouchBlocker.notifyDeviceReset(*args);
+ mPreferStylusOverTouchBlocker.notifyDeviceReset(args);
} // release lock
// Send events to the next stage without holding the lock
mQueuedListener.flush();
}
void UnwantedInteractionBlocker::notifyPointerCaptureChanged(
- const NotifyPointerCaptureChangedArgs* args) {
+ const NotifyPointerCaptureChangedArgs& args) {
mQueuedListener.notifyPointerCaptureChanged(args);
mQueuedListener.flush();
}