From 6f71d0fedbb04c048a7294976103e42f0f046641 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Sun, 24 Oct 2010 14:39:33 -0700 Subject: Filter virtual keys after touches. (DO NOT MERGE) Adds a new virtualKeyQuietTimeMillis configuration resource that sets the duration for which virtual keys will be dropped after recent touches on screen. The default value is 0; it is intended to be overridden per device using a resource overlay. This change is designed to help in two cases: 1. Swipes from touchscreen into virtual key area. 2. Accidental taps in virtual key area while using on-screen keyboard. Bug: 3089163 Change-Id: Id6733c83c2e2bc8d9553aa0e5c1fd74b741bec6e --- include/ui/InputReader.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/ui/InputReader.h') diff --git a/include/ui/InputReader.h b/include/ui/InputReader.h index 49351b0ca5dc..7568ba72329a 100644 --- a/include/ui/InputReader.h +++ b/include/ui/InputReader.h @@ -103,6 +103,12 @@ public: */ virtual bool filterJumpyTouchEvents() = 0; + /* Gets the amount of time to disable virtual keys after the screen is touched + * in order to filter out accidental virtual key presses due to swiping gestures + * or taps near the edge of the display. May be 0 to disable the feature. + */ + virtual nsecs_t getVirtualKeyQuietTime() = 0; + /* Gets the configured virtual key definitions for an input device. */ virtual void getVirtualKeyDefinitions(const String8& deviceName, Vector& outVirtualKeyDefinitions) = 0; @@ -177,6 +183,10 @@ public: virtual void updateGlobalMetaState() = 0; virtual int32_t getGlobalMetaState() = 0; + virtual void disableVirtualKeysUntil(nsecs_t time) = 0; + virtual bool shouldDropVirtualKey(nsecs_t now, + InputDevice* device, int32_t keyCode, int32_t scanCode) = 0; + virtual InputReaderPolicyInterface* getPolicy() = 0; virtual InputDispatcherInterface* getDispatcher() = 0; virtual EventHubInterface* getEventHub() = 0; @@ -264,6 +274,11 @@ private: InputConfiguration mInputConfiguration; void updateInputConfiguration(); + nsecs_t mDisableVirtualKeysTimeout; + virtual void disableVirtualKeysUntil(nsecs_t time); + virtual bool shouldDropVirtualKey(nsecs_t now, + InputDevice* device, int32_t keyCode, int32_t scanCode); + // state queries typedef int32_t (InputDevice::*GetStateFunc)(uint32_t sourceMask, int32_t code); int32_t getState(int32_t deviceId, uint32_t sourceMask, int32_t code, @@ -585,6 +600,7 @@ protected: bool useBadTouchFilter; bool useJumpyTouchFilter; bool useAveragingTouchFilter; + nsecs_t virtualKeyQuietTime; } mParameters; // Immutable calibration parameters in parsed form. @@ -810,6 +826,7 @@ private: void dispatchTouch(nsecs_t when, uint32_t policyFlags, TouchData* touch, BitSet32 idBits, uint32_t changedId, uint32_t pointerCount, int32_t motionEventAction); + void detectGestures(nsecs_t when); bool isPointInsideSurfaceLocked(int32_t x, int32_t y); const VirtualKey* findVirtualKeyHitLocked(int32_t x, int32_t y); -- cgit v1.2.3-59-g8ed1b