Fix not being able to dismiss notifications with tap.

Also fixes that the go-to-shade gesture sometimes triggers the unlock
hint animation.

Bug: 14487435
Bug: 15421928
Change-Id: Ie7e01c81a397b9b1a03baed82c1270ba4e7eb799
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index e5e3a1a..006619b 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -437,7 +437,7 @@
                 break;
         }
         mLastMotionY = ev.getRawY();
-        return true;
+        return mResizedView != null;
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 5442bc9..89a1907 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -162,7 +162,7 @@
                     if (mHeightAnimator != null) {
                         mHeightAnimator.cancel(); // end any outstanding animations
                     }
-                    mTouchSlopExceeded = true;
+                    mTouchSlopExceeded = (mHeightAnimator != null && !mHintAnimationRunning);
                     onTrackingStarted();
                 }
                 if (mExpandedHeight == 0) {
@@ -219,7 +219,8 @@
             case MotionEvent.ACTION_CANCEL:
                 mTrackingPointer = -1;
                 trackMovement(event);
-                if (mTracking && mTouchSlopExceeded) {
+                if ((mTracking && mTouchSlopExceeded)
+                        || event.getActionMasked() == MotionEvent.ACTION_CANCEL) {
                     float vel = getCurrentVelocity();
                     boolean expand = flingExpands(vel);
                     onTrackingStopped(expand);