Merge "Get Vibrator from Context instead of using private API."
diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml
index 4e4360a..03dfee6 100644
--- a/res/values-in/strings.xml
+++ b/res/values-in/strings.xml
@@ -33,7 +33,7 @@
     <string name="external_drop_widget_pick_title" msgid="7040647073452295370">"Pilih widget untuk membuat"</string>
     <string name="rename_folder_label" msgid="5646236631298452787">"Nama folder"</string>
     <string name="rename_folder_title" msgid="4544573104191526550">"Ganti nama folder"</string>
-    <string name="rename_action" msgid="6016003384693240896">"OK"</string>
+    <string name="rename_action" msgid="6016003384693240896">"Oke"</string>
     <string name="cancel_action" msgid="3811860427489435048">"Batal"</string>
     <string name="menu_item_add_item" msgid="6233177331075781114">"Tambahkan ke Layar Utama"</string>
     <string name="group_applications" msgid="2103752818818161976">"Apl"</string>
@@ -97,7 +97,7 @@
     <string name="folder_cling_title" msgid="4308949882377840953">"Atur apl Anda dengan folder"</string>
     <string name="folder_cling_move_item" msgid="270598675060435169">"Untuk memindahkan apl, sentuh &amp; tahan apl tersebut."</string>
     <string name="folder_cling_create_folder" msgid="8352867485656129478">"Untuk membuat folder baru di layar Utama Anda, tumpuk satu apl di atas apl yang lain."</string>
-    <string name="cling_dismiss" msgid="2780907108735868381">"OK"</string>
+    <string name="cling_dismiss" msgid="2780907108735868381">"Oke"</string>
     <string name="folder_opened" msgid="1262064100943801533">"Folder dibuka, <xliff:g id="WIDTH">%1$d</xliff:g> kali <xliff:g id="HEIGHT">%2$d</xliff:g>"</string>
     <string name="folder_tap_to_close" msgid="1335478160661137579">"Sentuh untuk menutup folder"</string>
     <string name="folder_tap_to_rename" msgid="5201612989905472442">"Sentuh untuk menyimpan pengubahan nama"</string>
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 0959a34..9df6f32 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -16,8 +16,6 @@
 import com.android.launcher.R;
 
 public class AppWidgetResizeFrame extends FrameLayout {
-
-    private ItemInfo mItemInfo;
     private LauncherAppWidgetHostView mWidgetView;
     private CellLayout mCellLayout;
     private DragLayer mDragLayer;
@@ -69,12 +67,11 @@
 
     private Launcher mLauncher;
 
-    public AppWidgetResizeFrame(Context context, ItemInfo itemInfo, 
+    public AppWidgetResizeFrame(Context context,
             LauncherAppWidgetHostView widgetView, CellLayout cellLayout, DragLayer dragLayer) {
 
         super(context);
         mLauncher = (Launcher) context;
-        mItemInfo = itemInfo;
         mCellLayout = cellLayout;
         mWidgetView = widgetView;
         mResizeMode = widgetView.getAppWidgetInfo().resizeMode;
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 3d5d06a..2467871 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -1214,8 +1214,6 @@
 
                 // Determine the widget spans and min resize spans.
                 int[] spanXY = mLauncher.getSpanForWidget(info);
-                int[] size = mLauncher.getWorkspace().estimateItemSize(spanXY[0],
-                        spanXY[1], createItemInfo, true);
                 createItemInfo.spanX = spanXY[0];
                 createItemInfo.spanY = spanXY[1];
                 int[] minSpanXY = mLauncher.getMinSpanForWidget(info);
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index a775ed5..526fda7 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -20,8 +20,6 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.graphics.Region.Op;
@@ -30,8 +28,6 @@
 import android.view.MotionEvent;
 import android.widget.TextView;
 
-import com.android.launcher.R;
-
 /**
  * TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
  * because we want to make the bubble taller than the text and TextView's clip is
@@ -85,7 +81,6 @@
         mBackground = getBackground();
 
         final Resources res = getContext().getResources();
-        int bubbleColor = res.getColor(R.color.bubble_dark_background);
         mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor =
             res.getColor(android.R.color.holo_blue_light);
 
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 26a3ecf..a48a815 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -268,7 +268,9 @@
                     // If an animation is started and then stopped very quickly, we can still
                     // get spurious updates we've cleared the tag. Guard against this.
                     if (outline == null) {
-                        if (false) {
+                        @SuppressWarnings("all") // suppress dead code warning
+                        final boolean debug = false;
+                        if (debug) {
                             Object val = animation.getAnimatedValue();
                             Log.d(TAG, "anim " + thisIndex + " update: " + val +
                                      ", isStopped " + anim.isStopped());
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 77a23fb..c9bebe3 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -40,7 +40,6 @@
  * Class for initiating a drag within a view or across multiple views.
  */
 public class DragController {
-    @SuppressWarnings({"UnusedDeclaration"})
     private static final String TAG = "Launcher.DragController";
 
     /** Indicates the drag is a move.  */
@@ -348,7 +347,6 @@
      *              || super.dispatchKeyEvent(event);
      * </pre>
      */
-    @SuppressWarnings({"UnusedDeclaration"})
     public boolean dispatchKeyEvent(KeyEvent event) {
         return mDragging;
     }
@@ -458,7 +456,9 @@
      * Call this from a drag source view.
      */
     public boolean onInterceptTouchEvent(MotionEvent ev) {
-        if (false) {
+        @SuppressWarnings("all") // suppress dead code warning
+        final boolean debug = false;
+        if (debug) {
             Log.d(Launcher.TAG, "DragController.onInterceptTouchEvent " + ev + " mDragging="
                     + mDragging);
         }
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index e4e48d0..f71baec 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -23,9 +23,6 @@
 import android.animation.ValueAnimator.AnimatorUpdateListener;
 import android.content.Context;
 import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PointF;
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
@@ -34,7 +31,6 @@
 import android.view.ViewParent;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
-import android.view.animation.AnimationUtils;
 import android.view.animation.DecelerateInterpolator;
 import android.view.animation.Interpolator;
 import android.widget.FrameLayout;
@@ -402,7 +398,7 @@
     public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget,
             CellLayout cellLayout) {
         AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(),
-                itemInfo, widget, cellLayout, this);
+                widget, cellLayout, this);
 
         LayoutParams lp = new LayoutParams(-1, -1);
         lp.customPosition = true;
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index a6aa595..b6645e1 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -167,8 +167,9 @@
 
     @Override
     protected void onDraw(Canvas canvas) {
-        if (false) {
-            // for debugging
+        @SuppressWarnings("all") // suppress dead code warning
+        final boolean debug = false;
+        if (debug) {
             Paint p = new Paint();
             p.setStyle(Paint.Style.FILL);
             p.setColor(0x66ffffff);
diff --git a/src/com/android/launcher2/DrawableStateProxyView.java b/src/com/android/launcher2/DrawableStateProxyView.java
index 498730f..dac9584 100644
--- a/src/com/android/launcher2/DrawableStateProxyView.java
+++ b/src/com/android/launcher2/DrawableStateProxyView.java
@@ -18,12 +18,8 @@
 
 import android.content.Context;
 import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
 import android.view.View;
-import android.widget.ImageView;
 import android.widget.LinearLayout;
 
 import com.android.launcher.R;
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index ecc9d9c..0066440 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -626,7 +626,6 @@
             int lineDelta) {
         final ArrayList<View> views = getCellLayoutChildrenSortedSpatially(layout, parent);
         final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
-        final int cellCountX = layout.getCountX();
         final int cellCountY = layout.getCountY();
         final int row = lp.cellY;
         final int newRow = row + lineDelta;
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index c502fb7..fcaf020 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -44,7 +44,6 @@
 import android.widget.TextView;
 
 import com.android.launcher.R;
-import com.android.launcher2.DropTarget.DragObject;
 import com.android.launcher2.FolderInfo.FolderListener;
 
 import java.util.ArrayList;
@@ -56,6 +55,7 @@
         View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener,
         View.OnFocusChangeListener {
 
+    @SuppressWarnings("unused")
     private static final String TAG = "Launcher.Folder";
 
     protected DragController mDragController;
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 513fa6b..2377f30 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -119,8 +119,9 @@
 
     static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
             FolderInfo folderInfo, IconCache iconCache) {
-
-        if (INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION) {
+        @SuppressWarnings("all") // suppress dead code warning
+        final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
+        if (error) {
             throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
                     "INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
                     "is dependent on this");
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index fbb45b9..a6c9fb2 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -28,6 +28,7 @@
 import com.android.launcher.R;
 
 public class Hotseat extends FrameLayout {
+    @SuppressWarnings("unused")
     private static final String TAG = "Hotseat";
 
     private Launcher mLauncher;
diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java
index 1e8379d..efa9fac 100644
--- a/src/com/android/launcher2/IconCache.java
+++ b/src/com/android/launcher2/IconCache.java
@@ -33,6 +33,7 @@
  * Cache of application icons.  Icons can be made from any thread.
  */
 public class IconCache {
+    @SuppressWarnings("unused")
     private static final String TAG = "Launcher.IconCache";
 
     private static final int INITIAL_ICON_CACHE_CAPACITY = 50;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0f700e2..5965b5c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -26,8 +26,6 @@
 import android.animation.ValueAnimator.AnimatorUpdateListener;
 import android.app.Activity;
 import android.app.ActivityManager;
-import android.app.AlertDialog;
-import android.app.Dialog;
 import android.app.SearchManager;
 import android.appwidget.AppWidgetHostView;
 import android.appwidget.AppWidgetManager;
@@ -40,7 +38,6 @@
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.SharedPreferences;
@@ -65,7 +62,6 @@
 import android.speech.RecognizerIntent;
 import android.text.Selection;
 import android.text.SpannableStringBuilder;
-import android.text.TextUtils;
 import android.text.method.TextKeyListener;
 import android.util.Log;
 import android.view.Display;
@@ -88,7 +84,6 @@
 import android.view.animation.DecelerateInterpolator;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.Advanceable;
-import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -142,9 +137,6 @@
     static final int SCREEN_COUNT = 5;
     static final int DEFAULT_SCREEN = 2;
 
-    static final int DIALOG_CREATE_SHORTCUT = 1;
-    static final int DIALOG_RENAME_FOLDER = 2;
-
     private static final String PREFERENCES = "launcher.preferences";
     static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher.force_enable_rotation";
 
@@ -1260,23 +1252,6 @@
     void closeSystemDialogs() {
         getWindow().closeAllPanels();
 
-        /**
-         * We should remove this code when we remove all the dialog code.
-        try {
-            dismissDialog(DIALOG_CREATE_SHORTCUT);
-            // Unlock the workspace if the dialog was showing
-        } catch (Exception e) {
-            // An exception is thrown if the dialog is not visible, which is fine
-        }
-
-        try {
-            dismissDialog(DIALOG_RENAME_FOLDER);
-            // Unlock the workspace if the dialog was showing
-        } catch (Exception e) {
-            // An exception is thrown if the dialog is not visible, which is fine
-        }
-         */
-
         // Whatever we were doing is hereby canceled.
         mWaitingForResult = false;
     }
@@ -1528,7 +1503,6 @@
 
     void addAppWidgetImpl(final int appWidgetId, final PendingAddWidgetInfo info) {
         final AppWidgetProviderInfo appWidget = info.info;
-        Runnable configurationActivity = null;
         if (appWidget.configure != null) {
             // Launch over to configure widget, if needed
             Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
@@ -2121,130 +2095,6 @@
         return mWorkspace;
     }
 
-    @Override
-    protected Dialog onCreateDialog(int id) {
-        switch (id) {
-            case DIALOG_CREATE_SHORTCUT:
-                return new CreateShortcut().createDialog();
-            case DIALOG_RENAME_FOLDER:
-                return new RenameFolder().createDialog();
-        }
-
-        return super.onCreateDialog(id);
-    }
-
-    @Override
-    protected void onPrepareDialog(int id, Dialog dialog) {
-        switch (id) {
-            case DIALOG_CREATE_SHORTCUT:
-                break;
-            case DIALOG_RENAME_FOLDER:
-                if (mFolderInfo != null) {
-                    EditText input = (EditText) dialog.findViewById(R.id.folder_name);
-                    final CharSequence text = mFolderInfo.title;
-                    input.setText(text);
-                    input.setSelection(0, text.length());
-                }
-                break;
-        }
-    }
-
-    void showRenameDialog(FolderInfo info) {
-        mFolderInfo = info;
-        mWaitingForResult = true;
-        showDialog(DIALOG_RENAME_FOLDER);
-    }
-
-    private void showAddDialog() {
-        resetAddInfo();
-        mPendingAddInfo.container = LauncherSettings.Favorites.CONTAINER_DESKTOP;
-        mPendingAddInfo.screen = mWorkspace.getCurrentPage();
-        mWaitingForResult = true;
-        showDialog(DIALOG_CREATE_SHORTCUT);
-    }
-
-    private class RenameFolder {
-        private EditText mInput;
-
-        Dialog createDialog() {
-            final View layout = View.inflate(Launcher.this, R.layout.rename_folder, null);
-            mInput = (EditText) layout.findViewById(R.id.folder_name);
-
-            AlertDialog.Builder builder = new AlertDialog.Builder(Launcher.this);
-            builder.setIcon(0);
-            builder.setTitle(getString(R.string.rename_folder_title));
-            builder.setCancelable(true);
-            builder.setOnCancelListener(new Dialog.OnCancelListener() {
-                public void onCancel(DialogInterface dialog) {
-                    cleanup();
-                }
-            });
-            builder.setNegativeButton(getString(R.string.cancel_action),
-                new Dialog.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int which) {
-                        cleanup();
-                    }
-                }
-            );
-            builder.setPositiveButton(getString(R.string.rename_action),
-                new Dialog.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int which) {
-                        changeFolderName();
-                    }
-                }
-            );
-            builder.setView(layout);
-
-            final AlertDialog dialog = builder.create();
-            dialog.setOnShowListener(new DialogInterface.OnShowListener() {
-                public void onShow(DialogInterface dialog) {
-                    mWaitingForResult = true;
-                    mInput.requestFocus();
-                    InputMethodManager inputManager = (InputMethodManager)
-                            getSystemService(Context.INPUT_METHOD_SERVICE);
-                    inputManager.showSoftInput(mInput, 0);
-                }
-            });
-
-            return dialog;
-        }
-
-        private void changeFolderName() {
-            final String name = mInput.getText().toString();
-            if (!TextUtils.isEmpty(name)) {
-                // Make sure we have the right folder info
-                mFolderInfo = sFolders.get(mFolderInfo.id);
-                mFolderInfo.title = name;
-                LauncherModel.updateItemInDatabase(Launcher.this, mFolderInfo);
-
-                if (mWorkspaceLoading) {
-                    lockAllApps();
-                    mModel.startLoader(false);
-                } else {
-                    final FolderIcon folderIcon = (FolderIcon)
-                            mWorkspace.getViewForTag(mFolderInfo);
-                    if (folderIcon != null) {
-                        // TODO: At some point we'll probably want some version of setting
-                        // the text for a folder icon.
-                        //folderIcon.setText(name);
-                        getWorkspace().requestLayout();
-                    } else {
-                        lockAllApps();
-                        mWorkspaceLoading = true;
-                        mModel.startLoader(false);
-                    }
-                }
-            }
-            cleanup();
-        }
-
-        private void cleanup() {
-            dismissDialog(DIALOG_RENAME_FOLDER);
-            mWaitingForResult = false;
-            mFolderInfo = null;
-        }
-    }
-
     // Now a part of LauncherModel.Callbacks. Used to reorder loading steps.
     public boolean isAllAppsVisible() {
         return (mState == State.APPS_CUSTOMIZE);
@@ -2470,7 +2320,7 @@
                                 }
                             }
                         });
-                        observer.removeGlobalOnLayoutListener(this);
+                        observer.removeOnGlobalLayoutListener(this);
                     }
                 };
                 observer.addOnGlobalLayoutListener(delayedStart);
@@ -2972,83 +2822,6 @@
     }
 
     /**
-     * Displays the shortcut creation dialog and launches, if necessary, the
-     * appropriate activity.
-     */
-    private class CreateShortcut implements DialogInterface.OnClickListener,
-            DialogInterface.OnCancelListener, DialogInterface.OnDismissListener,
-            DialogInterface.OnShowListener {
-
-        private AddAdapter mAdapter;
-
-        Dialog createDialog() {
-            mAdapter = new AddAdapter(Launcher.this);
-
-            final AlertDialog.Builder builder = new AlertDialog.Builder(Launcher.this, 
-                    AlertDialog.THEME_HOLO_DARK);
-            builder.setAdapter(mAdapter, this);
-
-            AlertDialog dialog = builder.create();
-            dialog.setOnCancelListener(this);
-            dialog.setOnDismissListener(this);
-            dialog.setOnShowListener(this);
-
-            return dialog;
-        }
-
-        public void onCancel(DialogInterface dialog) {
-            mWaitingForResult = false;
-            cleanup();
-        }
-
-        public void onDismiss(DialogInterface dialog) {
-            mWaitingForResult = false;
-            cleanup();
-        }
-
-        private void cleanup() {
-            try {
-                dismissDialog(DIALOG_CREATE_SHORTCUT);
-            } catch (Exception e) {
-                // An exception is thrown if the dialog is not visible, which is fine
-            }
-        }
-
-        /**
-         * Handle the action clicked in the "Add to home" dialog.
-         */
-        public void onClick(DialogInterface dialog, int which) {
-            cleanup();
-
-            AddAdapter.ListItem item = (AddAdapter.ListItem) mAdapter.getItem(which);
-            switch (item.actionTag) {
-                case AddAdapter.ITEM_APPLICATION: {
-                    if (mAppsCustomizeTabHost != null) {
-                        mAppsCustomizeTabHost.selectAppsTab();
-                    }
-                    showAllApps(true);
-                    break;
-                }
-                case AddAdapter.ITEM_APPWIDGET: {
-                    if (mAppsCustomizeTabHost != null) {
-                        mAppsCustomizeTabHost.selectWidgetsTab();
-                    }
-                    showAllApps(true);
-                    break;
-                }
-                case AddAdapter.ITEM_WALLPAPER: {
-                    startWallpaper();
-                    break;
-                }
-            }
-        }
-
-        public void onShow(DialogInterface dialog) {
-            mWaitingForResult = true;
-        }
-    }
-
-    /**
      * Receives notifications when system dialogs are to be closed.
      */
     private class CloseSystemDialogsIntentReceiver extends BroadcastReceiver {
@@ -3400,7 +3173,6 @@
      */
     public void bindAppsAdded(ArrayList<ApplicationInfo> apps) {
         setLoadOnResume();
-        removeDialog(DIALOG_CREATE_SHORTCUT);
 
         if (mAppsCustomizeContent != null) {
             mAppsCustomizeContent.addApps(apps);
@@ -3414,7 +3186,6 @@
      */
     public void bindAppsUpdated(ArrayList<ApplicationInfo> apps) {
         setLoadOnResume();
-        removeDialog(DIALOG_CREATE_SHORTCUT);
         if (mWorkspace != null) {
             mWorkspace.updateShortcuts(apps);
         }
@@ -3430,7 +3201,6 @@
      * Implementation of the method from LauncherModel.Callbacks.
      */
     public void bindAppsRemoved(ArrayList<ApplicationInfo> apps, boolean permanent) {
-        removeDialog(DIALOG_CREATE_SHORTCUT);
         if (permanent) {
             mWorkspace.removeItems(apps);
         }
diff --git a/src/com/android/launcher2/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index d73dd30..e34196e 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -21,7 +21,6 @@
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 
 import com.android.launcher.R;
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index ef1eb5f..28362fd 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -25,7 +25,6 @@
 import android.content.res.Configuration;
 import android.database.ContentObserver;
 import android.os.Handler;
-import android.view.MotionEvent;
 
 import com.android.launcher.R;
 
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index d29e2e6..efe4711 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1035,9 +1035,9 @@
                         (LauncherSettings.Favorites.SPANX);
                 final int spanYIndex = c.getColumnIndexOrThrow(
                         LauncherSettings.Favorites.SPANY);
-                final int uriIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
-                final int displayModeIndex = c.getColumnIndexOrThrow(
-                        LauncherSettings.Favorites.DISPLAY_MODE);
+                //final int uriIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
+                //final int displayModeIndex = c.getColumnIndexOrThrow(
+                //        LauncherSettings.Favorites.DISPLAY_MODE);
 
                 ShortcutInfo info;
                 String intentDescription;
@@ -1825,7 +1825,9 @@
     }
 
     Bitmap getIconFromCursor(Cursor c, int iconIndex, Context context) {
-        if (false) {
+        @SuppressWarnings("all") // suppress dead code warning
+        final boolean debug = false;
+        if (debug) {
             Log.d(TAG, "getIconFromCursor app="
                     + c.getString(c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE)));
         }
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index 4149ab6..d2aa31f 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -31,6 +31,7 @@
         void iconPressed(PagedViewIcon icon);
     }
 
+    @SuppressWarnings("unused")
     private static final String TAG = "PagedViewIcon";
     private static final float PRESS_ALPHA = 0.4f;
 
diff --git a/src/com/android/launcher2/RocketLauncher.java b/src/com/android/launcher2/RocketLauncher.java
index 505ac4c..268769d 100644
--- a/src/com/android/launcher2/RocketLauncher.java
+++ b/src/com/android/launcher2/RocketLauncher.java
@@ -332,7 +332,7 @@
         protected void onAttachedToWindow() {
             super.onAttachedToWindow();
             setLayerType(View.LAYER_TYPE_HARDWARE, null);
-            setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
+            setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
 
             reset();
             mAnim.start();
diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java
index 76d7076..30978a8 100644
--- a/src/com/android/launcher2/SearchDropTargetBar.java
+++ b/src/com/android/launcher2/SearchDropTargetBar.java
@@ -246,7 +246,7 @@
                 mQSBSearchBar.setBackgroundResource(0);
             } else if (mPreviousBackground != null && (searchVisible || voiceVisible)) {
                 // Restore the background
-                mQSBSearchBar.setBackgroundDrawable(mPreviousBackground);
+                mQSBSearchBar.setBackground(mPreviousBackground);
             }
         }
     }
diff --git a/src/com/android/launcher2/ShortcutAndWidgetContainer.java b/src/com/android/launcher2/ShortcutAndWidgetContainer.java
index 7e5e940..8bebdcd 100644
--- a/src/com/android/launcher2/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher2/ShortcutAndWidgetContainer.java
@@ -24,8 +24,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 
-import com.android.launcher2.CellLayout.LayoutParams;
-
 public class ShortcutAndWidgetContainer extends ViewGroup {
     static final String TAG = "CellLayoutChildren";
 
@@ -73,8 +71,10 @@
 
     @Override
     protected void dispatchDraw(Canvas canvas) {
-        // Debug drawing for hit space
-        if (false) {
+        @SuppressWarnings("all") // suppress dead code warning
+        final boolean debug = false;
+        if (debug) {
+            // Debug drawing for hit space
             Paint p = new Paint();
             p.setColor(0x6600FF00);
             for (int i = getChildCount() - 1; i >= 0; i--) {
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index 0387011..b27f7bb 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -41,6 +41,7 @@
  * Various utilities shared amongst the Launcher's classes.
  */
 final class Utilities {
+    @SuppressWarnings("unused")
     private static final String TAG = "Launcher.Utilities";
 
     private static int sIconWidth = -1;
@@ -83,7 +84,8 @@
             return icon;
         } else {
             // Icon is too small, render to a larger bitmap
-            return createIconBitmap(new BitmapDrawable(icon), context);
+            final Resources resources = context.getResources();
+            return createIconBitmap(new BitmapDrawable(resources, icon), context);
         }
     }
 
@@ -142,7 +144,9 @@
             final int left = (textureWidth-width) / 2;
             final int top = (textureHeight-height) / 2;
 
-            if (false) {
+            @SuppressWarnings("all") // suppress dead code warning
+            final boolean debug = false;
+            if (debug) {
                 // draw a big box for the icon for debugging
                 canvas.drawColor(sColors[sColorIndex]);
                 if (++sColorIndex >= sColors.length) sColorIndex = 0;
@@ -205,7 +209,8 @@
             if (bitmap.getWidth() == sIconWidth && bitmap.getHeight() == sIconHeight) {
                 return bitmap;
             } else {
-                return createIconBitmap(new BitmapDrawable(bitmap), context);
+                final Resources resources = context.getResources();
+                return createIconBitmap(new BitmapDrawable(resources, bitmap), context);
             }
         }
     }
diff --git a/src/com/android/launcher2/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java
index 8a9d92f..77e1e6f 100644
--- a/src/com/android/launcher2/WallpaperChooser.java
+++ b/src/com/android/launcher2/WallpaperChooser.java
@@ -24,6 +24,7 @@
 import android.os.Bundle;
 
 public class WallpaperChooser extends Activity {
+    @SuppressWarnings("unused")
     private static final String TAG = "Launcher.WallpaperChooser";
 
     @Override
diff --git a/src/com/android/launcher2/WallpaperChooserDialogFragment.java b/src/com/android/launcher2/WallpaperChooserDialogFragment.java
index eec699e..b99d8ec 100644
--- a/src/com/android/launcher2/WallpaperChooserDialogFragment.java
+++ b/src/com/android/launcher2/WallpaperChooserDialogFragment.java
@@ -137,7 +137,7 @@
          */
         if (mEmbedded) {
             View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
-            view.setBackgroundDrawable(mWallpaperDrawable);
+            view.setBackground(mWallpaperDrawable);
 
             final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
             gallery.setCallbackDuringFling(false);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 86f4611..d2f050c 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -26,7 +26,6 @@
 import android.appwidget.AppWidgetHostView;
 import android.appwidget.AppWidgetManager;
 import android.appwidget.AppWidgetProviderInfo;
-import android.content.ClipDescription;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -35,40 +34,32 @@
 import android.graphics.Bitmap;
 import android.graphics.Camera;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.Region.Op;
-import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.IBinder;
 import android.os.Parcelable;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.Log;
-import android.util.Pair;
 import android.view.Display;
-import android.view.DragEvent;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.animation.AccelerateInterpolator;
 import android.view.animation.DecelerateInterpolator;
 import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.android.launcher.R;
-import com.android.launcher2.DropTarget.DragObject;
 import com.android.launcher2.FolderIcon.FolderRingAnimator;
-import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
 import com.android.launcher2.LauncherSettings.Favorites;
 
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 
 /**
  * The workspace is a wide area with a wallpaper and a finite number of pages.
@@ -78,7 +69,6 @@
 public class Workspace extends SmoothPagedView
         implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
         DragController.DragListener, LauncherTransitionable {
-    @SuppressWarnings({"UnusedDeclaration"})
     private static final String TAG = "Launcher.Workspace";
 
     // Y rotation to apply to the workspace screens
@@ -144,8 +134,6 @@
      */
     private CellLayout mDropToLayout = null;
 
-    private boolean mDragHasEnteredWorkspace = false;
-
     private Launcher mLauncher;
     private IconCache mIconCache;
     private DragController mDragController;
@@ -200,8 +188,7 @@
     boolean mUpdateWallpaperOffsetImmediately = false;
     private Runnable mDelayedResizeRunnable;
     private Runnable mDelayedSnapToPageRunnable;
-    private int mDisplayWidth;
-    private int mDisplayHeight;
+    private Point mDisplaySize = new Point();
     private boolean mIsStaticWallpaper;
     private int mWallpaperTravelWidth;
 
@@ -416,10 +403,9 @@
 
         mWallpaperOffset = new WallpaperOffsetInterpolator();
         Display display = mLauncher.getWindowManager().getDefaultDisplay();
-        mDisplayWidth = display.getWidth();
-        mDisplayHeight = display.getHeight();
-        mWallpaperTravelWidth = (int) (mDisplayWidth *
-                wallpaperTravelToScreenWidthRatio(mDisplayWidth, mDisplayHeight));
+        display.getSize(mDisplaySize);
+        mWallpaperTravelWidth = (int) (mDisplaySize.x *
+                wallpaperTravelToScreenWidthRatio(mDisplaySize.x, mDisplaySize.y));
 
         mMaxDistanceForFolderCreation = (0.6f * res.getDimensionPixelSize(R.dimen.app_icon_size));
         mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
@@ -967,7 +953,7 @@
                 mIsMovingFast = false;
                 return false;
             }
-            boolean isLandscape = mDisplayWidth > mDisplayHeight;
+            boolean isLandscape = mDisplaySize.x > mDisplaySize.y;
 
             long currentTime = System.currentTimeMillis();
             long timeSinceLastUpdate = currentTime - mLastWallpaperOffsetUpdateTime;
@@ -2408,7 +2394,6 @@
 
     public void onDragEnter(DragObject d) {
         mDragEnforcer.onDragEnter();
-        mDragHasEnteredWorkspace = true;
         mCreateUserFolderOnDrop = false;
         mAddToExistingFolderOnDrop = false;
 
@@ -2426,7 +2411,6 @@
 
     public void onDragExit(DragObject d) {
         mDragEnforcer.onDragExit();
-        mDragHasEnteredWorkspace = false;
 
         // Here we store the final page that will be dropped to, if the workspace in fact
         // receives the drop
@@ -2536,30 +2520,6 @@
         return null;
     }
 
-    /**
-     * Tests to see if the drop will be accepted by Launcher, and if so, includes additional data
-     * in the returned structure related to the widgets that match the drop (or a null list if it is
-     * a shortcut drop).  If the drop is not accepted then a null structure is returned.
-     */
-    private Pair<Integer, List<WidgetMimeTypeHandlerData>> validateDrag(DragEvent event) {
-        final LauncherModel model = mLauncher.getModel();
-        final ClipDescription desc = event.getClipDescription();
-        final int mimeTypeCount = desc.getMimeTypeCount();
-        for (int i = 0; i < mimeTypeCount; ++i) {
-            final String mimeType = desc.getMimeType(i);
-            if (mimeType.equals(InstallShortcutReceiver.SHORTCUT_MIMETYPE)) {
-                return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, null);
-            } else {
-                final List<WidgetMimeTypeHandlerData> widgets =
-                    model.resolveWidgetsForMimeType(mContext, mimeType);
-                if (widgets.size() > 0) {
-                    return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, widgets);
-                }
-            }
-        }
-        return null;
-    }
-
     /*
     *
     * Convert the 2D coordinate xy from the parent View's coordinate space to this CellLayout's
@@ -2992,7 +2952,7 @@
     public void getHitRect(Rect outRect) {
         // We want the workspace to have the whole area of the display (it will find the correct
         // cell layout to drop to in the existing drag/drop logic.
-        outRect.set(0, 0, mDisplayWidth, mDisplayHeight);
+        outRect.set(0, 0, mDisplaySize.x, mDisplaySize.y);
     }
 
     /**