merge in jb-release history after reset to jb-dev
diff --git a/res/layout-port/search_bar.xml b/res/layout-port/search_bar.xml
index 0ccbe02..85da2f1 100644
--- a/res/layout-port/search_bar.xml
+++ b/res/layout-port/search_bar.xml
@@ -32,6 +32,7 @@
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:layout_toLeftOf="@+id/voice_button_container"
+        android:paddingLeft="8dp"
         android:onClick="onClickSearchButton"
         android:focusable="true"
         android:clickable="true"
@@ -54,6 +55,7 @@
         android:layout_gravity="center_vertical"
         android:layout_alignParentRight="true"
         android:layout_alignParentTop="true"
+        android:paddingRight="8dp"
         android:gravity="right"
         android:onClick="onClickVoiceButton"
         android:focusable="true"
diff --git a/res/layout-sw600dp-port/all_apps_cling.xml b/res/layout-sw600dp-port/all_apps_cling.xml
index 95d7ff2..0498224 100644
--- a/res/layout-sw600dp-port/all_apps_cling.xml
+++ b/res/layout-sw600dp-port/all_apps_cling.xml
@@ -41,9 +41,10 @@
     <Button
         style="@style/ClingButton"
         android:id="@+id/cling_dismiss"
+        android:minWidth="168dp"
         android:textSize="24sp"
-        android:layout_marginBottom="27dp"
+        android:layout_marginTop="235dp"
         android:layout_marginRight="36dp"
-        android:layout_gravity="bottom|right"
+        android:layout_gravity="top|right"
         android:onClick="dismissAllAppsCling" />
 </com.android.launcher2.Cling>
diff --git a/res/layout-sw600dp-port/folder_cling.xml b/res/layout-sw600dp-port/folder_cling.xml
index 1b6c1a0..e3a9caa 100644
--- a/res/layout-sw600dp-port/folder_cling.xml
+++ b/res/layout-sw600dp-port/folder_cling.xml
@@ -42,6 +42,7 @@
     <Button
         style="@style/ClingButton"
         android:id="@+id/cling_dismiss"
+        android:minWidth="168dp"
         android:textSize="24sp"
         android:layout_marginBottom="27dp"
         android:layout_marginRight="36dp"
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index eeeed61..e94d780 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -18,8 +18,6 @@
 <!-- QSB -->
     <dimen name="toolbar_button_vertical_padding">12dip</dimen>
     <dimen name="toolbar_button_horizontal_padding">4dip</dimen>
-    <dimen name="search_bar_padding_left">0dp</dimen>
-    <dimen name="search_bar_padding_right">0dp</dimen>
 
 <!-- Workspace -->
     <dimen name="hotseat_cell_width">64dp</dimen>
diff --git a/res/values-port/styles.xml b/res/values-port/styles.xml
index 386653e..ab6a1eb 100644
--- a/res/values-port/styles.xml
+++ b/res/values-port/styles.xml
@@ -18,12 +18,6 @@
 -->
 
 <resources>
-<!-- QSB -->
-    <style name="SearchButton.Voice">
-        <item name="android:paddingLeft">8dp</item>
-        <item name="android:paddingRight">8dp</item>
-    </style>
-
 <!-- AppsCustomize -->
     <style name="TabIndicator.AppsCustomize">
         <item name="android:maxWidth">130dp</item>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 19d2152..c2b88d5 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -75,13 +75,13 @@
     <string name="cab_widget_selection_text" msgid="962527270506951955">"Выбран 1 виджет"</string>
     <string name="cab_folder_selection_text" msgid="8916111874189565067">"Выбрана 1 папка"</string>
     <string name="cab_shortcut_selection_text" msgid="8115847384500412878">"Выбран 1 ярлык"</string>
-    <string name="permlab_install_shortcut" msgid="1201690825493376489">"устанавливать ярлыки"</string>
+    <string name="permlab_install_shortcut" msgid="1201690825493376489">"Установка ярлыков"</string>
     <string name="permdesc_install_shortcut" msgid="8634424803272077038">"Приложение сможет самостоятельно добавлять ярлыки."</string>
     <string name="permlab_uninstall_shortcut" msgid="7696645932555926449">"удалять ярлыки"</string>
     <string name="permdesc_uninstall_shortcut" msgid="274355570620220977">"Приложение сможет самостоятельно удалять ярлыки."</string>
-    <string name="permlab_read_settings" msgid="3452408290738106747">"считывать настройки и ярлыки главного экрана"</string>
+    <string name="permlab_read_settings" msgid="3452408290738106747">"Просмотр настроек и ярлыков главного экрана"</string>
     <string name="permdesc_read_settings" msgid="5788109303585403679">"Приложение получит доступ к данным о настройках и ярлыках на главном экране."</string>
-    <string name="permlab_write_settings" msgid="1360567537236705628">"изменять настройки и ярлыки главного экрана"</string>
+    <string name="permlab_write_settings" msgid="1360567537236705628">"Изменение настроек и ярлыков главного экрана"</string>
     <string name="permdesc_write_settings" msgid="8530105489115785531">"Приложение сможет изменять настройки и ярлыки на главном экране."</string>
     <string name="gadget_error_text" msgid="8359351016167075858">"Не удалось загрузить виджет"</string>
     <string name="uninstall_system_app_text" msgid="6429814133777046491">"Это системное приложение, его нельзя удалить."</string>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 7cc8960..274c72f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -30,8 +30,6 @@
     <dimen name="qsb_bar_height">40dp</dimen>
     <dimen name="qsb_padding_left">0dp</dimen>
     <dimen name="qsb_padding_right">0dp</dimen>
-    <dimen name="search_bar_padding_left">8dp</dimen>
-    <dimen name="search_bar_padding_right">8dp</dimen>
     <dimen name="search_bar_height">40dp</dimen>
     <dimen name="workspace_max_gap">16dp</dimen>
     <dimen name="folder_cell_width">74dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 08c98c9..ee91d73 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -123,8 +123,6 @@
         <item name="android:orientation">horizontal</item>
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
-        <item name="android:paddingLeft">@dimen/search_bar_padding_left</item>
-        <item name="android:paddingRight">@dimen/search_bar_padding_right</item>
     </style>
     <style name="SearchButton">
         <item name="android:layout_gravity">center_vertical</item>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index ac6ec88..61329ad 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -940,7 +940,7 @@
 
     @Override
     public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
-        Log.d(TAG, "6549598 onLauncherTransitionEnd");
+        Log.d(TAG, "6549598 onLauncherTransitionEnd mDeferredSyncWidgetPageItems.size(): " + mDeferredSyncWidgetPageItems.size());
         mInTransition = false;
         for (AsyncTaskPageData d : mDeferredSyncWidgetPageItems) {
             onSyncWidgetPageItems(d);
@@ -1108,7 +1108,7 @@
     }
 
     public void syncAppsPageItems(int page, boolean immediate) {
-        Log.d(TAG, "6549598 syncAppsPageItems page: " + page);
+        Log.d(TAG, "6549598 syncAppsPageItems page: " + page + " mNumAppsPages: " + mNumAppsPages);
         // ensure that we have the right number of items on the pages
         int numCells = mCellCountX * mCellCountY;
         int startIndex = page * numCells;
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index d3afc3b..6bd97a2 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -23,6 +23,7 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -392,6 +393,7 @@
 
             // Make sure the current page is loaded (we start loading the side pages after the
             // transition to prevent slowing down the animation)
+            Log.d(LOG_TAG, "6549598 onLauncherTransitionPrepare currentPage: " + mAppsCustomizePane.getCurrentPage());
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
 
             if (!LauncherApplication.isScreenLarge()) {
@@ -434,6 +436,7 @@
             mAppsCustomizePane.showAllAppsCling();
             // Make sure adjacent pages are loaded (we wait until after the transition to
             // prevent slowing down the animation)
+            Log.d(LOG_TAG, "6549598 onLauncherTransitionEnd currentPage: " + mAppsCustomizePane.getCurrentPage());
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
 
             if (!LauncherApplication.isScreenLarge()) {
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index e05127b..b454afd 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -185,7 +185,9 @@
                     if (newAppsScreen == screen) {
                         newApps = sharedPrefs.getStringSet(NEW_APPS_LIST_KEY, newApps);
                     }
-                    newApps.add(intent.toUri(0).toString());
+                    synchronized (newApps) {
+                        newApps.add(intent.toUri(0).toString());
+                    }
                     final Set<String> savedNewApps = newApps;
                     new Thread("setNewAppsThread") {
                         public void run() {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index d7dd648..659077f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -3145,9 +3145,13 @@
                     View shortcut = createShortcut(info);
                     workspace.addInScreen(shortcut, item.container, item.screen, item.cellX,
                             item.cellY, 1, 1, false);
-                    if (newApps.contains(uri)) {
-                        newApps.remove(uri);
-
+                    boolean animateIconUp = false;
+                    synchronized (newApps) {
+                        if (newApps.contains(uri)) {
+                            animateIconUp = newApps.remove(uri);
+                        }
+                    }
+                    if (animateIconUp) {
                         // Prepare the view to be animated up
                         shortcut.setAlpha(0f);
                         shortcut.setScaleX(0f);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index c820264..19f6a62 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -234,6 +234,7 @@
         mDirtyPageContent.ensureCapacity(32);
         mScroller = new Scroller(getContext(), new ScrollInterpolator());
         mCurrentPage = 0;
+        if (this instanceof AppsCustomizePagedView) Log.d(TAG, "6549598 init() mCurrentPage: " + mCurrentPage);
         mCenterPagesVertically = true;
 
         final ViewConfiguration configuration = ViewConfiguration.get(getContext());
@@ -317,7 +318,9 @@
             return;
         }
 
+
         mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
+        if (this instanceof AppsCustomizePagedView) Log.d(TAG, "6549598 setCurrentPage mCurrentPage: " + mCurrentPage);
         updateCurrentPageScroll();
         updateScrollingIndicator();
         notifyPageSwitchListener();
diff --git a/src/com/android/launcher2/UninstallShortcutReceiver.java b/src/com/android/launcher2/UninstallShortcutReceiver.java
index 84b1ad5..e94a17f 100644
--- a/src/com/android/launcher2/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher2/UninstallShortcutReceiver.java
@@ -139,9 +139,11 @@
             boolean appRemoved;
             Set<String> newApps = new HashSet<String>();
             newApps = sharedPrefs.getStringSet(InstallShortcutReceiver.NEW_APPS_LIST_KEY, newApps);
-            do {
-                appRemoved = newApps.remove(intent.toUri(0).toString());
-            } while (appRemoved);
+            synchronized (newApps) {
+                do {
+                    appRemoved = newApps.remove(intent.toUri(0).toString());
+                } while (appRemoved);
+            }
             if (appRemoved) {
                 final Set<String> savedNewApps = newApps;
                 new Thread("setNewAppsThread-remove") {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 8b9662b..11eb3c1 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -3682,14 +3682,16 @@
                     }
                     // Remove all queued items that match the same package
                     if (newApps != null) {
-                        for (String intentStr : newApps) {
-                            try {
-                                Intent intent = Intent.parseUri(intentStr, 0);
-                                String pn = ItemInfo.getPackageName(intent);
-                                if (packageNames.contains(pn)) {
-                                    newApps.remove(intentStr);
-                                }
-                            } catch (URISyntaxException e) {}
+                        synchronized (newApps) {
+                            for (String intentStr : newApps) {
+                                try {
+                                    Intent intent = Intent.parseUri(intentStr, 0);
+                                    String pn = ItemInfo.getPackageName(intent);
+                                    if (packageNames.contains(pn)) {
+                                        newApps.remove(intentStr);
+                                    }
+                                } catch (URISyntaxException e) {}
+                            }
                         }
                     }
                 }