Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb1c1d36 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android Git Automerger
Browse files

am de8e3b12: Merge "Fix NPE if pulling down QS quickly on very first boot." into jb-mr1-dev

* commit 'de8e3b12':
  Fix NPE if pulling down QS quickly on very first boot.
parents 60e8ff6d de8e3b12
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -281,12 +281,18 @@ public class PanelView extends FrameLayout {
                            mHandleView.setPressed(false);
                            mBar.onTrackingStopped(PanelView.this);
                            trackMovement(event);

                            float vel = 0, yVel = 0, xVel = 0;
                            boolean negative = false;

                            if (mVelocityTracker != null) {
                                // the velocitytracker might be null if we got a bad input stream
                                mVelocityTracker.computeCurrentVelocity(1000);

                            float yVel = mVelocityTracker.getYVelocity();
                            boolean negative = yVel < 0;
                                yVel = mVelocityTracker.getYVelocity();
                                negative = yVel < 0;

                            float xVel = mVelocityTracker.getXVelocity();
                                xVel = mVelocityTracker.getXVelocity();
                                if (xVel < 0) {
                                    xVel = -xVel;
                                }
@@ -294,11 +300,15 @@ public class PanelView extends FrameLayout {
                                    xVel = mFlingGestureMaxXVelocityPx; // limit how much we care about the x axis
                                }

                            float vel = (float)Math.hypot(yVel, xVel);
                                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
                            // preventing spurious flings due to touch screen jitter
                            final float deltaY = Math.abs(mFinalTouchY - mInitialTouchY);
@@ -321,9 +331,6 @@ public class PanelView extends FrameLayout {

                            fling(vel, true);

                            mVelocityTracker.recycle();
                            mVelocityTracker = null;

                            break;
                    }
                    return true;