Merge "Can't stop the fling! Bug: 5335420" into ics-factoryrom
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index cfe4cb7..ba89ef3 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3654,7 +3654,8 @@
                 vt.computeCurrentVelocity(1000, mMaximumVelocity);
                 final float yvel = -vt.getYVelocity(activeId);
 
-                if (scroller.isScrollingInDirection(0, yvel)) {
+                if (Math.abs(yvel) >= mMinimumVelocity
+                        && scroller.isScrollingInDirection(0, yvel)) {
                     // Keep the fling alive a little longer
                     postDelayed(this, FLYWHEEL_TIMEOUT);
                 } else {
diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java
index 542a1ef..e571998 100644
--- a/core/java/android/widget/OverScroller.java
+++ b/core/java/android/widget/OverScroller.java
@@ -532,7 +532,7 @@
         final int dx = mScrollerX.mFinal - mScrollerX.mStart;
         final int dy = mScrollerY.mFinal - mScrollerY.mStart;
         return !isFinished() && Math.signum(xvel) == Math.signum(dx) &&
-        Math.signum(yvel) == Math.signum(dy);
+                Math.signum(yvel) == Math.signum(dy);
     }
 
     static class SplineOverScroller {
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp
index a5ba57d..3de75ba 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -1020,6 +1020,8 @@
             return true;
         }
     }
+    *outVx = 0;
+    *outVy = 0;
     return false;
 }