Merge "Stop de-selection when drag and drop starts." into nyc-andromeda-dev
diff --git a/src/com/android/documentsui/dirlist/DirectoryDragListener.java b/src/com/android/documentsui/dirlist/DirectoryDragListener.java
index 8b0a663..57175a9 100644
--- a/src/com/android/documentsui/dirlist/DirectoryDragListener.java
+++ b/src/com/android/documentsui/dirlist/DirectoryDragListener.java
@@ -35,9 +35,7 @@
     public boolean onDrag(View v, DragEvent event) {
         final boolean result = super.onDrag(v, event);
 
-        if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) {
-            mDragHost.dragStarted();
-        } else if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) {
+        if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) {
             // getResult() is true if drag was accepted
             mDragHost.dragStopped(event.getResult());
         }
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index 00c2505..8ba2efb 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -1002,18 +1002,6 @@
         }
     }
 
-    void dragStarted() {
-        // When files are selected for dragging, ActionMode is started. This obscures the breadcrumb
-        // with an ActionBar. In order to make drag and drop to the breadcrumb possible, we first
-        // end ActionMode so the breadcrumb is visible to the user.
-        //
-        // mActionModeController is null when dragStarted() is called on spring loaded
-        // folders/roots.
-        if (mActionModeController != null) {
-            mActionModeController.finishActionMode();
-        }
-    }
-
     void dragStopped(boolean result) {
         if (result) {
             mSelectionMgr.clearSelection();
@@ -1119,7 +1107,7 @@
         if (v.getParent() == mRecView) {
             RecyclerView.ViewHolder vh = mRecView.getChildViewHolder(v);
             if (vh instanceof DocumentHolder) {
-                ((DocumentHolder) vh).setHighlighted(highlight);
+                ((DocumentHolder) vh).setDroppableHighlight(highlight);
             }
         }
     }
diff --git a/src/com/android/documentsui/dirlist/DocumentHolder.java b/src/com/android/documentsui/dirlist/DocumentHolder.java
index da6dba2..48a05d8 100644
--- a/src/com/android/documentsui/dirlist/DocumentHolder.java
+++ b/src/com/android/documentsui/dirlist/DocumentHolder.java
@@ -106,10 +106,15 @@
     }
 
     /**
-     * Highlights the associated item view.
+     * Highlights the associated item view to indicate it's droppable.
      * @param highlighted
      */
-    public void setHighlighted(boolean highlighted) {
+    public void setDroppableHighlight(boolean highlighted) {
+        // If item is already selected, its droppable highlight should not be changed.
+        if (itemView.isActivated()) {
+            return;
+        }
+
         itemView.setBackgroundColor(highlighted ? mSelectedBgColor : mDefaultBgColor);
     }