merge in ics-release history after reset to master
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9ad3e24..7e8bec0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -25,6 +25,13 @@
     <!-- Do not translate. android:process of this application. -->
     <string name="process" translate="false"><xliff:g id="x"></xliff:g></string>
     
+    <!-- Do not translate. We wish to prioritize the Wallpaper and Live Wallpaper pickers,
+         but because they are in a different package, we need to reference the component in
+         a non language-dependent way.  If the Live Wallpaper picker component name changes
+         this will have to be updated as well. -->
+    <string name="live_wallpaper_picker_package_name" translate="false">com.android.wallpaper.livepicker</string>
+    <string name="live_wallpaper_picker_class_name" translate="false">com.android.wallpaper.livepicker.LiveWallpaperActivity</string>
+
     <!-- General -->
     <skip />
     <!-- Application name -->
diff --git a/src/com/android/launcher2/AllAppsBackground.java b/src/com/android/launcher2/AllAppsBackground.java
index 5292d0a..51e1ee4 100644
--- a/src/com/android/launcher2/AllAppsBackground.java
+++ b/src/com/android/launcher2/AllAppsBackground.java
@@ -25,8 +25,8 @@
 import android.view.View;
 
 /**
- * An implementation of PagedView that populates the pages of the workspace
- * with all of the user's applications.
+ * The background for AllApps which moves independently of the AllApps tray (for example, when we
+ * transition between AllApps and the Workspace while in spring-loaded mode).
  */
 public class AllAppsBackground extends View {
     private Drawable mBackground;
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 9d0c3ac..64e6f98 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -17,6 +17,7 @@
 package com.android.launcher2;
 
 import com.android.launcher.R;
+import com.android.launcher2.DropTarget.DragObject;
 
 import android.content.ComponentName;
 import android.content.Context;
@@ -686,28 +687,16 @@
      * We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
      * to the workspace.
      */
-    @Override
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public boolean acceptDrop(DragObject d) {
         return false;
     }
-    @Override
-    public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
-            int yOffset, DragView dragView, Object dragInfo) {
+    public DropTarget getDropTargetDelegate(DragObject d) {
         return null;
     }
-    @Override
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {}
-    @Override
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {}
-    @Override
-    public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {}
-    @Override
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {}
+    public void onDragEnter(DragObject d) {}
+    public void onDragExit(DragObject d) {}
+    public void onDragOver(DragObject d) {}
+    public void onDrop(DragObject d) {}
 
     public boolean isDropEnabled() {
         return true;
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index f42aaf5..e02878a 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -17,6 +17,7 @@
 package com.android.launcher2;
 
 import com.android.launcher.R;
+import com.android.launcher2.DropTarget.DragObject;
 
 import android.animation.Animator;
 import android.animation.AnimatorSet;
@@ -61,33 +62,30 @@
         }
     }
 
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public boolean acceptDrop(DragObject d) {
         // acceptDrop is called just before onDrop. We do the work here, rather than
         // in onDrop, because it allows us to reject the drop (by returning false)
         // so that the object being dragged isn't removed from the home screen.
         if (getVisibility() != VISIBLE) return false;
 
         ComponentName componentName = null;
-        if (dragInfo instanceof ApplicationInfo) {
-            componentName = ((ApplicationInfo)dragInfo).componentName;
-        } else if (dragInfo instanceof ShortcutInfo) {
-            componentName = ((ShortcutInfo)dragInfo).intent.getComponent();
+        if (d.dragInfo instanceof ApplicationInfo) {
+            componentName = ((ApplicationInfo) d.dragInfo).componentName;
+        } else if (d.dragInfo instanceof ShortcutInfo) {
+            componentName = ((ShortcutInfo) d.dragInfo).intent.getComponent();
         }
         mLauncher.startApplicationDetailsActivity(componentName);
         return false;
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragEnter(DragObject d) {
         if (!mDragAndDropEnabled) return;
-        dragView.setPaint(mHoverPaint);
+        d.dragView.setPaint(mHoverPaint);
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragExit(DragObject d) {
         if (!mDragAndDropEnabled) return;
-        dragView.setPaint(null);
+        d.dragView.setPaint(null);
     }
 
     public void onDragStart(DragSource source, Object info, int dragAction) {
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index fabd9e4..4500744 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -167,6 +168,22 @@
         setDragSlopeThreshold(r.getInteger(R.integer.config_appsCustomizeDragSlopeThreshold)/100f);
     }
 
+    /** Removes and returns the ResolveInfo with the specified ComponentName */
+    private ResolveInfo removeResolveInfoWithComponentName(List<ResolveInfo> list,
+            ComponentName cn) {
+        Iterator<ResolveInfo> iter = list.iterator();
+        while (iter.hasNext()) {
+            ResolveInfo rinfo = iter.next();
+            ActivityInfo info = rinfo.activityInfo;
+            ComponentName c = new ComponentName(info.packageName, info.name);
+            if (c.equals(cn)) {
+                iter.remove();
+                return rinfo;
+            }
+        }
+        return null;
+    }
+
     public void onPackagesUpdated() {
         // Get the list of widgets and shortcuts
         mWidgets.clear();
@@ -182,6 +199,20 @@
                 PackageManager.GET_META_DATA);
         Collections.sort(mWallpapers,
                 new LauncherModel.ShortcutNameComparator(mPackageManager));
+        // Move Live Wallpapers to the front of the list
+        Context c = getContext();
+        ResolveInfo liveWallpapers = removeResolveInfoWithComponentName(mWallpapers,
+            new ComponentName(c.getString(R.string.live_wallpaper_picker_package_name),
+                c.getString(R.string.live_wallpaper_picker_class_name)));
+        if (liveWallpapers != null) {
+            mWallpapers.add(0, liveWallpapers);
+        }
+        // Move Wallpapers to the front of the list
+        ResolveInfo wallpapers = removeResolveInfoWithComponentName(mWallpapers,
+            new ComponentName(c.getPackageName(), WallpaperChooser.class.getName()));
+        if (wallpapers != null) {
+            mWallpapers.add(0, wallpapers);
+        }
     }
 
     /**
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 5f848a8..f189cd5 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -71,7 +71,7 @@
 
     // These are temporary variables to prevent having to allocate a new object just to
     // return an (x, y) value from helper functions. Do NOT use them to maintain other state.
-    private final int[] mTmpCellXY = new int[2];
+    private final int[] mTmpXY = new int[2];
     private final int[] mTmpPoint = new int[2];
     private final PointF mTmpPointF = new PointF();
 
@@ -694,6 +694,14 @@
             if ((child.getVisibility() == VISIBLE || child.getAnimation() != null) &&
                     lp.isLockedToGrid) {
                 child.getHitRect(frame);
+
+                // The child hit rect is relative to the CellLayoutChildren parent, so we need to
+                // offset that by this CellLayout's padding to test an (x,y) point that is relative
+                // to this view.
+                final int tmpXY[] = mTmpXY;
+                child.getLocationOnScreen(tmpXY);
+                frame.offset(mLeftPadding, mTopPadding);
+
                 if (frame.contains(x, y)) {
                     cellInfo.cell = child;
                     cellInfo.cellX = lp.cellX;
@@ -708,7 +716,7 @@
         }
 
         if (!found) {
-            final int cellXY[] = mTmpCellXY;
+            final int cellXY[] = mTmpXY;
             pointToCellExact(x, y, cellXY);
 
             cellInfo.cell = null;
@@ -1161,7 +1169,7 @@
                         }
                     }
                 }
-                final int[] cellXY = mTmpCellXY;
+                final int[] cellXY = mTmpXY;
                 cellToCenterPoint(x, y, cellXY);
 
                 double distance = Math.sqrt(Math.pow(cellXY[0] - pixelX, 2)
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java
index 5d9b5db..21b1cf1 100644
--- a/src/com/android/launcher2/DeleteZone.java
+++ b/src/com/android/launcher2/DeleteZone.java
@@ -33,6 +33,7 @@
 import android.view.animation.AccelerateInterpolator;
 
 import com.android.launcher.R;
+import com.android.launcher2.DropTarget.DragObject;
 
 public class DeleteZone extends IconDropTarget {
     private static final int ORIENTATION_HORIZONTAL = 1;
@@ -90,16 +91,14 @@
         mDragTextColor = r.getColor(R.color.workspace_delete_zone_drag_text_color);
     }
 
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public boolean acceptDrop(DragObject d) {
         return true;
     }
 
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDrop(DragObject d) {
         if (!mDragAndDropEnabled) return;
 
-        final ItemInfo item = (ItemInfo) dragInfo;
+        final ItemInfo item = (ItemInfo) d.dragInfo;
 
         // On x-large screens, you can uninstall an app by dragging from all apps
         if (item instanceof ApplicationInfo && LauncherApplication.isScreenLarge()) {
@@ -135,21 +134,19 @@
         LauncherModel.deleteItemFromDatabase(mLauncher, item);
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragEnter(DragObject d) {
         if (mDragAndDropEnabled) {
             mTransition.reverseTransition(getTransitionAnimationDuration());
             setTextColor(mDragTextColor);
-            super.onDragEnter(source, x, y, xOffset, yOffset, dragView, dragInfo);
+            super.onDragEnter(d);
         }
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragExit(DragObject d) {
         if (mDragAndDropEnabled) {
             mTransition.reverseTransition(getTransitionAnimationDuration());
             setTextColor(mTextColor);
-            super.onDragExit(source, x, y, xOffset, yOffset, dragView, dragInfo);
+            super.onDragExit(d);
         }
     }
 
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 5ca1e1c..1690cac 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -35,6 +35,7 @@
 import android.view.inputmethod.InputMethodManager;
 
 import com.android.launcher.R;
+import com.android.launcher2.DropTarget.DragObject;
 
 /**
  * Class for initiating a drag within a view or across multiple views.
@@ -84,25 +85,12 @@
     /** Original view that is being dragged.  */
     private View mOriginator;
 
-    /** X offset from the upper-left corner of the cell to where we touched.  */
-    private int mTouchOffsetX;
-
-    /** Y offset from the upper-left corner of the cell to where we touched.  */
-    private int mTouchOffsetY;
-
     /** the area at the edge of the screen that makes the workspace go left
      *   or right while you're dragging.
      */
     private int mScrollZone;
 
-    /** Where the drag originated */
-    private DragSource mDragSource;
-
-    /** The data associated with the object being dragged */
-    private Object mDragInfo;
-
-    /** The view that moves around while you drag.  */
-    private DragView mDragView;
+    private DropTarget.DragObject mDragObject = new DropTarget.DragObject();
 
     /** Who can receive drop events */
     private ArrayList<DropTarget> mDropTargets = new ArrayList<DropTarget>();
@@ -295,17 +283,17 @@
         final int dragRegionLeft = dragRegion == null ? 0 : dragRegion.left;
         final int dragRegionTop = dragRegion == null ? 0 : dragRegion.top;
 
-        mTouchOffsetX = mMotionDownX - (screenX + dragRegionLeft);
-        mTouchOffsetY = mMotionDownY - (screenY + dragRegionTop);
-
         mDragging = true;
-        mDragSource = source;
-        mDragInfo = dragInfo;
+
+        mDragObject.xOffset = mMotionDownX - (screenX + dragRegionLeft);
+        mDragObject.yOffset = mMotionDownY - (screenY + dragRegionTop);
+        mDragObject.dragSource = source;
+        mDragObject.dragInfo = dragInfo;
 
         mVibrator.vibrate(VIBRATE_DURATION);
 
-        DragView dragView = mDragView = new DragView(mContext, b, registrationX, registrationY,
-                0, 0, b.getWidth(), b.getHeight());
+        final DragView dragView = mDragObject.dragView = new DragView(mContext, b, registrationX,
+                registrationY, 0, 0, b.getWidth(), b.getHeight());
 
         final DragSource dragSource = source;
         dragView.setOnDrawRunnable(new Runnable() {
@@ -386,7 +374,7 @@
     public void cancelDrag() {
         if (mDragging) {
             // Should we also be calling onDragExit() here?
-            mDragSource.onDropCompleted(null, mDragInfo, false);
+            mDragObject.dragSource.onDropCompleted(null, mDragObject.dragInfo, false);
         }
         endDrag();
     }
@@ -400,9 +388,9 @@
             for (DragListener listener : mListeners) {
                 listener.onDragEnd();
             }
-            if (mDragView != null) {
-                mDragView.remove();
-                mDragView = null;
+            if (mDragObject.dragView != null) {
+                mDragObject.dragView.remove();
+                mDragObject.dragView = null;
             }
         }
     }
@@ -459,33 +447,29 @@
     }
 
     private void handleMoveEvent(int x, int y) {
-        mDragView.move(x, y);
+        mDragObject.dragView.move(x, y);
 
         // Drop on someone?
         final int[] coordinates = mCoordinatesTemp;
         DropTarget dropTarget = findDropTarget(x, y, coordinates);
+        mDragObject.x = coordinates[0];
+        mDragObject.y = coordinates[1];
         if (dropTarget != null) {
-            DropTarget delegate = dropTarget.getDropTargetDelegate(
-                    mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+            DropTarget delegate = dropTarget.getDropTargetDelegate(mDragObject);
             if (delegate != null) {
                 dropTarget = delegate;
             }
 
             if (mLastDropTarget != dropTarget) {
                 if (mLastDropTarget != null) {
-                    mLastDropTarget.onDragExit(mDragSource, coordinates[0], coordinates[1],
-                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+                    mLastDropTarget.onDragExit(mDragObject);
                 }
-                dropTarget.onDragEnter(mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+                dropTarget.onDragEnter(mDragObject);
             }
-            dropTarget.onDragOver(mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+            dropTarget.onDragOver(mDragObject);
         } else {
             if (mLastDropTarget != null) {
-                mLastDropTarget.onDragExit(mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+                mLastDropTarget.onDragExit(mDragObject);
             }
         }
         mLastDropTarget = dropTarget;
@@ -578,18 +562,18 @@
         final int[] coordinates = mCoordinatesTemp;
         final DropTarget dropTarget = findDropTarget((int) x, (int) y, coordinates);
 
+        mDragObject.x = coordinates[0];
+        mDragObject.y = coordinates[1];
         boolean accepted = false;
         if (dropTarget != null) {
-            dropTarget.onDragExit(mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
-            if (dropTarget.acceptDrop(mDragSource, coordinates[0], coordinates[1],
-                    (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo)) {
-                dropTarget.onDrop(mDragSource, coordinates[0], coordinates[1],
-                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo);
+            dropTarget.onDragExit(mDragObject);
+            if (dropTarget.acceptDrop(mDragObject)) {
+                dropTarget.onDrop(mDragObject);
                 accepted = true;
             }
         }
-        mDragSource.onDropCompleted((View) dropTarget, mDragInfo, accepted);
+        mDragObject.dragSource.onDropCompleted((View) dropTarget, mDragObject.dragInfo, accepted);
+
     }
 
     private DropTarget findDropTarget(int x, int y, int[] dropCoordinates) {
@@ -608,9 +592,10 @@
             target.getLocationOnScreen(dropCoordinates);
             r.offset(dropCoordinates[0] - target.getLeft(), dropCoordinates[1] - target.getTop());
 
+            mDragObject.x = x;
+            mDragObject.y = y;
             if (r.contains(x, y)) {
-                DropTarget delegate = target.getDropTargetDelegate(mDragSource,
-                        x, y, (int)mTouchOffsetX, (int)mTouchOffsetY, mDragView, mDragInfo);
+                DropTarget delegate = target.getDropTargetDelegate(mDragObject);
                 if (delegate != null) {
                     target = delegate;
                     target.getLocationOnScreen(dropCoordinates);
@@ -701,7 +686,7 @@
     }
 
     DragView getDragView() {
-        return mDragView;
+        return mDragObject.dragView;
     }
 
     private class ScrollRunnable implements Runnable {
diff --git a/src/com/android/launcher2/DropTarget.java b/src/com/android/launcher2/DropTarget.java
index 308dbbe..9c0faf3 100644
--- a/src/com/android/launcher2/DropTarget.java
+++ b/src/com/android/launcher2/DropTarget.java
@@ -23,6 +23,30 @@
  *
  */
 public interface DropTarget {
+
+    class DragObject {
+        public int x = -1;
+        public int y = -1;
+
+        /** X offset from the upper-left corner of the cell to where we touched.  */
+        public int xOffset = -1;
+
+        /** Y offset from the upper-left corner of the cell to where we touched.  */
+        public int yOffset = -1;
+
+        /** The view that moves around while you drag.  */
+        public DragView dragView = null;
+
+        /** The data associated with the object being dragged */
+        public Object dragInfo = null;
+
+        /** Where the drag originated */
+        public DragSource dragSource = null;
+
+        public DragObject() {
+        }
+    }
+
     /**
      * Used to temporarily disable certain drop targets
      *
@@ -44,17 +68,13 @@
      * @param dragInfo Data associated with the object being dragged
      * 
      */
-    void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
-    
-    void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
+    void onDrop(DragObject dragObject);
 
-    void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
+    void onDragEnter(DragObject dragObject);
 
-    void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
+    void onDragOver(DragObject dragObject);
+
+    void onDragExit(DragObject dragObject);
 
     /**
      * Allows a DropTarget to delegate drag and drop events to another object.
@@ -73,8 +93,7 @@
      *
      * @return The DropTarget to delegate to, or null to not delegate to another object.
      */
-    DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
+    DropTarget getDropTargetDelegate(DragObject dragObject);
 
     /**
      * Check if a drop action can occur at, or near, the requested location.
@@ -91,8 +110,7 @@
      * @param dragInfo Data associated with the object being dragged
      * @return True if the drop will be accepted, false otherwise.
      */
-    boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo);
+    boolean acceptDrop(DragObject dragObject);
 
     // These methods are implemented in Views
     void getHitRect(Rect outRect);
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 0470e41..76e9b35 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -363,25 +363,23 @@
         bind(mInfo);
     }
 
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
-        final ItemInfo item = (ItemInfo) dragInfo;
+    public boolean acceptDrop(DragObject d) {
+        final ItemInfo item = (ItemInfo) d.dragInfo;
         final int itemType = item.itemType;
         return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
                     itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) &&
                     !isFull());
     }
 
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDrop(DragObject d) {
         ShortcutInfo item;
-        if (dragInfo instanceof ApplicationInfo) {
+        if (d.dragInfo instanceof ApplicationInfo) {
             // Came from all apps -- make a copy
-            item = ((ApplicationInfo)dragInfo).makeShortcut();
+            item = ((ApplicationInfo) d.dragInfo).makeShortcut();
             item.spanX = 1;
             item.spanY = 1;
         } else {
-            item = (ShortcutInfo)dragInfo;
+            item = (ShortcutInfo) d.dragInfo;
         }
         mInfo.add(item);
         LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY);
@@ -417,19 +415,16 @@
         mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int)item.id, lp, true);
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragEnter(DragObject d) {
         mContent.onDragEnter();
     }
 
-    public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
-        float[] r = mapPointFromScreenToContent(x, y, null);
+    public void onDragOver(DragObject d) {
+        float[] r = mapPointFromScreenToContent(d.x, d.y, null);
         mContent.visualizeDropLocation(null, null, (int) r[0], (int) r[1], 1, 1);
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragExit(DragObject d) {
         mContent.onDragExit();
     }
 
@@ -453,8 +448,7 @@
         return true;
     }
 
-    public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public DropTarget getDropTargetDelegate(DragObject d) {
         return null;
     }
 
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 2a5a5a0..0091a28 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -58,8 +58,6 @@
 
     private int mOriginalWidth = -1;
     private int mOriginalHeight = -1;
-    private int mOriginalX = -1;
-    private int mOriginalY = -1;
 
     private int mFolderLocX;
     private int mFolderLocY;
@@ -121,9 +119,8 @@
                 !mFolder.isFull() && item != mInfo);
     }
 
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
-        final ItemInfo item = (ItemInfo) dragInfo;
+    public boolean acceptDrop(DragObject d) {
+        final ItemInfo item = (ItemInfo) d.dragInfo;
         return willAcceptItem(item);
     }
 
@@ -132,14 +129,13 @@
         LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY);
     }
 
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDrop(DragObject d) {
         ShortcutInfo item;
-        if (dragInfo instanceof ApplicationInfo) {
+        if (d.dragInfo instanceof ApplicationInfo) {
             // Came from all apps -- make a copy
-            item = ((ApplicationInfo)dragInfo).makeShortcut();
+            item = ((ApplicationInfo) d.dragInfo).makeShortcut();
         } else {
-            item = (ShortcutInfo)dragInfo;
+            item = (ShortcutInfo) d.dragInfo;
         }
         item.cellX = -1;
         item.cellY = -1;
@@ -149,8 +145,6 @@
     void saveState(CellLayout.LayoutParams lp) {
         mOriginalWidth = lp.width;
         mOriginalHeight = lp.height;
-        mOriginalX = lp.x;
-        mOriginalY = lp.y;
     }
 
     private void animateToAcceptState() {
@@ -213,27 +207,22 @@
         mFolderLocY = tvLocation[1] - wsLocation[1] + getMeasuredHeight() / 2;
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
-        if (!willAcceptItem((ItemInfo) dragInfo)) return;
+    public void onDragEnter(DragObject d) {
+        if (!willAcceptItem((ItemInfo) d.dragInfo)) return;
         determineFolderLocationInWorkspace();
         mLauncher.getWorkspace().showFolderAccept(this);
         animateToAcceptState();
     }
 
-    public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragOver(DragObject d) {
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
-        if (!willAcceptItem((ItemInfo) dragInfo)) return;
+    public void onDragExit(DragObject d) {
+        if (!willAcceptItem((ItemInfo) d.dragInfo)) return;
         animateToNaturalState();
     }
 
-    @Override
-    public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public DropTarget getDropTargetDelegate(DragObject d) {
         return null;
     }
 
diff --git a/src/com/android/launcher2/IconDropTarget.java b/src/com/android/launcher2/IconDropTarget.java
index 4d018e6..a091f6c 100644
--- a/src/com/android/launcher2/IconDropTarget.java
+++ b/src/com/android/launcher2/IconDropTarget.java
@@ -82,32 +82,27 @@
         mDragAndDropEnabled = enabled;
     }
 
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public boolean acceptDrop(DragObject d) {
         return false;
     }
 
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDrop(DragObject d) {
         // Do nothing
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragEnter(DragObject d) {
         if (mDragAndDropEnabled) {
-            dragView.setPaint(mHoverPaint);
+            d.dragView.setPaint(mHoverPaint);
         }
     }
 
-    public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragOver(DragObject d) {
         // Do nothing
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragExit(DragObject d) {
         if (mDragAndDropEnabled) {
-            dragView.setPaint(null);
+            d.dragView.setPaint(null);
         }
     }
 
@@ -135,8 +130,7 @@
     }
 
     @Override
-    public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
-            int yOffset, DragView dragView, Object dragInfo) {
+    public DropTarget getDropTargetDelegate(DragObject d) {
         return null;
     }
 }
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index 306ff9e..30f0b1d 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -31,7 +31,6 @@
 import android.os.Message;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
-import android.view.View;
 import android.widget.Checkable;
 
 import com.android.launcher.R;
diff --git a/src/com/android/launcher2/ShortcutsAdapter.java b/src/com/android/launcher2/ShortcutsAdapter.java
deleted file mode 100644
index de73c3e..0000000
--- a/src/com/android/launcher2/ShortcutsAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher2;
-
-import java.util.ArrayList;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import com.android.launcher.R;
-
-/**
- * GridView adapter to show the list of applications and shortcuts
- */
-public class ShortcutsAdapter extends ArrayAdapter<ShortcutInfo> {
-    private final LayoutInflater mInflater;
-    private final IconCache mIconCache;
-
-    public ShortcutsAdapter(Context context, ArrayList<ShortcutInfo> apps) {
-        super(context, 0, apps);
-        mInflater = LayoutInflater.from(context);
-        mIconCache = ((LauncherApplication)context.getApplicationContext()).getIconCache();
-    }
-
-    @Override
-    public View getView(int position, View convertView, ViewGroup parent) {
-        final ShortcutInfo info = getItem(position);
-
-        if (convertView == null) {
-            convertView = mInflater.inflate(R.layout.application_boxed, parent, false);
-        }
-
-        final TextView textView = (TextView) convertView;
-        textView.setCompoundDrawablesWithIntrinsicBounds(null,
-                new FastBitmapDrawable(info.getIcon(mIconCache)), null, null);
-        textView.setText(info.title);
-
-        return convertView;
-    }
-}
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index ba25893..04abd77 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -68,28 +68,6 @@
         sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
                 Paint.FILTER_BITMAP_FLAG));
     }
-
-    static Bitmap centerToFit(Bitmap bitmap, int width, int height, Context context) {
-        final int bitmapWidth = bitmap.getWidth();
-        final int bitmapHeight = bitmap.getHeight();
-
-        if (bitmapWidth < width || bitmapHeight < height) {
-            int color = context.getResources().getColor(R.color.window_background);
-
-            Bitmap centered = Bitmap.createBitmap(bitmapWidth < width ? width : bitmapWidth,
-                    bitmapHeight < height ? height : bitmapHeight, Bitmap.Config.RGB_565);
-            centered.setDensity(bitmap.getDensity());
-            Canvas canvas = new Canvas(centered);
-            canvas.drawColor(color);
-            canvas.drawBitmap(bitmap, (width - bitmapWidth) / 2.0f, (height - bitmapHeight) / 2.0f,
-                    null);
-
-            bitmap = centered;
-        }
-
-        return bitmap;
-    }
-
     static int sColors[] = { 0xffff0000, 0xff00ff00, 0xff0000ff };
     static int sColorIndex = 0;
 
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 3f0c54e..7d2626d 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2379,11 +2379,10 @@
     /**
      * {@inheritDoc}
      */
-    public boolean acceptDrop(DragSource source, int x, int y,
-            int xOffset, int yOffset, DragView dragView, Object dragInfo) {
+    public boolean acceptDrop(DragObject d) {
 
         // If it's an external drop (e.g. from All Apps), check if it should be accepted
-        if (source != this) {
+        if (d.dragSource != this) {
             // Don't accept the drop if we're not over a screen at time of drop
             if (mDragTargetLayout == null || !mDragTargetLayout.getAcceptsDrops()) {
                 return false;
@@ -2469,10 +2468,9 @@
         return false;
     }
 
-    public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDrop(DragObject d) {
 
-        mDragViewVisualCenter = getDragViewVisualCenter(x, y, xOffset, yOffset, dragView,
+        mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, d.dragView,
                 mDragViewVisualCenter);
 
         // We want the point to be mapped to the dragTarget.
@@ -2489,17 +2487,17 @@
             }
         }
 
-        if (source != this) {
+        if (d.dragSource != this) {
             final int[] touchXY = new int[] { (int) mDragViewVisualCenter[0],
                     (int) mDragViewVisualCenter[1] };
             if (LauncherApplication.isScreenLarge() && (mIsSmall || mIsInUnshrinkAnimation)
                     && !mLauncher.isAllAppsVisible()) {
                 // When the workspace is shrunk and the drop comes from customize, don't actually
                 // add the item to the screen -- customize will do this itself
-                ((ItemInfo) dragInfo).dropPos = touchXY;
+                ((ItemInfo) d.dragInfo).dropPos = touchXY;
                 return;
             }
-            onDropExternal(touchXY, dragInfo, mDragTargetLayout, false, dragView);
+            onDropExternal(touchXY, d.dragInfo, mDragTargetLayout, false, d.dragView);
         } else if (mDragInfo != null) {
             final View cell = mDragInfo.cell;
             CellLayout dropTargetLayout = mDragTargetLayout;
@@ -2592,11 +2590,11 @@
             final CellLayout parent = (CellLayout) cell.getParent().getParent();
 
             int loc[] = new int[2];
-            getViewLocationRelativeToSelf(dragView, loc);
+            getViewLocationRelativeToSelf(d.dragView, loc);
 
             // Prepare it to be animated into its new position
             // This must be called after the view has been re-parented
-            setPositionForDropAnimation(dragView, loc[0], loc[1], parent, cell);
+            setPositionForDropAnimation(d.dragView, loc[0], loc[1], parent, cell);
             boolean animateDrop = !mWasSpringLoadedOnDragExit;
             parent.onDropChild(cell, animateDrop);
         }
@@ -2615,8 +2613,7 @@
         location[1] = vY - y;
     }
 
-    public void onDragEnter(DragSource source, int x, int y, int xOffset,
-            int yOffset, DragView dragView, Object dragInfo) {
+    public void onDragEnter(DragObject d) {
         mDragTargetLayout = null; // Reset the drag state
 
         if (!mIsSmall) {
@@ -2626,8 +2623,7 @@
         }
     }
 
-    public DropTarget getDropTargetDelegate(DragSource source, int x, int y,
-            int xOffset, int yOffset, DragView dragView, Object dragInfo) {
+    public DropTarget getDropTargetDelegate(DragObject d) {
 
         if (mIsSmall || mIsInUnshrinkAnimation) {
             // If we're shrunken, don't let anyone drag on folders/etc that are on the mini-screens
@@ -2637,18 +2633,18 @@
         // would land in a cell occupied by a DragTarget (e.g. a Folder),
         // then drag events should be handled by that child.
 
-        ItemInfo item = (ItemInfo) dragInfo;
+        ItemInfo item = (ItemInfo) d.dragInfo;
         CellLayout currentLayout = getCurrentDropLayout();
 
         int dragPointX, dragPointY;
         if (item.spanX == 1 && item.spanY == 1) {
             // For a 1x1, calculate the drop cell exactly as in onDragOver
-            dragPointX = x - xOffset;
-            dragPointY = y - yOffset;
+            dragPointX = d.x - d.xOffset;
+            dragPointY = d.y - d.yOffset;
         } else {
             // Otherwise, use the exact drag coordinates
-            dragPointX = x;
-            dragPointY = y;
+            dragPointX = d.x;
+            dragPointY = d.y;
         }
         dragPointX += mScrollX - currentLayout.getLeft();
         dragPointY += mScrollY - currentLayout.getTop();
@@ -2660,7 +2656,7 @@
         View child = currentLayout.getChildAt(cellXY[0], cellXY[1]);
         if (child instanceof DropTarget) {
             DropTarget target = (DropTarget)child;
-            if (target.acceptDrop(source, x, y, xOffset, yOffset, dragView, dragInfo)) {
+            if (target.acceptDrop(d)) {
                 return target;
             }
         }
@@ -2977,25 +2973,24 @@
         return res;
     }
 
-    public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
-            DragView dragView, Object dragInfo) {
+    public void onDragOver(DragObject d) {
         // When touch is inside the scroll area, skip dragOver actions for the current screen
         if (!mInScrollArea) {
             CellLayout layout;
-            int left = x - xOffset;
-            int top = y - yOffset;
+            int left = d.x - d.xOffset;
+            int top = d.y - d.yOffset;
 
-            mDragViewVisualCenter = getDragViewVisualCenter(x, y, xOffset, yOffset, dragView,
-                    mDragViewVisualCenter);
+            mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset,
+                    d.dragView, mDragViewVisualCenter);
 
             boolean shrunken = mIsSmall || mIsInUnshrinkAnimation;
             if (shrunken) {
-                mLastDragView = dragView;
+                mLastDragView = d.dragView;
                 mLastDragOriginX = left;
                 mLastDragOriginY = top;
-                mLastDragXOffset = xOffset;
-                mLastDragYOffset = yOffset;
-                layout = findMatchingPageForDragOver(dragView, left, top, xOffset, yOffset);
+                mLastDragXOffset = d.xOffset;
+                mLastDragYOffset = d.yOffset;
+                layout = findMatchingPageForDragOver(d.dragView, left, top, d.xOffset, d.yOffset);
 
                 if (layout != null && layout != mDragTargetLayout) {
                     if (mDragTargetLayout != null) {
@@ -3033,9 +3028,9 @@
             if (!shrunken || mShrinkState == ShrinkState.SPRING_LOADED) {
                 layout = getCurrentDropLayout();
 
-                final ItemInfo item = (ItemInfo)dragInfo;
-                if (dragInfo instanceof LauncherAppWidgetInfo) {
-                    LauncherAppWidgetInfo widgetInfo = (LauncherAppWidgetInfo)dragInfo;
+                final ItemInfo item = (ItemInfo) d.dragInfo;
+                if (d.dragInfo instanceof LauncherAppWidgetInfo) {
+                    LauncherAppWidgetInfo widgetInfo = (LauncherAppWidgetInfo) d.dragInfo;
 
                     if (widgetInfo.spanX == -1) {
                         // Calculate the grid spans needed to fit this widget
@@ -3050,7 +3045,7 @@
                     final View child = (mDragInfo == null) ? null : mDragInfo.cell;
                     // We want the point to be mapped to the dragTarget.
                     mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter, null);
-                    ItemInfo info = (ItemInfo) dragInfo;
+                    ItemInfo info = (ItemInfo) d.dragInfo;
 
                     if (!willCreateUserFolder(info, mDragTargetLayout,
                             (int) mDragViewVisualCenter[0], (int) mDragViewVisualCenter[1])) {
@@ -3082,8 +3077,7 @@
         clearAllHovers();
     }
 
-    public void onDragExit(DragSource source, int x, int y, int xOffset,
-            int yOffset, DragView dragView, Object dragInfo) {
+    public void onDragExit(DragObject d) {
         doDragExit();
     }