summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Charles Chen <charlesccchen@google.com> 2019-01-29 17:26:18 +0800
committer Charles Chen <charlesccchen@google.com> 2019-01-30 12:02:59 +0800
commit3611f1f0ad24e61e618c427652a4d1696f7a0230 (patch)
tree9f75f98a1ee18b40d866c7f03750f91ba3f92fb0
parent6ad055d4c7c54713562fe50335c55aa37d48cf47 (diff)
Make interceptMotionBeforeQueueingNonInteractive per display
Fix: 77946172 Bug: 117479243 Test: atest WmTests Test: atest -a libinput_tests inputflinger_tests Change-Id: I95a90eff154d772b33dfd066714795a3ab1cabf6
-rw-r--r--services/inputflinger/InputDispatcher.cpp5
-rw-r--r--services/inputflinger/InputDispatcher.h3
-rw-r--r--services/inputflinger/tests/InputDispatcher_test.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index 57181c293c..1ec736baf9 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -2671,7 +2671,7 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) {
policyFlags |= POLICY_FLAG_TRUSTED;
android::base::Timer t;
- mPolicy->interceptMotionBeforeQueueing(args->eventTime, /*byref*/ policyFlags);
+ mPolicy->interceptMotionBeforeQueueing(args->displayId, args->eventTime, /*byref*/ policyFlags);
if (t.duration() > SLOW_INTERCEPTION_THRESHOLD) {
ALOGW("Excessive delay in interceptMotionBeforeQueueing; took %s ms",
std::to_string(t.duration().count()).c_str());
@@ -2819,6 +2819,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event,
size_t pointerCount = motionEvent->getPointerCount();
const PointerProperties* pointerProperties = motionEvent->getPointerProperties();
int32_t actionButton = motionEvent->getActionButton();
+ int32_t displayId = motionEvent->getDisplayId();
if (! validateMotionEvent(action, actionButton, pointerCount, pointerProperties)) {
return INPUT_EVENT_INJECTION_FAILED;
}
@@ -2826,7 +2827,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event,
if (!(policyFlags & POLICY_FLAG_FILTERED)) {
nsecs_t eventTime = motionEvent->getEventTime();
android::base::Timer t;
- mPolicy->interceptMotionBeforeQueueing(eventTime, /*byref*/ policyFlags);
+ mPolicy->interceptMotionBeforeQueueing(displayId, eventTime, /*byref*/ policyFlags);
if (t.duration() > SLOW_INTERCEPTION_THRESHOLD) {
ALOGW("Excessive delay in interceptMotionBeforeQueueing; took %s ms",
std::to_string(t.duration().count()).c_str());
diff --git a/services/inputflinger/InputDispatcher.h b/services/inputflinger/InputDispatcher.h
index 327dbbd9b1..4dd3e120d4 100644
--- a/services/inputflinger/InputDispatcher.h
+++ b/services/inputflinger/InputDispatcher.h
@@ -245,7 +245,8 @@ public:
* This method is expected to set the POLICY_FLAG_PASS_TO_USER policy flag if the event
* should be dispatched to applications.
*/
- virtual void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags) = 0;
+ virtual void interceptMotionBeforeQueueing(const int32_t displayId, nsecs_t when,
+ uint32_t& policyFlags) = 0;
/* Allows the policy a chance to intercept a key before dispatching. */
virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>& token,
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index ed177fbb06..1fc78b289f 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -138,7 +138,7 @@ private:
virtual void interceptKeyBeforeQueueing(const KeyEvent*, uint32_t&) {
}
- virtual void interceptMotionBeforeQueueing(nsecs_t, uint32_t&) {
+ virtual void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) {
}
virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&,