summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2023-09-19 09:06:56 -0700
committer Siarhei Vishniakou <svv@google.com> 2023-09-27 05:54:06 +0000
commitb1230625406d438fa248fd7be2fcaf1684833f06 (patch)
treec6f5291a922bc0ce13978bb4db83d6aedb689172
parent5fc4c8872eb58517d1da979260a7763d5149d9da (diff)
Add flag for multi-device input
For now, this flag will simply bypass the PreferStylusOverTouchBlocker. In the future, we can look into possibly turning on/off parts of the dispatcher with this flag, as well. Test: atest inputflinger_tests Bug: 211379801 Change-Id: I9ec6a42bf2cb9671cf3ca179995698dbae1dcc34
-rw-r--r--libs/input/input_flags.aconfig7
-rw-r--r--services/inputflinger/UnwantedInteractionBlocker.cpp15
2 files changed, 18 insertions, 4 deletions
diff --git a/libs/input/input_flags.aconfig b/libs/input/input_flags.aconfig
index a0563f916d..e8575a6103 100644
--- a/libs/input/input_flags.aconfig
+++ b/libs/input/input_flags.aconfig
@@ -27,3 +27,10 @@ flag {
description: "Set to true to enable timer support for the touchpad Gestures library"
bug: "297192727"
}
+
+flag {
+ name: "enable_multi_device_input"
+ namespace: "input"
+ description: "Set to true to enable multi-device input: touch and stylus can be active at the same time, but in different windows"
+ bug: "211379801"
+}
diff --git a/services/inputflinger/UnwantedInteractionBlocker.cpp b/services/inputflinger/UnwantedInteractionBlocker.cpp
index f889de58b8..0f6232477e 100644
--- a/services/inputflinger/UnwantedInteractionBlocker.cpp
+++ b/services/inputflinger/UnwantedInteractionBlocker.cpp
@@ -18,6 +18,7 @@
#include "UnwantedInteractionBlocker.h"
#include <android-base/stringprintf.h>
+#include <com_android_input_flags.h>
#include <ftl/enum.h>
#include <input/PrintTools.h>
#include <inttypes.h>
@@ -28,6 +29,8 @@
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h"
+namespace input_flags = com::android::input::flags;
+
using android::base::StringPrintf;
/**
@@ -344,10 +347,14 @@ 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);
- for (const NotifyMotionArgs& loopArgs : processedArgs) {
- notifyMotionLocked(loopArgs);
+ if (input_flags::enable_multi_device_input()) {
+ notifyMotionLocked(args);
+ } else {
+ const std::vector<NotifyMotionArgs> processedArgs =
+ mPreferStylusOverTouchBlocker.processMotion(args);
+ for (const NotifyMotionArgs& loopArgs : processedArgs) {
+ notifyMotionLocked(loopArgs);
+ }
}
} // release lock