summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-10-24 14:39:33 -0700
committerJeff Brown <jeffbrown@google.com>2011-01-11 20:56:04 -0800
commit6f71d0fedbb04c048a7294976103e42f0f046641 (patch)
tree134e67a8de24e3cba2eafeea87f486342537b576 /services
parent7e2f9cc81da788006790365ff11f06551fc1bc26 (diff)
downloadframeworks_base-6f71d0fedbb04c048a7294976103e42f0f046641.zip
frameworks_base-6f71d0fedbb04c048a7294976103e42f0f046641.tar.gz
frameworks_base-6f71d0fedbb04c048a7294976103e42f0f046641.tar.bz2
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
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/InputManager.java8
-rw-r--r--services/jni/com_android_server_InputManager.cpp26
2 files changed, 32 insertions, 2 deletions
diff --git a/services/java/com/android/server/InputManager.java b/services/java/com/android/server/InputManager.java
index b44fe00..ba39c57 100644
--- a/services/java/com/android/server/InputManager.java
+++ b/services/java/com/android/server/InputManager.java
@@ -411,7 +411,13 @@ public class InputManager {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_filterJumpyTouchEvents);
}
-
+
+ @SuppressWarnings("unused")
+ public int getVirtualKeyQuietTimeMillis() {
+ return mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_virtualKeyQuietTimeMillis);
+ }
+
@SuppressWarnings("unused")
public VirtualKeyDefinition[] getVirtualKeyDefinitions(String deviceName) {
ArrayList<VirtualKeyDefinition> keys = new ArrayList<VirtualKeyDefinition>();
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp
index 693d630..171471e 100644
--- a/services/jni/com_android_server_InputManager.cpp
+++ b/services/jni/com_android_server_InputManager.cpp
@@ -55,6 +55,7 @@ static struct {
jmethodID checkInjectEventsPermission;
jmethodID filterTouchEvents;
jmethodID filterJumpyTouchEvents;
+ jmethodID getVirtualKeyQuietTimeMillis;
jmethodID getVirtualKeyDefinitions;
jmethodID getInputDeviceCalibration;
jmethodID getExcludedDeviceNames;
@@ -183,6 +184,7 @@ public:
int32_t* width, int32_t* height, int32_t* orientation);
virtual bool filterTouchEvents();
virtual bool filterJumpyTouchEvents();
+ virtual nsecs_t getVirtualKeyQuietTime();
virtual void getVirtualKeyDefinitions(const String8& deviceName,
Vector<VirtualKeyDefinition>& outVirtualKeyDefinitions);
virtual void getInputDeviceCalibration(const String8& deviceName,
@@ -233,6 +235,7 @@ private:
// Cached filtering policies.
int32_t mFilterTouchEvents;
int32_t mFilterJumpyTouchEvents;
+ nsecs_t mVirtualKeyQuietTime;
// Cached throttling policy.
int32_t mMaxEventsPerSecond;
@@ -264,7 +267,7 @@ private:
// ----------------------------------------------------------------------------
NativeInputManager::NativeInputManager(jobject callbacksObj) :
- mFilterTouchEvents(-1), mFilterJumpyTouchEvents(-1),
+ mFilterTouchEvents(-1), mFilterJumpyTouchEvents(-1), mVirtualKeyQuietTime(-1),
mMaxEventsPerSecond(-1),
mDisplayWidth(-1), mDisplayHeight(-1), mDisplayOrientation(ROTATION_0) {
JNIEnv* env = jniEnv();
@@ -451,6 +454,24 @@ bool NativeInputManager::filterJumpyTouchEvents() {
return mFilterJumpyTouchEvents;
}
+nsecs_t NativeInputManager::getVirtualKeyQuietTime() {
+ if (mVirtualKeyQuietTime < 0) {
+ JNIEnv* env = jniEnv();
+
+ jint result = env->CallIntMethod(mCallbacksObj,
+ gCallbacksClassInfo.getVirtualKeyQuietTimeMillis);
+ if (checkAndClearExceptionFromCallback(env, "getVirtualKeyQuietTimeMillis")) {
+ result = 0;
+ }
+ if (result < 0) {
+ result = 0;
+ }
+
+ mVirtualKeyQuietTime = milliseconds_to_nanoseconds(result);
+ }
+ return mVirtualKeyQuietTime;
+}
+
void NativeInputManager::getVirtualKeyDefinitions(const String8& deviceName,
Vector<VirtualKeyDefinition>& outVirtualKeyDefinitions) {
outVirtualKeyDefinitions.clear();
@@ -1351,6 +1372,9 @@ int register_android_server_InputManager(JNIEnv* env) {
GET_METHOD_ID(gCallbacksClassInfo.filterJumpyTouchEvents, gCallbacksClassInfo.clazz,
"filterJumpyTouchEvents", "()Z");
+ GET_METHOD_ID(gCallbacksClassInfo.getVirtualKeyQuietTimeMillis, gCallbacksClassInfo.clazz,
+ "getVirtualKeyQuietTimeMillis", "()I");
+
GET_METHOD_ID(gCallbacksClassInfo.getVirtualKeyDefinitions, gCallbacksClassInfo.clazz,
"getVirtualKeyDefinitions",
"(Ljava/lang/String;)[Lcom/android/server/InputManager$VirtualKeyDefinition;");