Add ChromeOS palm rejection model
This model will be used to block palm presses. It takes in a stream of
evdev events, and reports back the pointers which should be considered
palm.
Bug: 198472780
Test: atest libpalmrejection_test inputflinger_tests
Test: "adb shell device_config put input_native_boot
palm_rejection_enabled 0" and make sure that "adb shell dumpsys input"
shows that there aren't any palm rejectors inside
UnwantedInteractionBlocker
Change-Id: If979d335af29cf5e93b26336fea56a3a895cc562
diff --git a/services/inputflinger/InputManager.h b/services/inputflinger/InputManager.h
index e000283..35d2b0f 100644
--- a/services/inputflinger/InputManager.h
+++ b/services/inputflinger/InputManager.h
@@ -23,6 +23,7 @@
#include "InputClassifier.h"
#include "InputReaderBase.h"
+#include "include/UnwantedInteractionBlockerInterface.h"
#include <InputDispatcherInterface.h>
#include <InputDispatcherPolicyInterface.h>
@@ -46,11 +47,16 @@
* The input manager has three components.
*
* 1. The InputReader class starts a thread that reads and preprocesses raw input events, applies
- * policy, and posts messages to a queue managed by the InputClassifier.
- * 2. The InputClassifier class starts a thread to communicate with the device-specific
- * classifiers. It then waits on the queue of events from InputReader, applies a classification
- * to them, and queues them for the InputDispatcher.
- * 3. The InputDispatcher class starts a thread that waits for new events on the
+ * policy, and posts messages to a queue managed by the UnwantedInteractionBlocker.
+ * 2. The UnwantedInteractionBlocker is responsible for removing unwanted interactions. For example,
+ * this could be a palm on the screen. This stage would alter the event stream to remove either
+ * partially (some of the pointers) or fully (all touches) the unwanted interaction. The events
+ * are processed on the InputReader thread, without any additional queue. The events are then
+ * posted to the queue managed by the InputClassifier.
+ * 3. The InputClassifier class starts a thread to communicate with the device-specific
+ * classifiers. It then waits on the queue of events from UnwantedInteractionBlocker, applies
+ * a classification to them, and queues them for the InputDispatcher.
+ * 4. The InputDispatcher class starts a thread that waits for new events on the
* previous queue and asynchronously dispatches them to applications.
*
* By design, none of these classes share any internal state. Moreover, all communication is
@@ -76,6 +82,9 @@
/* Gets the input reader. */
virtual InputReaderInterface& getReader() = 0;
+ /* Gets the unwanted interaction blocker. */
+ virtual UnwantedInteractionBlockerInterface& getUnwantedInteractionBlocker() = 0;
+
/* Gets the input classifier */
virtual InputClassifierInterface& getClassifier() = 0;
@@ -96,6 +105,7 @@
status_t stop() override;
InputReaderInterface& getReader() override;
+ UnwantedInteractionBlockerInterface& getUnwantedInteractionBlocker() override;
InputClassifierInterface& getClassifier() override;
InputDispatcherInterface& getDispatcher() override;
@@ -107,6 +117,8 @@
private:
std::unique_ptr<InputReaderInterface> mReader;
+ std::unique_ptr<UnwantedInteractionBlockerInterface> mUnwantedInteractionBlocker;
+
std::unique_ptr<InputClassifierInterface> mClassifier;
std::unique_ptr<InputDispatcherInterface> mDispatcher;