summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/input/Input.h12
-rw-r--r--include/input/InputEventLabels.h1
-rw-r--r--services/inputflinger/InputReader.cpp18
-rw-r--r--services/inputflinger/InputReader.h3
4 files changed, 34 insertions, 0 deletions
diff --git a/include/input/Input.h b/include/input/Input.h
index 96b6885..c360f63 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -149,10 +149,22 @@ enum {
* NOTE: If you want a flag to be able to set in a keylayout file, then you must add it to
* InputEventLabels.h as well. */
+ // Indicates that the event should wake the device.
POLICY_FLAG_WAKE = 0x00000001,
+
+ // Indicates that the key is virtual, such as a capacitive button, and should
+ // generate haptic feedback. Virtual keys may be suppressed for some time
+ // after a recent touch to prevent accidental activation of virtual keys adjacent
+ // to the touch screen during an edge swipe.
POLICY_FLAG_VIRTUAL = 0x00000002,
+
+ // Indicates that the key is the special function modifier.
POLICY_FLAG_FUNCTION = 0x00000004,
+ // Indicates that the key represents a special gesture that has been detected by
+ // the touch firmware or driver. Causes touch events from the same device to be canceled.
+ POLICY_FLAG_GESTURE = 0x00000008,
+
POLICY_FLAG_RAW_MASK = 0x0000ffff,
/* These flags are set by the input dispatcher. */
diff --git a/include/input/InputEventLabels.h b/include/input/InputEventLabels.h
index df50237..9aa7425 100644
--- a/include/input/InputEventLabels.h
+++ b/include/input/InputEventLabels.h
@@ -376,6 +376,7 @@ static const InputEventLabel LEDS[] = {
static const InputEventLabel FLAGS[] = {
DEFINE_FLAG(VIRTUAL),
DEFINE_FLAG(FUNCTION),
+ DEFINE_FLAG(GESTURE),
{ NULL, 0 }
};
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;
diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h
index c5896d4..34f20af 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -572,6 +572,7 @@ public:
const int32_t* keyCodes, uint8_t* outFlags);
void vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, int32_t token);
void cancelVibrate(int32_t token);
+ void cancelTouch(nsecs_t when);
int32_t getMetaState();
@@ -973,6 +974,7 @@ public:
virtual void vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat,
int32_t token);
virtual void cancelVibrate(int32_t token);
+ virtual void cancelTouch(nsecs_t when);
virtual int32_t getMetaState();
@@ -1191,6 +1193,7 @@ public:
const int32_t* keyCodes, uint8_t* outFlags);
virtual void fadePointer();
+ virtual void cancelTouch(nsecs_t when);
virtual void timeoutExpired(nsecs_t when);
protected: