summaryrefslogtreecommitdiffstats
path: root/services/input/InputReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/input/InputReader.cpp')
-rw-r--r--services/input/InputReader.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index c66e7a1..d9290f4 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -4991,6 +4991,7 @@ void TouchInputMapper::dispatchPointerStylus(nsecs_t when, uint32_t policyFlags)
mPointerSimple.currentProperties.id = 0;
mPointerSimple.currentProperties.toolType =
mCurrentCookedPointerData.pointerProperties[index].toolType;
+ mLastStylusTime = when;
} else {
down = false;
hovering = false;
@@ -5073,6 +5074,11 @@ void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags,
}
}
+ if (rejectPalm(when)) { // stylus is currently active
+ mPointerSimple.reset();
+ return;
+ }
+
if (mPointerSimple.down && !down) {
mPointerSimple.down = false;
@@ -5183,6 +5189,9 @@ void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32
const PointerProperties* properties, const PointerCoords* coords,
const uint32_t* idToIndex, BitSet32 idBits,
int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) {
+
+ if (rejectPalm(when)) return;
+
PointerCoords pointerCoords[MAX_POINTERS];
PointerProperties pointerProperties[MAX_POINTERS];
uint32_t pointerCount = 0;
@@ -5262,6 +5271,13 @@ void TouchInputMapper::unfadePointer(PointerControllerInterface::Transition tran
}
}
+nsecs_t TouchInputMapper::mLastStylusTime = 0;
+
+bool TouchInputMapper::rejectPalm(nsecs_t when) {
+ return (when - mLastStylusTime < mConfig.stylusPalmRejectionTime) &&
+ mPointerSimple.currentProperties.toolType != AMOTION_EVENT_TOOL_TYPE_STYLUS;
+}
+
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;