merge in jb-mr1-release history after reset to jb-mr1-dev
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 817eb41..609bb6d 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -628,7 +628,10 @@
 
     private void preloadWidget(final PendingAddWidgetInfo info) {
         final AppWidgetProviderInfo pInfo = info.info;
+        final Bundle options = getDefaultOptionsForWidget(mLauncher, info);
+
         if (pInfo.configure != null) {
+            info.bindOptions = options;
             return;
         }
 
@@ -637,8 +640,6 @@
             @Override
             public void run() {
                 mWidgetLoadingId = mLauncher.getAppWidgetHost().allocateAppWidgetId();
-
-                Bundle options = getDefaultOptionsForWidget(mLauncher, info);
                 // Options will be null for platforms with JB or lower, so this serves as an
                 // SDK level check.
                 if (options == null) {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 4ae9c7d..3fdf5c3 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1746,13 +1746,25 @@
             // In this case, we either need to start an activity to get permission to bind
             // the widget, or we need to start an activity to configure the widget, or both.
             appWidgetId = getAppWidgetHost().allocateAppWidgetId();
-            if (mAppWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, info.componentName)) {
+            Bundle options = info.bindOptions;
+
+            boolean success = false;
+            if (options != null) {
+                success = mAppWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
+                        info.componentName, options);
+            } else {
+                success = mAppWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
+                        info.componentName);
+            }
+            if (success) {
                 addAppWidgetImpl(appWidgetId, info, null, info.info);
             } else {
                 mPendingAddWidgetInfo = info.info;
                 Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
                 intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
                 intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, info.componentName);
+                // TODO: we need to make sure that this accounts for the options bundle.
+                // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
                 startActivityForResult(intent, REQUEST_BIND_APPWIDGET);
             }
         }
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index e197b35..7302310 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -341,10 +341,8 @@
                             // the list of Folders.
                             String msg = "item: " + item + " container being set to: " +
                                     item.container + ", not in the list of folders";
-                            RuntimeException e = new RuntimeException(msg);
-                            e.setStackTrace(stackTrace);
+                            Log.e(TAG, msg);
                             Launcher.dumpDebugLogsToConsole();
-                            throw e;
                         }
                     }
 
@@ -611,10 +609,8 @@
                                     // Adding an item to a folder that doesn't exist.
                                     String msg = "adding item: " + item + " to a folder that " +
                                             " doesn't exist";
-                                    RuntimeException e = new RuntimeException(msg);
-                                    e.setStackTrace(stackTrace);
+                                    Log.e(TAG, msg);
                                     Launcher.dumpDebugLogsToConsole();
-                                    throw e;
                                 }
                             }
                             break;
@@ -662,7 +658,6 @@
     static void deleteItemFromDatabase(Context context, final ItemInfo item) {
         final ContentResolver cr = context.getContentResolver();
         final Uri uriToDelete = LauncherSettings.Favorites.getContentUri(item.id, false);
-        final StackTraceElement[] stackTrace = new Throwable().getStackTrace();
 
         Runnable r = new Runnable() {
             public void run() {
@@ -685,10 +680,8 @@
                                     // think they are contained by that folder.
                                     String msg = "deleting a folder (" + item + ") which still " +
                                             "contains items (" + info + ")";
-                                    RuntimeException e = new RuntimeException(msg);
-                                    e.setStackTrace(stackTrace);
+                                    Log.e(TAG, msg);
                                     Launcher.dumpDebugLogsToConsole();
-                                    throw e;
                                 }
                             }
                             sBgWorkspaceItems.remove(item);
diff --git a/src/com/android/launcher2/PendingAddItemInfo.java b/src/com/android/launcher2/PendingAddItemInfo.java
index 9a133ed..a1e7b06 100644
--- a/src/com/android/launcher2/PendingAddItemInfo.java
+++ b/src/com/android/launcher2/PendingAddItemInfo.java
@@ -20,6 +20,7 @@
 import android.appwidget.AppWidgetProviderInfo;
 import android.content.ComponentName;
 import android.content.pm.ActivityInfo;
+import android.os.Bundle;
 import android.os.Parcelable;
 
 /**
@@ -55,6 +56,7 @@
     int icon;
     AppWidgetProviderInfo info;
     AppWidgetHostView boundWidget;
+    Bundle bindOptions = null;
 
     // Any configuration data that we want to pass to a configuration activity when
     // starting up a widget
@@ -95,6 +97,7 @@
         spanY = copy.spanY;
         minSpanX = copy.minSpanX;
         minSpanY = copy.minSpanY;
+        bindOptions = copy.bindOptions == null ? null : (Bundle) copy.bindOptions.clone();
     }
 
     @Override