Ensuring that we don't start dragging while another drag is in progress.

Change-Id: If3c5a059407efc3ee9a0c9b1b3b7fb942d3a7664
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index f7d9f0e..4568562 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -234,10 +234,8 @@
 
     @Override
     protected boolean beginDragging(View v) {
-        if (!v.isInTouchMode()) {
-            return false;
-        }
-        super.beginDragging(v);
+        if (!v.isInTouchMode()) return false;
+        if (!super.beginDragging(v)) return false;
 
         // Start drag mode after the item is selected
         setupDragMode();
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 0b874bc..6a563f2 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -492,12 +492,13 @@
     }
 
     protected boolean beginDragging(View v) {
+        if (!v.isInTouchMode()) return false;
+        if (!super.beginDragging(v)) return false;
+
         // End the current choice mode before we start dragging anything
         if (isChoiceMode(CHOICE_MODE_SINGLE)) {
             endChoiceMode();
         }
-        super.beginDragging(v);
-
         boolean result = false;
         switch (mCustomizationType) {
         case WidgetCustomization: {
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 0f24cd9..b456030 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -390,6 +390,10 @@
         return mDragging;
     }
 
+    public boolean isDragging() {
+        return mDragging;
+    }
+
     /**
      * Stop dragging without dropping.
      */
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1ec326b..7faa520 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2221,7 +2221,7 @@
 
         final View itemUnderLongClick = longClickCellInfo.cell;
 
-        if (mWorkspace.allowLongPress()) {
+        if (mWorkspace.allowLongPress() && !mDragController.isDragging()) {
             if (itemUnderLongClick == null) {
                 // User long pressed on empty space
                 mWorkspace.setAllowLongPress(false);
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index b1f199b..f24d7e0 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -50,8 +50,9 @@
     }
 
     protected boolean beginDragging(View v) {
+        boolean wasDragging = mIsDragging;
         mIsDragging = true;
-        return false;
+        return !wasDragging;
     }
 
     protected void cancelDragging() {