summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-05-14 18:46:18 -0700
committerJeff Brown <jeffbrown@google.com>2012-05-14 18:57:05 -0700
commit90729403d50488566eb4ae0e09bb1be21979a633 (patch)
tree52f3abce5411493e204de30f273bfa955c95af59 /include
parentdcab190bd23f632f278af448b0c85b4cadcc6692 (diff)
downloadframeworks_base-90729403d50488566eb4ae0e09bb1be21979a633.zip
frameworks_base-90729403d50488566eb4ae0e09bb1be21979a633.tar.gz
frameworks_base-90729403d50488566eb4ae0e09bb1be21979a633.tar.bz2
Detect when pointer has stopped moving.
Some input devices do not generate ACTION_MOVE events while all pointers have stopped, thereby lulling the VelocityTracker into a false sense of complacency. Before handling the following sample, reset the VelocityTracker state so as not to be influenced by earlier samples before the pointer stopped. The velocity after stopping is assumed to be discontinuous. Bug: 6413587 Change-Id: I6387bc036ff141d083d3d17a89e37eeaa3188349
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/VelocityTracker.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/androidfw/VelocityTracker.h b/include/androidfw/VelocityTracker.h
index 6964588..cbb0782 100644
--- a/include/androidfw/VelocityTracker.h
+++ b/include/androidfw/VelocityTracker.h
@@ -37,6 +37,9 @@ public:
struct Estimator {
static const size_t MAX_DEGREE = 2;
+ // Estimator time base.
+ nsecs_t time;
+
// Polynomial coefficients describing motion in X and Y.
float xCoeff[MAX_DEGREE + 1], yCoeff[MAX_DEGREE + 1];
@@ -48,6 +51,7 @@ public:
float confidence;
inline void clear() {
+ time = 0;
degree = 0;
confidence = 0;
for (size_t i = 0; i <= MAX_DEGREE; i++) {
@@ -58,7 +62,6 @@ public:
};
VelocityTracker();
- VelocityTracker(VelocityTrackerStrategy* strategy);
~VelocityTracker();
// Resets the velocity tracker state.
@@ -96,6 +99,7 @@ public:
inline BitSet32 getCurrentPointerIdBits() const { return mCurrentPointerIdBits; }
private:
+ nsecs_t mLastEventTime;
BitSet32 mCurrentPointerIdBits;
int32_t mActivePointerId;
VelocityTrackerStrategy* mStrategy;