Only considering tap on recents view if finger didn't move

Bug: 114450749
Change-Id: Id99fd8c024140025b14973205f9080daa86db522
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 8ad3cee..bff3025 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -400,9 +400,6 @@
         final int y = (int) ev.getY();
         switch (ev.getAction()) {
             case MotionEvent.ACTION_UP:
-                if (mShowEmptyMessage) {
-                    onAllTasksRemoved();
-                }
                 if (mTouchDownToStartHome) {
                     startHome();
                 }
@@ -413,7 +410,8 @@
                 break;
             case MotionEvent.ACTION_MOVE:
                 // Passing the touch slop will not allow dismiss to home
-                if (mTouchDownToStartHome && Math.hypot(mDownX - x, mDownY - y) > mTouchSlop) {
+                if (mTouchDownToStartHome &&
+                        (isHandlingTouch() || Math.hypot(mDownX - x, mDownY - y) > mTouchSlop)) {
                     mTouchDownToStartHome = false;
                 }
                 break;
@@ -421,12 +419,17 @@
                 // Touch down anywhere but the deadzone around the visible clear all button and
                 // between the task views will start home on touch up
                 if (!isHandlingTouch()) {
-                    updateDeadZoneRects();
-                    final boolean clearAllButtonDeadZoneConsumed = mClearAllButton.getAlpha() == 1
-                            && mClearAllButtonDeadZoneRect.contains(x, y);
-                    if (!clearAllButtonDeadZoneConsumed
-                            && !mTaskViewDeadZoneRect.contains(x + getScrollX(), y)) {
+                    if (mShowEmptyMessage) {
                         mTouchDownToStartHome = true;
+                    } else {
+                        updateDeadZoneRects();
+                        final boolean clearAllButtonDeadZoneConsumed =
+                                mClearAllButton.getAlpha() == 1
+                                        && mClearAllButtonDeadZoneRect.contains(x, y);
+                        if (!clearAllButtonDeadZoneConsumed
+                                && !mTaskViewDeadZoneRect.contains(x + getScrollX(), y)) {
+                            mTouchDownToStartHome = true;
+                        }
                     }
                 }
                 mDownX = x;
@@ -666,10 +669,6 @@
         mHasVisibleTaskData.clear();
     }
 
-    protected void onAllTasksRemoved() {
-        startHome();
-    }
-
     protected abstract void startHome();
 
     public void reset() {
@@ -973,7 +972,7 @@
 
                if (getTaskViewCount() == 0) {
                    removeView(mClearAllButton);
-                   onAllTasksRemoved();
+                   startHome();
                } else {
                    snapToPageImmediately(pageToSnapTo);
                }
@@ -1002,7 +1001,7 @@
                 // Remove all the task views now
                 ActivityManagerWrapper.getInstance().removeAllRecentTasks();
                 removeAllViews();
-                onAllTasksRemoved();
+                startHome();
             }
             mPendingAnimation = null;
         });