am 81304325: Reconcile with ics-mr1-release

* commit '81304325161a14e9f9908def807114b33b13dce6':
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index a37ee5a..c426e45 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -47,7 +47,7 @@
     <string name="shortcut_duplicate" msgid="4757756326465060694">"शार्टकट \"<xliff:g id="NAME">%s</xliff:g>\" पहले से मौजूद है."</string>
     <string name="title_select_shortcut" msgid="2858897527672831763">"शॉर्टकट का चयन करें"</string>
     <string name="title_select_application" msgid="1793455815754848652">"एप्‍लिकेशन चुनें"</string>
-    <string name="all_apps_button_label" msgid="2578400570124163469">"एप्लिकेशन"</string>
+    <string name="all_apps_button_label" msgid="2578400570124163469">"Apps"</string>
     <string name="all_apps_home_button_label" msgid="1022222300329398558">"होम"</string>
     <string name="delete_zone_label_workspace" msgid="7153615831493049150">"निकालें"</string>
     <string name="delete_zone_label_all_apps" msgid="6664588234817475108">"अनइंस्टॉल करें"</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 72a915d..c89e963 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -51,7 +51,7 @@
     <!-- External-drop widget error string.  This is the error that is shown
          when you drag and item into the homescreen and it is unable to fit,
          or an error is encountered. [CHAR_LIMIT=50] -->
-    <string name="external_drop_widget_error">Couldn\'t drop item onto this Home screen.</string>
+    <string name="external_drop_widget_error">Couldn\'t drop item on this Home screen.</string>
     <!-- External-drop widget pick title.  This is shown as the title of the
          dialog which allows you to pick which widgets to handle a particular
          drop if there are multiple choices. [CHAR_LIMIT=35] -->
@@ -93,7 +93,7 @@
     <string name="shortcut_duplicate">Shortcut \"<xliff:g id="name" example="Browser">%s</xliff:g>\" already exists.</string>
 
     <!-- Title of dialog when user is selecting shortcut to add to homescreen -->
-    <string name="title_select_shortcut">Select shortcut</string>
+    <string name="title_select_shortcut">Choose shortcut</string>
     <!-- Title of dialog when user is selecting an application to add to homescreen -->
     <string name="title_select_application">Choose app</string>
 
@@ -176,17 +176,17 @@
     <!-- Permission short label -->
     <string name="permlab_uninstall_shortcut">uninstall shortcuts</string>
     <!-- Permission description -->
-    <string name="permdesc_uninstall_shortcut">Allows an app to remove
+    <string name="permdesc_uninstall_shortcut">Allows the app to remove
         shortcuts without user intervention.</string>
     <!-- Permission short label -->
     <string name="permlab_read_settings">read Home settings and shortcuts</string>
     <!-- Permission description -->
-    <string name="permdesc_read_settings">Allows an app to read the settings and
+    <string name="permdesc_read_settings">Allows the app to read the settings and
         shortcuts in Home.</string>
     <!-- Permission short label -->
     <string name="permlab_write_settings">write Home settings and shortcuts</string>
     <!-- Permission description -->
-    <string name="permdesc_write_settings">Allows an app to change the settings and
+    <string name="permdesc_write_settings">Allows the app to change the settings and
         shortcuts in Home.</string>
 
     <!-- Widgets: -->
@@ -241,9 +241,9 @@
     <!-- The format string for when a folder is opened, speaks the dimensions -->
     <string name="folder_opened">Folder opened, %1$d by %2$d</string>
     <!-- Instruction that clicking outside will close folder -->
-    <string name="folder_tap_to_close">Tap to close folder</string>
+    <string name="folder_tap_to_close">Touch to close folder</string>
     <!-- Instruction that clicking outside will commit folder rename -->
-    <string name="folder_tap_to_rename">Tap to commit rename</string>
+    <string name="folder_tap_to_rename">Touch to save rename</string>
     <!-- Indication that folder closed -->
     <string name="folder_closed">Folder closed</string>
     <!-- Folder renamed format -->
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index dc498a4..01417bf 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -134,7 +134,7 @@
                 mPressedOrFocusedBackground = null;
             }
             if (isFocused()) {
-                if (mLayout == null) {
+                if (getLayout() == null) {
                     // In some cases, we get focus before we have been layed out. Set the
                     // background to null so that it will get created when the view is drawn.
                     mPressedOrFocusedBackground = null;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index a9d794d..15da501 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -139,6 +139,7 @@
     static final int DIALOG_RENAME_FOLDER = 2;
 
     private static final String PREFERENCES = "launcher.preferences";
+    static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher.force_enable_rotation";
 
     // Type: int
     private static final String RUNTIME_STATE_CURRENT_SCREEN = "launcher.current_screen";
@@ -348,8 +349,11 @@
         }
         mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
 
+        final String forceEnableRotation = 
+                SystemProperties.get(FORCE_ENABLE_ROTATION_PROPERTY, "false");
+
         // On large interfaces, we want the screen to auto-rotate based on the current orientation
-        if (LauncherApplication.isScreenLarge() || Build.TYPE.contentEquals("eng")) {
+        if (LauncherApplication.isScreenLarge() || "true".equalsIgnoreCase(forceEnableRotation)) {
             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
         }
     }
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 3f5652e..2db03da 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -67,14 +67,20 @@
 
     private static final float OVERSCROLL_ACCELERATE_FACTOR = 2;
     private static final float OVERSCROLL_DAMP_FACTOR = 0.14f;
-    private static final int MINIMUM_SNAP_VELOCITY = 2200;
-    private static final int MIN_FLING_VELOCITY = 250;
+   
     private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
     // The page is moved more than halfway, automatically move to the next page on touch up.
     private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
 
-    // the velocity at which a fling gesture will cause us to snap to the next page
-    protected int mSnapVelocity = 500;
+    // The following constants need to be scaled based on density. The scaled versions will be
+    // assigned to the corresponding member variables below.
+    private static final int FLING_THRESHOLD_VELOCITY = 500;
+    private static final int MIN_SNAP_VELOCITY = 1500;
+    private static final int MIN_FLING_VELOCITY = 250;
+
+    protected int mFlingThresholdVelocity;
+    protected int mMinFlingVelocity;
+    protected int mMinSnapVelocity;
 
     protected float mDensity;
     protected float mSmoothingTime;
@@ -242,6 +248,10 @@
         mPagingTouchSlop = configuration.getScaledPagingTouchSlop();
         mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
         mDensity = getResources().getDisplayMetrics().density;
+
+        mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
+        mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * mDensity);
+        mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * mDensity);
     }
 
     public void setPageSwitchListener(PageSwitchListener pageSwitchListener) {
@@ -1208,12 +1218,11 @@
                 final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
                 boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
                         SIGNIFICANT_MOVE_THRESHOLD;
-                final int snapVelocity = mSnapVelocity;
 
                 mTotalMotionX += Math.abs(mLastMotionX + mLastMotionXRemainder - x);
 
                 boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
-                        Math.abs(velocityX) > snapVelocity;
+                        Math.abs(velocityX) > mFlingThresholdVelocity;
 
                 // In the case that the page is moved far to one direction and then is flung
                 // in the opposite direction, we use a threshold to determine whether we should
@@ -1434,7 +1443,7 @@
         int delta = newX - mUnboundedScrollX;
         int duration = 0;
 
-        if (Math.abs(velocity) < MIN_FLING_VELOCITY) {
+        if (Math.abs(velocity) < mMinFlingVelocity) {
             // If the velocity is low enough, then treat this more as an automatic page advance
             // as opposed to an apparent physical response to flinging
             snapToPage(whichPage, PAGE_SNAP_ANIMATION_DURATION);
@@ -1450,7 +1459,7 @@
                 distanceInfluenceForSnapDuration(distanceRatio);
 
         velocity = Math.abs(velocity);
-        velocity = Math.max(MINIMUM_SNAP_VELOCITY, velocity);
+        velocity = Math.max(mMinSnapVelocity, velocity);
 
         // we want the page's snap velocity to approximately match the velocity at which the
         // user flings, so we scale the duration by a value near to the derivative of the scroll
@@ -1591,22 +1600,29 @@
                 int upperPageBound = getAssociatedUpperPageBound(page);
                 if (DEBUG) Log.d(TAG, "loadAssociatedPages: " + lowerPageBound + "/"
                         + upperPageBound);
+                // First, clear any pages that should no longer be loaded
+                for (int i = 0; i < count; ++i) {
+                    Page layout = (Page) getPageAt(i);
+                    if ((immediateAndOnly && i != page) ||
+                            (i < lowerPageBound) ||
+                            (i > upperPageBound)) {
+                        if (layout.getPageChildCount() > 0) {
+                            layout.removeAllViewsOnPage();
+                        }
+                        mDirtyPageContent.set(i, true);
+                    }
+                }
+                // Next, load any new pages
                 for (int i = 0; i < count; ++i) {
                     if ((i != page) && immediateAndOnly) {
                         continue;
                     }
                     Page layout = (Page) getPageAt(i);
-                    final int childCount = layout.getPageChildCount();
                     if (lowerPageBound <= i && i <= upperPageBound) {
                         if (mDirtyPageContent.get(i)) {
                             syncPageItems(i, (i == page) && immediateAndOnly);
                             mDirtyPageContent.set(i, false);
                         }
-                    } else {
-                        if (childCount > 0) {
-                            layout.removeAllViewsOnPage();
-                        }
-                        mDirtyPageContent.set(i, true);
                     }
                 }
             }
diff --git a/src/com/android/launcher2/RocketLauncher.java b/src/com/android/launcher2/RocketLauncher.java
index 1255374..505ac4c 100644
--- a/src/com/android/launcher2/RocketLauncher.java
+++ b/src/com/android/launcher2/RocketLauncher.java
@@ -23,7 +23,6 @@
 import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
 import android.animation.TimeAnimator;
-import android.app.Activity;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -31,6 +30,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Handler;
+import android.support.v13.dreams.BasicDream;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.view.MotionEvent;
@@ -44,7 +44,7 @@
 import java.util.HashMap;
 import java.util.Random;
 
-public class RocketLauncher extends Activity {
+public class RocketLauncher extends BasicDream {
     public static final boolean ROCKET_LAUNCHER = true;
 
     public static class Board extends FrameLayout
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 467cec0..fa3dfcb 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -94,6 +94,7 @@
 
     private static final int BACKGROUND_FADE_OUT_DURATION = 350;
     private static final int ADJACENT_SCREEN_DROP_DURATION = 300;
+    private static final int FLING_THRESHOLD_VELOCITY = 500;
 
     // These animators are used to fade the children's outlines
     private ObjectAnimator mChildrenOutlineFadeInAnimation;
@@ -409,13 +410,15 @@
             }
         };
 
-        mSnapVelocity = 600;
         mWallpaperOffset = new WallpaperOffsetInterpolator();
         Display display = mLauncher.getWindowManager().getDefaultDisplay();
         mDisplayWidth = display.getWidth();
         mDisplayHeight = display.getHeight();
         mWallpaperTravelWidth = (int) (mDisplayWidth *
                 wallpaperTravelToScreenWidthRatio(mDisplayWidth, mDisplayHeight));
+
+        mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
+
     }
 
     @Override