Fix weird state when flinging with open quick settings.

Change-Id: Ib590eb091f8b5cae218824cf1d4c4ee78377b016
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index f19ce97..150db63 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -249,6 +249,11 @@
 
             case MotionEvent.ACTION_CANCEL:
             case MotionEvent.ACTION_UP:
+                trackMovement(event);
+                if (mTracking) {
+                    flingWithCurrentVelocity();
+                    mTracking = false;
+                }
                 mIntercepting = false;
                 break;
         }
@@ -264,6 +269,13 @@
         }
     }
 
+    private void flingWithCurrentVelocity() {
+        float vel = getCurrentVelocity();
+
+        // TODO: Better logic whether we should expand or not.
+        flingSettings(vel, vel > 0);
+    }
+
     @Override
     public boolean onTouchEvent(MotionEvent event) {
         // TODO: Handle doublefinger swipe to notifications again. Look at history for a reference
@@ -313,12 +325,7 @@
                     mTracking = false;
                     mTrackingPointer = -1;
                     trackMovement(event);
-
-                    float vel = getCurrentVelocity();
-
-                    // TODO: Better logic whether we should expand or not.
-                    flingSettings(vel, vel > 0);
-
+                    flingWithCurrentVelocity();
                     if (mVelocityTracker != null) {
                         mVelocityTracker.recycle();
                         mVelocityTracker = null;