Clean up unused code

Change-Id: Ie1e927aa0b5304f62cfffaab449abb3133870f80
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 346c0c3..02958d0 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -19,7 +19,6 @@
     private LauncherAppWidgetHostView mWidgetView;
     private CellLayout mCellLayout;
     private DragLayer mDragLayer;
-    private Workspace mWorkspace;
     private ImageView mLeftHandle;
     private ImageView mRightHandle;
     private ImageView mTopHandle;
@@ -83,7 +82,6 @@
         mWidgetView = widgetView;
         mResizeMode = widgetView.getAppWidgetInfo().resizeMode;
         mDragLayer = dragLayer;
-        mWorkspace = (Workspace) dragLayer.findViewById(R.id.workspace);
 
         final AppWidgetProviderInfo info = widgetView.getAppWidgetInfo();
         int[] result = Launcher.getMinSpanForWidget(mLauncher, info);
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 899b1f2..09a5712 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -355,9 +355,6 @@
             mWidgetPreviewLoader = new WidgetPreviewLoader(mLauncher);
         }
 
-        // Note that we transpose the counts in portrait so that we get a similar layout
-        boolean isLandscape = getResources().getConfiguration().orientation ==
-            Configuration.ORIENTATION_LANDSCAPE;
         int maxCellCountX = Integer.MAX_VALUE;
         int maxCellCountY = Integer.MAX_VALUE;
         if (mMaxAppCellCountX > -1) {
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 3c41804..0a0452d 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -622,8 +622,6 @@
         // Hotseat icons - remove text
         if (child instanceof BubbleTextView) {
             BubbleTextView bubbleChild = (BubbleTextView) child;
-
-            Resources res = getResources();
             bubbleChild.setTextVisibility(!mIsHotseat);
         }
 
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 0a56117..3fbb40c 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -205,7 +205,6 @@
 
     void updateFromConfiguration(Resources resources, int wPx, int hPx,
                                  int awPx, int ahPx) {
-        DisplayMetrics dm = resources.getDisplayMetrics();
         isLandscape = (resources.getConfiguration().orientation ==
                 Configuration.ORIENTATION_LANDSCAPE);
         isTablet = resources.getBoolean(R.bool.is_tablet);
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 3aa9133..f57ff07 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -85,8 +85,6 @@
     private FolderIcon mFolderIcon;
     private int mMaxCountX;
     private int mMaxCountY;
-    private int mMaxVisibleX;
-    private int mMaxVisibleY;
     private int mMaxNumItems;
     private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
     private Drawable mIconDrawable;
@@ -145,8 +143,7 @@
         mIconCache = app.getIconCache();
 
         Resources res = getResources();
-        mMaxCountX = mMaxVisibleX = (int) grid.numColumns;
-        mMaxVisibleY = (int) grid.numRows;
+        mMaxCountX = (int) grid.numColumns;
         mMaxCountY = mMaxNumItems = Integer.MAX_VALUE;
 
         mInputMethodManager = (InputMethodManager)
@@ -175,9 +172,6 @@
 
         LauncherAppState app = LauncherAppState.getInstance();
         DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
-        Rect padding = grid.getWorkspacePadding(grid.isLandscape ?
-                CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
-        DisplayMetrics dm = getResources().getDisplayMetrics();
 
         mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
         mContent.setGridSize(0, 0);
diff --git a/src/com/android/launcher3/HolographicImageView.java b/src/com/android/launcher3/HolographicImageView.java
index ce50db1..18ac092 100644
--- a/src/com/android/launcher3/HolographicImageView.java
+++ b/src/com/android/launcher3/HolographicImageView.java
@@ -24,8 +24,6 @@
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.View.OnFocusChangeListener;
-import android.view.View.OnTouchListener;
 import android.widget.ImageView;
 
 public class HolographicImageView extends ImageView {
diff --git a/src/com/android/launcher3/HolographicLinearLayout.java b/src/com/android/launcher3/HolographicLinearLayout.java
index cdf4381..5344a7e 100644
--- a/src/com/android/launcher3/HolographicLinearLayout.java
+++ b/src/com/android/launcher3/HolographicLinearLayout.java
@@ -24,8 +24,6 @@
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.View.OnFocusChangeListener;
-import android.view.View.OnTouchListener;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index d28e96f..2d3adf6 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -18,23 +18,16 @@
 
 import android.content.ComponentName;
 import android.content.Context;
-import android.content.Intent;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.content.res.TypedArray;
 import android.util.AttributeSet;
-import android.view.LayoutInflater;
 import android.util.Log;
-import android.view.MotionEvent;
 import android.view.View;
 import android.widget.FrameLayout;
 
-import com.android.launcher3.R;
-
 import java.util.ArrayList;
 
 public class Hotseat extends FrameLayout {
-    @SuppressWarnings("unused")
     private static final String TAG = "Hotseat";
 
     private CellLayout mContent;
@@ -55,8 +48,6 @@
     public Hotseat(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
-        TypedArray a = context.obtainStyledAttributes(attrs,
-                R.styleable.Hotseat, defStyle, 0);
         Resources r = context.getResources();
         mTransposeLayoutWithOrientation = 
                 r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
@@ -155,7 +146,6 @@
 
         FolderInfo info = fi.getFolderInfo();
         for (ApplicationInfo a: apps) {
-            ComponentName cn = a.intent.getComponent();
             ShortcutInfo si = a.makeShortcut();
             info.add(si);
         }
diff --git a/src/com/android/launcher3/InstallWidgetReceiver.java b/src/com/android/launcher3/InstallWidgetReceiver.java
index d802df2..0ef4780 100644
--- a/src/com/android/launcher3/InstallWidgetReceiver.java
+++ b/src/com/android/launcher3/InstallWidgetReceiver.java
@@ -77,18 +77,15 @@
         private String mMimeType;
         private ClipData mClipData;
         private List<WidgetMimeTypeHandlerData> mActivities;
-        private CellLayout mTargetLayout;
         private int mTargetLayoutScreen;
         private int[] mTargetLayoutPos;
 
         public WidgetListAdapter(Launcher l, String mimeType, ClipData data,
-                List<WidgetMimeTypeHandlerData> list, CellLayout target,
-                int targetScreen, int[] targetPos) {
+                List<WidgetMimeTypeHandlerData> list, int targetScreen, int[] targetPos) {
             mLauncher = l;
             mMimeType = mimeType;
             mClipData = data;
             mActivities = list;
-            mTargetLayout = target;
             mTargetLayoutScreen = targetScreen;
             mTargetLayoutPos = targetPos;
         }
@@ -149,7 +146,7 @@
             // Set the text
             final CharSequence component = resolveInfo.loadLabel(packageManager);
             final int[] widgetSpan = new int[2];
-            mTargetLayout.rectToCell(widgetInfo.minWidth, widgetInfo.minHeight, widgetSpan);
+            CellLayout.rectToCell(widgetInfo.minWidth, widgetInfo.minHeight, widgetSpan);
             TextView t = (TextView) convertView.findViewById(R.id.provider);
             t.setText(context.getString(R.string.external_drop_widget_pick_format,
                     component, widgetSpan[0], widgetSpan[1]));
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index c8b208b..ed96310 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -42,7 +42,6 @@
     private static WeakReference<LauncherProvider> sLauncherProvider;
     private static Context sContext;
 
-    private static Object mLock = new Object();
     private static LauncherAppState INSTANCE;
 
     private DynamicGrid mDynamicGrid;
@@ -167,12 +166,10 @@
     DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight,
                                   int width, int height,
                                   int availableWidth, int availableHeight) {
-        boolean created = false;
         if (mDynamicGrid == null) {
             mDynamicGrid = new DynamicGrid(context.getResources(),
                     minWidth, minHeight, width, height,
                     availableWidth, availableHeight);
-            created = true;
         }
 
         // Update the icon size
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index c1754b4..c76b553 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -318,8 +318,7 @@
                         Pair<Long, int[]> coords = LauncherModel.findNextAvailableIconSpace(context,
                                 name, launchIntent, startSearchPageIndex, workspaceScreens);
                         if (coords == null) {
-                            LauncherAppState appState = LauncherAppState.getInstance();
-                            LauncherProvider lp = appState.getLauncherProvider();
+                            LauncherProvider lp = LauncherAppState.getLauncherProvider();
 
                             // If we can't find a valid position, then just add a new screen.
                             // This takes time so we need to re-queue the add until the new
@@ -864,8 +863,7 @@
         final ContentResolver cr = context.getContentResolver();
         item.onAddToDatabase(values);
 
-        LauncherAppState app = LauncherAppState.getInstance();
-        item.id = app.getLauncherProvider().generateNewItemId();
+        item.id = LauncherAppState.getLauncherProvider().generateNewItemId();
         values.put(LauncherSettings.Favorites._ID, item.id);
         item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
 
@@ -1427,7 +1425,6 @@
             // Optimize for end-user experience: if the Launcher is up and // running with the
             // All Apps interface in the foreground, load All Apps first. Otherwise, load the
             // workspace first (default).
-            final Callbacks cbk = mCallbacks.get();
             keep_running: {
                 // Elevate priority when Home launches for the first time to avoid
                 // starving at boot time. Staring at a blank home is not cool.
@@ -1636,10 +1633,10 @@
             int countY = (int) grid.numRows;
 
             // Make sure the default workspace is loaded, if needed
-            mApp.getLauncherProvider().loadDefaultFavoritesIfNecessary(0);
+            LauncherAppState.getLauncherProvider().loadDefaultFavoritesIfNecessary(0);
 
             // Check if we need to do any upgrade-path logic
-            boolean loadedOldDb = mApp.getLauncherProvider().justLoadedOldDb();
+            boolean loadedOldDb = LauncherAppState.getLauncherProvider().justLoadedOldDb();
 
             synchronized (sBgLock) {
                 sBgWorkspaceItems.clear();
@@ -1812,7 +1809,6 @@
 
                                 // Skip loading items that are out of bounds
                                 if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
-                                    int iconSpan = 1;
                                     if (checkItemDimensions(folderInfo)) {
                                         Log.d(TAG, "Skipped loading out of bounds folder");
                                         continue;
@@ -1938,7 +1934,7 @@
                         Log.w(TAG, "10249126\t- " + l);
                     }
 
-                    mApp.getLauncherProvider().updateMaxScreenId(maxScreenId);
+                    LauncherAppState.getLauncherProvider().updateMaxScreenId(maxScreenId);
                     updateWorkspaceScreenOrder(context, sBgWorkspaceScreens);
 
                     // Update the max item id after we load an old db
@@ -1947,7 +1943,7 @@
                     for (ItemInfo item: sBgItemsIdMap.values()) {
                         maxItemId = Math.max(maxItemId, item.id);
                     }
-                    app.getLauncherProvider().updateMaxItemId(maxItemId);
+                    LauncherAppState.getLauncherProvider().updateMaxItemId(maxItemId);
                 } else {
                     Log.w(TAG, "10249126 - loadWorkspace - !loadedOldDb");
                     TreeMap<Integer, Long> orderedScreens = loadWorkspaceScreensDb(mContext);
@@ -2422,7 +2418,6 @@
             }
 
             // Create the ApplicationInfos
-            final long addTime = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;
             for (int i = 0; i < apps.size(); i++) {
                 // This builds the icon bitmaps.
                 mBgAllAppsList.add(new ApplicationInfo(packageManager, apps.get(i),
diff --git a/src/com/android/launcher3/MemoryTracker.java b/src/com/android/launcher3/MemoryTracker.java
index 0a796a2..2d37c80 100644
--- a/src/com/android/launcher3/MemoryTracker.java
+++ b/src/com/android/launcher3/MemoryTracker.java
@@ -20,7 +20,6 @@
 import android.app.Service;
 import android.content.Context;
 import android.content.Intent;
-import android.net.Uri;
 import android.os.*;
 import android.util.Log;
 import android.util.LongSparseArray;
diff --git a/src/com/android/launcher3/UninstallShortcutReceiver.java b/src/com/android/launcher3/UninstallShortcutReceiver.java
index 2e1ed69..d92963a 100644
--- a/src/com/android/launcher3/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher3/UninstallShortcutReceiver.java
@@ -20,16 +20,13 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.net.Uri;
 import android.widget.Toast;
 
 import java.net.URISyntaxException;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Set;
 
 public class UninstallShortcutReceiver extends BroadcastReceiver {
     private static final String ACTION_UNINSTALL_SHORTCUT =
diff --git a/src/com/android/launcher3/UserInitializeReceiver.java b/src/com/android/launcher3/UserInitializeReceiver.java
index 9ccefe4..d8e17b1 100644
--- a/src/com/android/launcher3/UserInitializeReceiver.java
+++ b/src/com/android/launcher3/UserInitializeReceiver.java
@@ -16,16 +16,9 @@
 
 package com.android.launcher3;
 
-import java.io.IOException;
-import java.util.ArrayList;
-
-import com.android.launcher3.R;
-
-import android.app.WallpaperManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Resources;
 
 /**
  * Takes care of setting initial wallpaper for a user, by selecting the