summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2013-08-14 02:35:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-14 02:35:33 +0000
commita53d38bc286ee35ab77843ad5b4c6b2fb9e81ac5 (patch)
treeb1081296f0db55fc8801b9fcc0b2e2d6c4f7b89b /packages/SystemUI/src
parent1bab5064eb907e369a14903a3888847f1dae63a0 (diff)
parent69f756fe9b375df404b040c1f1e1d30265365c18 (diff)
downloadframeworks_base-a53d38bc286ee35ab77843ad5b4c6b2fb9e81ac5.zip
frameworks_base-a53d38bc286ee35ab77843ad5b4c6b2fb9e81ac5.tar.gz
frameworks_base-a53d38bc286ee35ab77843ad5b4c6b2fb9e81ac5.tar.bz2
Merge "Drop simultaneous pointer events when tracking velocity." into klp-dev
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index d0a6385..b78239b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -118,7 +118,7 @@ public class PanelView extends FrameLayout {
int i = 0;
float totalweight = 0f;
float weight = 10f;
- for (final Iterator<MotionEventCopy> iter = mEventBuf.descendingIterator();
+ for (final Iterator<MotionEventCopy> iter = mEventBuf.iterator();
iter.hasNext();) {
final MotionEventCopy event = iter.next();
if (last != null) {
@@ -126,13 +126,22 @@ public class PanelView extends FrameLayout {
final float dx = (event.x - last.x);
final float dy = (event.y - last.y);
if (FlingTracker.DEBUG) {
- Log.v("FlingTracker", String.format(" [%d] dx=%.1f dy=%.1f dt=%.0f vx=%.1f vy=%.1f",
- i,
+ Log.v("FlingTracker", String.format(
+ " [%d] (t=%d %.1f,%.1f) dx=%.1f dy=%.1f dt=%f vx=%.1f vy=%.1f",
+ i, event.t, event.x, event.y,
dx, dy, dt,
(dx/dt),
(dy/dt)
));
}
+ if (event.t == last.t) {
+ // Really not sure what to do with events that happened at the same time,
+ // so we'll skip subsequent events.
+ if (DEBUG_NAN) {
+ Log.v("FlingTracker", "skipping simultaneous event at t=" + event.t);
+ }
+ continue;
+ }
mVX += weight * dx / dt;
mVY += weight * dy / dt;
totalweight += weight;
@@ -158,18 +167,18 @@ public class PanelView extends FrameLayout {
}
}
public float getXVelocity() {
- if (Float.isNaN(mVX)) {
+ if (Float.isNaN(mVX) || Float.isInfinite(mVX)) {
if (DEBUG_NAN) {
- Log.v("FlingTracker", "warning: vx=NaN");
+ Log.v("FlingTracker", "warning: vx=" + mVX);
}
mVX = 0;
}
return mVX;
}
public float getYVelocity() {
- if (Float.isNaN(mVY)) {
+ if (Float.isNaN(mVY) || Float.isInfinite(mVX)) {
if (DEBUG_NAN) {
- Log.v("FlingTracker", "warning: vx=NaN");
+ Log.v("FlingTracker", "warning: vx=" + mVY);
}
mVY = 0;
}