summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_MotionEvent.h
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-03-14 19:39:54 -0700
committerJeff Brown <jeffbrown@google.com>2011-03-15 19:59:47 -0700
commit2ed2462aa29c564f5231f317c27b3188da875e52 (patch)
tree63209b0ae028c1353e79d79b5e4000e7c4402ecc /core/jni/android_view_MotionEvent.h
parentace13b17866dc9136aeecf6dfaf7077f37434469 (diff)
downloadframeworks_base-2ed2462aa29c564f5231f317c27b3188da875e52.zip
frameworks_base-2ed2462aa29c564f5231f317c27b3188da875e52.tar.gz
frameworks_base-2ed2462aa29c564f5231f317c27b3188da875e52.tar.bz2
Improve VelocityTracker numerical stability.
Replaced VelocityTracker with a faster and more accurate native implementation. This avoids the duplicate maintenance overhead of having two implementations. The new algorithm requires that the sample duration be at least 10ms in order to contribute to the velocity calculation. This ensures that the velocity is not severely overestimated when samples arrive in bursts. The new algorithm computes the exponentially weighted moving average using weights based on the relative duration of successive sample periods. The new algorithm is also more careful about how it handles individual pointers going down or up and their effects on the collected movement traces. The intent is to preserve the last known velocity of pointers as they go up while also ensuring that other motion samples do not count twice in that case. Bug: 4086785 Change-Id: I2632321232c64d6b8faacdb929e33f60e64dcdd3
Diffstat (limited to 'core/jni/android_view_MotionEvent.h')
-rw-r--r--core/jni/android_view_MotionEvent.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/jni/android_view_MotionEvent.h b/core/jni/android_view_MotionEvent.h
index 80dc861..0cf1fb2 100644
--- a/core/jni/android_view_MotionEvent.h
+++ b/core/jni/android_view_MotionEvent.h
@@ -26,12 +26,11 @@ class MotionEvent;
/* Obtains an instance of a DVM MotionEvent object as a copy of a native MotionEvent instance.
* Returns NULL on error. */
-extern jobject android_view_MotionEvent_fromNative(JNIEnv* env, const MotionEvent* event);
+extern jobject android_view_MotionEvent_obtainAsCopy(JNIEnv* env, const MotionEvent* event);
-/* Copies the contents of a DVM MotionEvent object to a native MotionEvent instance.
- * Returns non-zero on error. */
-extern status_t android_view_MotionEvent_toNative(JNIEnv* env, jobject eventObj,
- MotionEvent* event);
+/* Gets the underlying native MotionEvent instance within a DVM MotionEvent object.
+ * Returns NULL if the event is NULL or if it is uninitialized. */
+extern MotionEvent* android_view_MotionEvent_getNativePtr(JNIEnv* env, jobject eventObj);
/* Recycles a DVM MotionEvent object.
* Returns non-zero on error. */