merge in jb-release history after reset to jb-dev
diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml
index a701e69..00b2e15 100644
--- a/res/values-sw600dp/config.xml
+++ b/res/values-sw600dp/config.xml
@@ -1,4 +1,6 @@
 <resources>
+    <bool name="allow_rotation">true</bool>
+
     <integer name="cell_count_x">6</integer>
     <integer name="cell_count_y">6</integer>
     <integer name="hotseat_cell_count">7</integer>
diff --git a/res/values/config.xml b/res/values/config.xml
index 2a75af8..1890125 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -2,6 +2,7 @@
     <bool name="config_hardwareAccelerated">true</bool>
     <bool name="config_largeHeap">false</bool>
     <bool name="is_large_screen">false</bool>
+    <bool name="allow_rotation">false</bool>
 
 <!-- AllApps/Customize/AppsCustomize -->
     <!-- The alpha of the AppsCustomize bg in spring loaded mode -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f707c8c..7e9d12c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -81,8 +81,10 @@
     <string name="group_widgets">Widgets</string>
     <!-- Options in "Add to Home" dialog box; Title of the group containing the list of apps that can set the wallpaper-->
     <string name="group_wallpapers">Wallpapers</string>
-    <!-- Error message when user has filled a home screen, possibly not used -->
-    <string name="out_of_space">No more room on your Home screens.</string>
+    <!-- Error message when user has filled all their home screens -->
+    <string name="completely_out_of_space">No more room on your Home screens.</string>
+    <!-- Error message when user has filled a home screen -->
+    <string name="out_of_space">No more room on this Home screen.</string>
     <!-- Error message when user has filled the hotseat -->
     <string name="hotseat_out_of_space">No more room on the hotseat.</string>
     <!-- Error message when user tries to drop an invalid item on the hotseat -->
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 35bdf14..2935cea 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -518,12 +518,18 @@
         if (v instanceof PagedViewIcon) {
             // Animate some feedback to the click
             final ApplicationInfo appInfo = (ApplicationInfo) v.getTag();
-            mLauncher.startActivitySafely(appInfo.intent, appInfo);
 
             // Lock the drawable state to pressed until we return to Launcher
             if (mPressedIcon != null) {
                 mPressedIcon.lockDrawableState();
             }
+
+            // NOTE: we need to re-enable the wallpaper visibility if we want correct transitions
+            // between items that are launched from the workspace and all apps.  It will be disabled
+            // correctly the next time the window is visible in AppsCustomizeTabHost.
+            mLauncher.updateWallpaperVisibility(true);
+            mLauncher.startActivitySafely(v, appInfo.intent, appInfo);
+
         } else if (v instanceof PagedViewWidget) {
             // Let the user know that they have to long press to add a widget
             Toast.makeText(getContext(), R.string.long_press_widget_to_add,
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 0c5bbeb..21842da 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -57,6 +57,8 @@
     private boolean mResetAfterTransition;
     private Runnable mRelayoutAndMakeVisible;
 
+    private Launcher mLauncher;
+
     public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
         super(context, attrs);
         mLayoutInflater = LayoutInflater.from(context);
@@ -68,6 +70,10 @@
             };
     }
 
+    public void setup(Launcher launcher) {
+        mLauncher = launcher;
+    }
+
     /**
      * Convenience methods to select specific tabs.  We want to set the content type immediately
      * in these cases, but we note that we still call setCurrentTabByTag() so that the tab view
@@ -463,6 +469,17 @@
             // Load the current page synchronously, and the neighboring pages asynchronously
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
+
+            // We had to enable the wallpaper visibility when launching apps from all apps (so that
+            // the transitions would be the same as when launching from workspace) so we need to
+            // re-disable the wallpaper visibility to ensure performance.
+            int duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
+            postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    mLauncher.updateWallpaperVisibility(false);
+                }
+            }, duration);
         }
     }
 
diff --git a/src/com/android/launcher2/DropTarget.java b/src/com/android/launcher2/DropTarget.java
index 397d462..d627a4c 100644
--- a/src/com/android/launcher2/DropTarget.java
+++ b/src/com/android/launcher2/DropTarget.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.graphics.PointF;
 import android.graphics.Rect;
+import android.util.Log;
 
 /**
  * Interface defining an object that can receive a drag.
@@ -26,6 +27,8 @@
  */
 public interface DropTarget {
 
+    public static final String TAG = "DropTarget";
+
     class DragObject {
         public int x = -1;
         public int y = -1;
@@ -75,28 +78,28 @@
         void onDragEnter() {
             dragParity++;
             if (dragParity != 1) {
-                throw new RuntimeException("onDragEnter: Drag contract violated: " + dragParity);
+                Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
             }
         }
 
         void onDragExit() {
             dragParity--;
             if (dragParity != 0) {
-                throw new RuntimeException("onDragExit: Drag contract violated: " + dragParity);
+                Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
             }
         }
 
         @Override
         public void onDragStart(DragSource source, Object info, int dragAction) {
             if (dragParity != 0) {
-                throw new RuntimeException("onDragEnter: Drag contract violated: " + dragParity);
+                Log.e(TAG, "onDragEnter: Drag contract violated: " + dragParity);
             }
         }
 
         @Override
         public void onDragEnd() {
             if (dragParity != 0) {
-                throw new RuntimeException("onDragExit: Drag contract violated: " + dragParity);
+                Log.e(TAG, "onDragExit: Drag contract violated: " + dragParity);
             }
         }
     }
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index fcaf020..01939f8 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -194,7 +194,8 @@
             v.getLocationOnScreen(pos);
             item.intent.setSourceBounds(new Rect(pos[0], pos[1],
                     pos[0] + v.getWidth(), pos[1] + v.getHeight()));
-            mLauncher.startActivitySafely(item.intent, item);
+
+            mLauncher.startActivitySafely(v, item.intent, item);
         }
     }
 
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index 19b1c69..eda82e0 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -97,7 +97,7 @@
         // will provide feedback otherwise
         if (!found) {
             if (result[0] == INSTALL_SHORTCUT_NO_SPACE) {
-                Toast.makeText(context, context.getString(R.string.out_of_space),
+                Toast.makeText(context, context.getString(R.string.completely_out_of_space),
                         Toast.LENGTH_SHORT).show();
             } else if (result[0] == INSTALL_SHORTCUT_IS_DUPLICATE) {
                 Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name),
@@ -174,8 +174,8 @@
                     cellY = item.cellY;
                     spanX = item.spanX;
                     spanY = item.spanY;
-                    for (int x = cellX; x < cellX + spanX && x < xCount; x++) {
-                        for (int y = cellY; y < cellY + spanY && y < yCount; y++) {
+                    for (int x = cellX; 0 <= x && x < cellX + spanX && x < xCount; x++) {
+                        for (int y = cellY; 0 <= y && y < cellY + spanY && y < yCount; y++) {
                             occupied[x][y] = true;
                         }
                     }
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 5965b5c..e2b86a4 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -26,6 +26,7 @@
 import android.animation.ValueAnimator.AnimatorUpdateListener;
 import android.app.Activity;
 import android.app.ActivityManager;
+import android.app.ActivityOptions;
 import android.app.SearchManager;
 import android.appwidget.AppWidgetHostView;
 import android.appwidget.AppWidgetManager;
@@ -377,11 +378,13 @@
         }
         mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
 
-        final String forceEnableRotation = 
+        final String forceEnableRotation =
                 SystemProperties.get(FORCE_ENABLE_ROTATION_PROPERTY, "false");
 
+        boolean enableRotation = getResources().getBoolean(R.bool.allow_rotation);
+
         // On large interfaces, we want the screen to auto-rotate based on the current orientation
-        if (LauncherApplication.isScreenLarge() || "true".equalsIgnoreCase(forceEnableRotation)) {
+        if (enableRotation || "true".equalsIgnoreCase(forceEnableRotation)) {
             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
         }
     }
@@ -828,6 +831,7 @@
                 findViewById(R.id.apps_customize_pane);
         mAppsCustomizeContent = (AppsCustomizePagedView)
                 mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
+        mAppsCustomizeTabHost.setup(this);
         mAppsCustomizeContent.setup(this, dragController);
 
         // Get the all apps button
@@ -1766,7 +1770,8 @@
             v.getLocationOnScreen(pos);
             intent.setSourceBounds(new Rect(pos[0], pos[1],
                     pos[0] + v.getWidth(), pos[1] + v.getHeight()));
-            boolean success = startActivitySafely(intent, tag);
+
+            boolean success = startActivitySafely(v, intent, tag);
 
             if (success && v instanceof BubbleTextView) {
                 mWaitingForResume = (BubbleTextView) v;
@@ -1814,7 +1819,7 @@
 
         Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-        startActivity(intent);
+        startActivitySafely(null, intent, "onClickVoiceButton");
     }
 
     /**
@@ -1834,7 +1839,7 @@
 
     public void onClickAppMarketButton(View v) {
         if (mAppMarketIntent != null) {
-            startActivitySafely(mAppMarketIntent, "app market");
+            startActivitySafely(v, mAppMarketIntent, "app market");
         } else {
             Log.e(TAG, "Invalid app market intent.");
         }
@@ -1845,7 +1850,7 @@
         Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                 Uri.fromParts("package", packageName, null));
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-        startActivity(intent);
+        startActivitySafely(null, intent, "startApplicationDetailsActivity");
     }
 
     void startApplicationUninstallActivity(ApplicationInfo appInfo) {
@@ -1865,10 +1870,18 @@
         }
     }
 
-    boolean startActivitySafely(Intent intent, Object tag) {
+    boolean startActivitySafely(View v, Intent intent, Object tag) {
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
         try {
-            startActivity(intent);
+            if (v != null) {
+                ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0,
+                        v.getMeasuredWidth(), v.getMeasuredHeight());
+
+                startActivity(intent, opts.toBundle());
+            } else {
+                startActivity(intent);
+            }
             return true;
         } catch (ActivityNotFoundException e) {
             Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
@@ -2442,7 +2455,7 @@
     @Override
     public void onTrimMemory(int level) {
         super.onTrimMemory(level);
-        if (level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
+        if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
             mAppsCustomizeTabHost.onTrimMemory();
         }
     }
@@ -2731,6 +2744,7 @@
         final View searchDivider = findViewById(R.id.search_divider);
         final View voiceButtonContainer = findViewById(R.id.voice_button_container);
         final View voiceButton = findViewById(R.id.voice_button);
+        final View voiceButtonProxy = findViewById(R.id.voice_button_proxy);
 
         final SearchManager searchManager =
                 (SearchManager) getSystemService(Context.SEARCH_SERVICE);
@@ -2751,6 +2765,7 @@
             if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE);
             searchButton.setVisibility(View.GONE);
             voiceButton.setVisibility(View.GONE);
+            voiceButtonProxy.setVisibility(View.GONE);
             return false;
         }
     }
@@ -2766,6 +2781,7 @@
         final View searchDivider = findViewById(R.id.search_divider);
         final View voiceButtonContainer = findViewById(R.id.voice_button_container);
         final View voiceButton = findViewById(R.id.voice_button);
+        final View voiceButtonProxy = findViewById(R.id.voice_button_proxy);
 
         // We only show/update the voice search icon if the search icon is enabled as well
         Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
@@ -2777,12 +2793,18 @@
             if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE);
             if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.VISIBLE);
             voiceButton.setVisibility(View.VISIBLE);
+            if (voiceButtonProxy != null) {
+                voiceButtonProxy.setVisibility(View.VISIBLE);
+            }
             invalidatePressedFocusedStates(voiceButtonContainer, voiceButton);
             return true;
         } else {
             if (searchDivider != null) searchDivider.setVisibility(View.GONE);
             if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE);
             voiceButton.setVisibility(View.GONE);
+            if (voiceButtonProxy != null) {
+                voiceButtonProxy.setVisibility(View.GONE);
+            }
             return false;
         }
     }