Launcher2: fix 2162230 - Can't add app shortcuts from 3D All Apps
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 6994c32..d4d1424 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -44,6 +44,8 @@
  * Class for initiating a drag within a view or across multiple views.
  */
 public class DragController {
+    private static final String TAG = "Launcher.DragController";
+
     /** Indicates the drag is a move.  */
     public static int DRAG_ACTION_MOVE = 0;
 
diff --git a/src/com/android/launcher2/UserFolder.java b/src/com/android/launcher2/UserFolder.java
index 1379be6..16fe616 100644
--- a/src/com/android/launcher2/UserFolder.java
+++ b/src/com/android/launcher2/UserFolder.java
@@ -3,6 +3,7 @@
 import android.content.Context;
 import android.graphics.Rect;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ArrayAdapter;
@@ -12,6 +13,8 @@
  *
  */
 public class UserFolder extends Folder implements DropTarget {
+    private static final String TAG = "Launcher.UserFolder";
+
     public UserFolder(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
@@ -32,7 +35,8 @@
         final ItemInfo item = (ItemInfo) dragInfo;
         final int itemType = item.itemType;
         return (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
-                itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && item.container != mInfo.id;
+                    itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT)
+                && item.container != mInfo.id;
     }
     
     public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset,
@@ -42,7 +46,11 @@
 
     public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
             DragView dragView, Object dragInfo) {
-        final ApplicationInfo item = (ApplicationInfo) dragInfo;
+        ApplicationInfo item = (ApplicationInfo) dragInfo;
+        if (item.container == NO_ID) {
+            // Came from all apps -- make a copy
+            item = new ApplicationInfo((ApplicationInfo)item);
+        }
         //noinspection unchecked
         ((ArrayAdapter<ApplicationInfo>) mContent.getAdapter()).add((ApplicationInfo) dragInfo);
         LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, 0, 0);