Cleaning up LauncherModel

- performing all DB operations immediately if called from worker thread (a previous change that did this in updateItemInDatabase fixed an outstanding bug)
- centralizing logic to do database updates
- removing old logging code

Change-Id: Idc7bfef3921828ff7c5492b8e996c0a07e1ec508
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index d3e0963..878cc27 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -1014,8 +1014,9 @@
             if (rawInfo instanceof AppWidgetProviderInfo) {
                 // Fill in the widget information
                 AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo;
-                createItemInfo = new PendingAddWidgetInfo(info, null, null, "13");
-                int[] cellSpans = mLauncher.getSpanForWidget(info, null);
+                createItemInfo = new PendingAddWidgetInfo(info, null, null);
+                int[] cellSpans = CellLayout.rectToCell(getResources(),
+                        info.minWidth, info.minHeight, null);
                 FastBitmapDrawable preview = new FastBitmapDrawable(data.generatedImages.get(i));
                 widget.applyFromAppWidgetProviderInfo(info, preview, -1, cellSpans, 
                         mHolographicOutlineHelper);
@@ -1023,7 +1024,7 @@
             } else if (rawInfo instanceof ResolveInfo) {
                 // Fill in the shortcuts information
                 ResolveInfo info = (ResolveInfo) rawInfo;
-                createItemInfo = new PendingAddItemInfo("14");
+                createItemInfo = new PendingAddItemInfo();
                 createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
                 createItemInfo.componentName = new ComponentName(info.activityInfo.packageName,
                         info.activityInfo.name);