summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/VelocityTracker.java11
-rw-r--r--core/java/com/android/internal/widget/PointerLocationView.java2
-rw-r--r--core/jni/android_view_VelocityTracker.cpp18
3 files changed, 10 insertions, 21 deletions
diff --git a/core/java/android/view/VelocityTracker.java b/core/java/android/view/VelocityTracker.java
index f703e34..f5870e1 100644
--- a/core/java/android/view/VelocityTracker.java
+++ b/core/java/android/view/VelocityTracker.java
@@ -60,8 +60,7 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
private static native void nativeComputeCurrentVelocity(int ptr, int units, float maxVelocity);
private static native float nativeGetXVelocity(int ptr, int id);
private static native float nativeGetYVelocity(int ptr, int id);
- private static native boolean nativeGetEstimator(int ptr, int id,
- int degree, int horizonMillis, Estimator outEstimator);
+ private static native boolean nativeGetEstimator(int ptr, int id, Estimator outEstimator);
/**
* Retrieve a new VelocityTracker object to watch the velocity of a
@@ -227,21 +226,17 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
* this method.
*
* @param id Which pointer's velocity to return.
- * @param degree The desired polynomial degree. The actual estimator may have
- * a lower degree than what is requested here. If -1, uses the default degree.
- * @param horizonMillis The maximum age of the oldest sample to consider, in milliseconds.
- * If -1, uses the default horizon.
* @param outEstimator The estimator to populate.
* @return True if an estimator was obtained, false if there is no information
* available about the pointer.
*
* @hide For internal use only. Not a final API.
*/
- public boolean getEstimator(int id, int degree, int horizonMillis, Estimator outEstimator) {
+ public boolean getEstimator(int id, Estimator outEstimator) {
if (outEstimator == null) {
throw new IllegalArgumentException("outEstimator must not be null");
}
- return nativeGetEstimator(mPtr, id, degree, horizonMillis, outEstimator);
+ return nativeGetEstimator(mPtr, id, outEstimator);
}
/**
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index 1d6af90..85e6c16 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -527,7 +527,7 @@ public class PointerLocationView extends View implements InputDeviceListener {
ps.addTrace(coords.x, coords.y);
ps.mXVelocity = mVelocity.getXVelocity(id);
ps.mYVelocity = mVelocity.getYVelocity(id);
- mVelocity.getEstimator(id, -1, -1, ps.mEstimator);
+ mVelocity.getEstimator(id, ps.mEstimator);
ps.mToolType = event.getToolType(i);
}
}
diff --git a/core/jni/android_view_VelocityTracker.cpp b/core/jni/android_view_VelocityTracker.cpp
index 04d1056..0180e0a 100644
--- a/core/jni/android_view_VelocityTracker.cpp
+++ b/core/jni/android_view_VelocityTracker.cpp
@@ -48,8 +48,7 @@ public:
void addMovement(const MotionEvent* event);
void computeCurrentVelocity(int32_t units, float maxVelocity);
void getVelocity(int32_t id, float* outVx, float* outVy);
- bool getEstimator(int32_t id, uint32_t degree, nsecs_t horizon,
- VelocityTracker::Estimator* outEstimator);
+ bool getEstimator(int32_t id, VelocityTracker::Estimator* outEstimator);
private:
struct Velocity {
@@ -129,9 +128,8 @@ void VelocityTrackerState::getVelocity(int32_t id, float* outVx, float* outVy) {
}
}
-bool VelocityTrackerState::getEstimator(int32_t id, uint32_t degree, nsecs_t horizon,
- VelocityTracker::Estimator* outEstimator) {
- return mVelocityTracker.getEstimator(id, degree, horizon, outEstimator);
+bool VelocityTrackerState::getEstimator(int32_t id, VelocityTracker::Estimator* outEstimator) {
+ return mVelocityTracker.getEstimator(id, outEstimator);
}
@@ -186,14 +184,10 @@ static jfloat android_view_VelocityTracker_nativeGetYVelocity(JNIEnv* env, jclas
}
static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jclass clazz,
- jint ptr, jint id, jint degree, jint horizonMillis, jobject outEstimatorObj) {
+ jint ptr, jint id, jobject outEstimatorObj) {
VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr);
VelocityTracker::Estimator estimator;
- bool result = state->getEstimator(id,
- degree < 0 ? VelocityTracker::DEFAULT_DEGREE : uint32_t(degree),
- horizonMillis < 0 ? VelocityTracker::DEFAULT_HORIZON :
- nsecs_t(horizonMillis) * 1000000L,
- &estimator);
+ bool result = state->getEstimator(id, &estimator);
jfloatArray xCoeffObj = jfloatArray(env->GetObjectField(outEstimatorObj,
gEstimatorClassInfo.xCoeff));
@@ -236,7 +230,7 @@ static JNINativeMethod gVelocityTrackerMethods[] = {
"(II)F",
(void*)android_view_VelocityTracker_nativeGetYVelocity },
{ "nativeGetEstimator",
- "(IIIILandroid/view/VelocityTracker$Estimator;)Z",
+ "(IILandroid/view/VelocityTracker$Estimator;)Z",
(void*)android_view_VelocityTracker_nativeGetEstimator },
};