Cancel lockscreen/shade gestures when orientation changes

Bug: 18293929
Change-Id: Ifbf91c42fa9e68aa688ca4c390fcc24a358212a9
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 b531c681..9d7d310 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -523,7 +523,8 @@
             case MotionEvent.ACTION_UP:
                 trackMovement(event);
                 if (mQsTracking) {
-                    flingQsWithCurrentVelocity();
+                    flingQsWithCurrentVelocity(
+                            event.getActionMasked() == MotionEvent.ACTION_CANCEL);
                     mQsTracking = false;
                 }
                 mIntercepting = false;
@@ -558,9 +559,9 @@
         super.requestDisallowInterceptTouchEvent(disallowIntercept);
     }
 
-    private void flingQsWithCurrentVelocity() {
+    private void flingQsWithCurrentVelocity(boolean isCancelMotionEvent) {
         float vel = getCurrentVelocity();
-        flingSettings(vel, flingExpandsQs(vel));
+        flingSettings(vel, flingExpandsQs(vel) && !isCancelMotionEvent);
     }
 
     private boolean flingExpandsQs(float vel) {
@@ -729,7 +730,8 @@
                 float fraction = getQsExpansionFraction();
                 if ((fraction != 0f || y >= mInitialTouchY)
                         && (fraction != 1f || y <= mInitialTouchY)) {
-                    flingQsWithCurrentVelocity();
+                    flingQsWithCurrentVelocity(
+                            event.getActionMasked() == MotionEvent.ACTION_CANCEL);
                 } else {
                     mScrollYOverride = -1;
                 }