Ensuring that unbind calls are not queued in the worker thread and executed subsequently on the main thread.  (Bug 7001531)

Change-Id: I677242c0952d6385ca229ba300fdd5a2a7908a8a
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1e138f7..2fcf869 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1486,8 +1486,11 @@
 
         TextKeyListener.getInstance().release();
 
-
-        unbindWorkspaceAndHotseatItems();
+        // Disconnect any of the callbacks and drawables associated with ItemInfos on the workspace
+        // to prevent leaking Launcher activities on orientation change.
+        if (mModel != null) {
+            mModel.unbindItemInfosAndClearQueuedBindRunnables();
+        }
 
         getContentResolver().unregisterContentObserver(mWidgetObserver);
         unregisterReceiver(mCloseSystemDialogsReceiver);
@@ -1878,16 +1881,6 @@
     }
 
     /**
-     * Go through the and disconnect any of the callbacks in the drawables and the views or we
-     * leak the previous Home screen on orientation change.
-     */
-    private void unbindWorkspaceAndHotseatItems() {
-        if (mModel != null) {
-            mModel.unbindWorkspaceItems();
-        }
-    }
-
-    /**
      * Launches the intent referred by the clicked shortcut.
      *
      * @param v The view representing the clicked shortcut.