summaryrefslogtreecommitdiffstats
path: root/services/jni
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-01-18 14:38:27 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-18 14:38:27 -0800
commitb26c516c03beffaf60460d3589b3807c0799c344 (patch)
treedc0df936813d0b042d5868ce7e9fabd8d86e411a /services/jni
parent02bbbc1122eac6ab02c10c3c1bb34092914e3743 (diff)
parent41395459e676cf9ab4059e08446656f145662c2d (diff)
downloadframeworks_base-b26c516c03beffaf60460d3589b3807c0799c344.zip
frameworks_base-b26c516c03beffaf60460d3589b3807c0799c344.tar.gz
frameworks_base-b26c516c03beffaf60460d3589b3807c0799c344.tar.bz2
am 41395459: Merge "Filter virtual keys after touches. (DO NOT MERGE)" into gingerbread
* commit '41395459e676cf9ab4059e08446656f145662c2d': Filter virtual keys after touches. (DO NOT MERGE)
Diffstat (limited to 'services/jni')
-rw-r--r--services/jni/com_android_server_InputManager.cpp26
1 files changed, 25 insertions, 1 deletions
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;");