summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/InputReader.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2015-02-11 19:03:28 -0800
committerJeff Brown <jeffbrown@google.com>2015-02-12 11:27:24 -0800
commitc9aa628d065eb08d6fa30f0ac21c6eca4cfbab75 (patch)
tree9ed87795c384a4eb0e44282381862d02728c3c18 /services/inputflinger/InputReader.cpp
parentb9bb1f139bd1cbf3b3faa002b509f3f0a167e20b (diff)
downloadframeworks_native-c9aa628d065eb08d6fa30f0ac21c6eca4cfbab75.zip
frameworks_native-c9aa628d065eb08d6fa30f0ac21c6eca4cfbab75.tar.gz
frameworks_native-c9aa628d065eb08d6fa30f0ac21c6eca4cfbab75.tar.bz2
Cancel touch events when a low-level touch gesture occurs.
When the touch firmware or driver sends a key event that is triggered by a low-level gesture such as a palm slap. For this to work, the touch device's .kl file must specify the "GESTURE" flag for each key that is produced by a gesture. Note that the "VIRTUAL" flag should also be specified for any such keys for which we would like to generate haptic feedback. eg. key 142 SLEEP VIRTUAL GESTURE Bug: 19264992 Change-Id: Ief494ec7e3ca66d2358a1001fdfae4f263ee1cd1
Diffstat (limited to 'services/inputflinger/InputReader.cpp')
-rw-r--r--services/inputflinger/InputReader.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 8634e42..ccf8ced 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -1078,6 +1078,14 @@ void InputDevice::cancelVibrate(int32_t token) {
}
}
+void InputDevice::cancelTouch(nsecs_t when) {
+ size_t numMappers = mMappers.size();
+ for (size_t i = 0; i < numMappers; i++) {
+ InputMapper* mapper = mMappers[i];
+ mapper->cancelTouch(when);
+ }
+}
+
int32_t InputDevice::getMetaState() {
int32_t result = 0;
size_t numMappers = mMappers.size();
@@ -1786,6 +1794,9 @@ void InputMapper::vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t re
void InputMapper::cancelVibrate(int32_t token) {
}
+void InputMapper::cancelTouch(nsecs_t when) {
+}
+
int32_t InputMapper::getMetaState() {
return 0;
}
@@ -2134,6 +2145,9 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
getDevice(), keyCode, scanCode)) {
return;
}
+ if (policyFlags & POLICY_FLAG_GESTURE) {
+ mDevice->cancelTouch(when);
+ }
mKeyDowns.push();
KeyDown& keyDown = mKeyDowns.editTop();
@@ -5717,6 +5731,10 @@ void TouchInputMapper::fadePointer() {
}
}
+void TouchInputMapper::cancelTouch(nsecs_t when) {
+ abortPointerUsage(when, 0 /*policyFlags*/);
+}
+
bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) {
return x >= mRawPointerAxes.x.minValue && x <= mRawPointerAxes.x.maxValue
&& y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue;