Merge "Fix NPE if pulling down QS quickly on very first boot." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
de8e3b122b
@@ -281,22 +281,32 @@ public class PanelView extends FrameLayout {
|
||||
mHandleView.setPressed(false);
|
||||
mBar.onTrackingStopped(PanelView.this);
|
||||
trackMovement(event);
|
||||
mVelocityTracker.computeCurrentVelocity(1000);
|
||||
|
||||
float yVel = mVelocityTracker.getYVelocity();
|
||||
boolean negative = yVel < 0;
|
||||
float vel = 0, yVel = 0, xVel = 0;
|
||||
boolean negative = false;
|
||||
|
||||
float xVel = mVelocityTracker.getXVelocity();
|
||||
if (xVel < 0) {
|
||||
xVel = -xVel;
|
||||
}
|
||||
if (xVel > mFlingGestureMaxXVelocityPx) {
|
||||
xVel = mFlingGestureMaxXVelocityPx; // limit how much we care about the x axis
|
||||
}
|
||||
if (mVelocityTracker != null) {
|
||||
// the velocitytracker might be null if we got a bad input stream
|
||||
mVelocityTracker.computeCurrentVelocity(1000);
|
||||
|
||||
float vel = (float)Math.hypot(yVel, xVel);
|
||||
if (vel > mFlingGestureMaxOutputVelocityPx) {
|
||||
vel = mFlingGestureMaxOutputVelocityPx;
|
||||
yVel = mVelocityTracker.getYVelocity();
|
||||
negative = yVel < 0;
|
||||
|
||||
xVel = mVelocityTracker.getXVelocity();
|
||||
if (xVel < 0) {
|
||||
xVel = -xVel;
|
||||
}
|
||||
if (xVel > mFlingGestureMaxXVelocityPx) {
|
||||
xVel = mFlingGestureMaxXVelocityPx; // limit how much we care about the x axis
|
||||
}
|
||||
|
||||
vel = (float)Math.hypot(yVel, xVel);
|
||||
if (vel > mFlingGestureMaxOutputVelocityPx) {
|
||||
vel = mFlingGestureMaxOutputVelocityPx;
|
||||
}
|
||||
|
||||
mVelocityTracker.recycle();
|
||||
mVelocityTracker = null;
|
||||
}
|
||||
|
||||
// if you've barely moved your finger, we treat the velocity as 0
|
||||
@@ -321,9 +331,6 @@ public class PanelView extends FrameLayout {
|
||||
|
||||
fling(vel, true);
|
||||
|
||||
mVelocityTracker.recycle();
|
||||
mVelocityTracker = null;
|
||||
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user