summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/InputReader.h
diff options
context:
space:
mode:
authorChristopher N. Hesse <raymanfx@gmail.com>2014-12-05 21:38:51 +0100
committerSteve Kondik <steve@cyngn.com>2015-10-17 13:56:31 -0700
commit00888b7eeec5b01f071124b64a479e9eadf668f2 (patch)
tree11b8b98083c9fbe6b89b4a84e708b597be2163d3 /services/inputflinger/InputReader.h
parentbd33987d722697a926ac69fd7765020894dda006 (diff)
downloadframeworks_native-00888b7eeec5b01f071124b64a479e9eadf668f2.zip
frameworks_native-00888b7eeec5b01f071124b64a479e9eadf668f2.tar.gz
frameworks_native-00888b7eeec5b01f071124b64a479e9eadf668f2.tar.bz2
inputflinger: disable touch input while using a stylus
Android 5.0 cannot form multitouch events from multiple input devices. So it is not possible to report one touchpoint from the stylus position and, at the same time, another touchpoint from a finger touch. Instead, when a new input device starts up the currently active input is cancelled. This is highly undesirable while writing with the pen. The easiest solution is to ignore non-stylus touch events while the stylus is within range (hovering) of the touchscreen. For example, N-trig digitizers implement this in hardware. But wacom digitizers do report pen data simultaneously with touch data. This patch disables (non-stylus) touch input within 50ms of stylus data. On my Galaxy Note this is necessary to make stylus input usable. Original commit by vbraun: https://github.com/CyanogenMod/android_frameworks_base/commit/b9cb2961309c829586ae24ce432bb1fdb5610ba6 Change-Id: I97f26369826e96c97461c8ae188f1c64dec1b4d3
Diffstat (limited to 'services/inputflinger/InputReader.h')
-rw-r--r--services/inputflinger/InputReader.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h
index b73fe61..3b783c1 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -230,6 +230,9 @@ struct InputReaderConfiguration {
// True to show the location of touches on the touch screen as spots.
bool showTouches;
+
+ // Ignore finger touches this long after the stylus has been used (including hover)
+ nsecs_t stylusPalmRejectionTime;
InputReaderConfiguration() :
virtualKeyQuietTime(0),
@@ -247,6 +250,7 @@ struct InputReaderConfiguration {
pointerGestureSwipeMaxWidthRatio(0.25f),
pointerGestureMovementSpeedRatio(0.8f),
pointerGestureZoomSpeedRatio(0.3f),
+ stylusPalmRejectionTime(50 * 10000000LL), // 50 ms
showTouches(false) { }
bool getDisplayInfo(bool external, DisplayViewport* outViewport) const;
@@ -1787,6 +1791,9 @@ private:
VelocityControl mPointerVelocityControl;
VelocityControl mWheelXVelocityControl;
VelocityControl mWheelYVelocityControl;
+
+ // The time the stylus event was processed by any TouchInputMapper
+ static nsecs_t mLastStylusTime;
void resetExternalStylus();
void clearStylusDataPendingFlags();
@@ -1853,6 +1860,8 @@ private:
const VirtualKey* findVirtualKeyHit(int32_t x, int32_t y);
static void assignPointerIds(const RawState* last, RawState* current);
+
+ bool rejectPalm(nsecs_t when);
};