Use TWO_FINGER_SWIPE classification for touchpad scroll events
This allows apps to distinguish the fake finger created for touchpad
scrolling from an actual finger.
Bug: 246758376
Test: add classification to InputDispatcher's outbound event logs and
check the new value is used when scrolling
Change-Id: Ia90f9984e75ad6fde2d0e42628ab42eab371b7a5
diff --git a/services/inputflinger/InputProcessor.cpp b/services/inputflinger/InputProcessor.cpp
index 0749441..126cb33 100644
--- a/services/inputflinger/InputProcessor.cpp
+++ b/services/inputflinger/InputProcessor.cpp
@@ -22,6 +22,7 @@
#include <android-base/stringprintf.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
+#include <input/Input.h>
#include <inttypes.h>
#include <log/log.h>
#include <algorithm>
@@ -436,7 +437,13 @@
mQueuedListener.notifyMotion(args);
} else {
NotifyMotionArgs newArgs(*args);
- newArgs.classification = mMotionClassifier->classify(newArgs);
+ const MotionClassification newClassification = mMotionClassifier->classify(newArgs);
+ LOG_ALWAYS_FATAL_IF(args->classification != MotionClassification::NONE &&
+ newClassification != MotionClassification::NONE,
+ "Conflicting classifications %s (new) and %s (old)!",
+ motionClassificationToString(newClassification),
+ motionClassificationToString(args->classification));
+ newArgs.classification = newClassification;
mQueuedListener.notifyMotion(&newArgs);
}
} // release lock