merge in honeycomb-release history after reset to honeycomb
diff --git a/res/drawable-xlarge-hdpi/homescreen_small_blue.9.png b/res/drawable-xlarge-hdpi/homescreen_small_blue.9.png
index c3faa24..db93b3c 100644
--- a/res/drawable-xlarge-hdpi/homescreen_small_blue.9.png
+++ b/res/drawable-xlarge-hdpi/homescreen_small_blue.9.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/homescreen_small_blue.9.png b/res/drawable-xlarge-mdpi/homescreen_small_blue.9.png
index 096df7f..28bc33b 100644
--- a/res/drawable-xlarge-mdpi/homescreen_small_blue.9.png
+++ b/res/drawable-xlarge-mdpi/homescreen_small_blue.9.png
Binary files differ
diff --git a/res/values-es-rUS-xlarge/strings.xml b/res/values-es-rUS-xlarge/strings.xml
index f73a394..68b2f56 100644
--- a/res/values-es-rUS-xlarge/strings.xml
+++ b/res/values-es-rUS-xlarge/strings.xml
@@ -1,24 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- 
-/*
-* Copyright (C) 2010 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
- -->
-
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="wallpaper_dialog_title" msgid="5764793286524787718">"Seleccionar fondo de pantalla"</string>
-    <string name="wallpaper_cancel" msgid="6502936522490675611">"Cancelar"</string>
+    <!-- XL -->
+    <string name="application_name" msgid="8444202179223900837">"Selector"</string>
+    <!-- XL -->
+    <string name="uid_name" msgid="2634595491534329164">"Aplicaciones del núcleo de Androide"</string>
+    <!-- XL -->
+    <string name="chooser_wallpaper" msgid="3766864787811545058">"Seleccionar fondo de pantalla desde"</string>
+    <!-- XL -->
+    <string name="pick_wallpaper" msgid="7392838767723380127">"Fondos de pantalla"</string>
+    <!-- XL -->
+    <string name="activity_not_found" msgid="742483216109058344">"La aplicación no está instalada."</string>
+    <!-- XL -->
+    <string name="wallpapers_tab_label" msgid="1659635260989419263">"Fondos de pantalla"</string>
+    <!-- XL -->
+    <string name="wallpapers_temp_tab_text" msgid="1406600851510062325">"Ésta será la pestaña para los fondos de pantalla"</string>
+    <!-- XL -->
+    <string name="all_apps_tab_apps" msgid="827864997519186499">"Google Apps"</string>
+    <!-- XL -->
+    <string name="all_apps_no_downloads" msgid="6687010155766000796">"No se encontraron apps."</string>
+    <!-- XL -->
+    <string name="group_wallpapers" msgid="5356616257147378618">"Fondos de pantalla"</string>
+    <!-- XL -->
+    <string name="all_apps_button_label" msgid="825988103463804114">"Google Apps"</string>
+    <!-- XL -->
+    <string name="all_apps_home_button_label" msgid="4573985169183891042">"Pantalla principal"</string>
+    <!-- XL -->
+    <string name="menu_wallpaper" msgid="7079815810001779627">"Fondo de pantalla"</string>
+    <!-- XL -->
+    <string name="permlab_uninstall_shortcut" msgid="9081019297773923949">"desinstalar accesos directos"</string>
+    <!-- XL -->
+    <string name="delete_zone_label_workspace" msgid="7170653385628744300">"Eliminar"</string>
+    <!-- XL xlarge -->
+    <string name="wallpaper_dialog_title" msgid="8158909859337893047">"Seleccionar fondo de pantalla"</string>
+    <!-- XL xlarge -->
+    <string name="wallpaper_cancel" msgid="6726455585784483952">"Cancelar"</string>
 </resources>
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index f7d9f0e..4568562 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -234,10 +234,8 @@
 
     @Override
     protected boolean beginDragging(View v) {
-        if (!v.isInTouchMode()) {
-            return false;
-        }
-        super.beginDragging(v);
+        if (!v.isInTouchMode()) return false;
+        if (!super.beginDragging(v)) return false;
 
         // Start drag mode after the item is selected
         setupDragMode();
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 348fe34..4d1dbf8 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -30,13 +30,14 @@
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
+import android.view.View;
 
 /**
  * TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
  * because we want to make the bubble taller than the text and TextView's clip is
  * too aggressive.
  */
-public class BubbleTextView extends CacheableTextView {
+public class BubbleTextView extends CacheableTextView implements VisibilityChangedBroadcaster {
     static final float CORNER_RADIUS = 4.0f;
     static final float SHADOW_LARGE_RADIUS = 4.0f;
     static final float SHADOW_SMALL_RADIUS = 1.75f;
@@ -64,6 +65,8 @@
     private boolean mBackgroundSizeChanged;
     private Drawable mBackground;
 
+    private VisibilityChangedListener mOnVisibilityChangedListener;
+
     public BubbleTextView(Context context) {
         super(context);
         init();
@@ -240,6 +243,18 @@
         return result;
     }
 
+    public void setVisibilityChangedListener(VisibilityChangedListener listener) {
+        mOnVisibilityChangedListener = listener;
+    }
+
+    @Override
+    protected void onVisibilityChanged(View changedView, int visibility) {
+        if (mOnVisibilityChangedListener != null) {
+            mOnVisibilityChangedListener.receiveVisibilityChangedMessage(this);
+        }
+        super.onVisibilityChanged(changedView, visibility);
+    }
+
     @Override
     public void draw(Canvas canvas) {
         if (mPressedOrFocusedBackground != null && (isPressed() || isFocused())) {
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 4e618af..2359e32 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -53,7 +53,7 @@
 
 import java.util.Arrays;
 
-public class CellLayout extends ViewGroup implements Dimmable {
+public class CellLayout extends ViewGroup implements Dimmable, VisibilityChangedListener {
     static final String TAG = "CellLayout";
 
     private int mCellWidth;
@@ -409,7 +409,11 @@
 
     private void invalidateCache() {
         mIsCacheDirty = true;
-        invalidateIfNeeded();
+        invalidate();
+    }
+
+    public void receiveVisibilityChangedMessage(View v) {
+        invalidateCache();
     }
 
     public void updateCache() {
@@ -437,8 +441,9 @@
             }
         }
 
+        boolean useBitmapCache = mIsCacheEnabled && getScaleX() < mMaxScaleForUsingBitmapCache;
         if (mForceCacheUpdate ||
-                (mIsCacheEnabled && !mDisableCacheUpdates)) {
+                (useBitmapCache && !mDisableCacheUpdates)) {
             // Sometimes we force a cache update-- this is used to make sure the cache will look as
             // up-to-date as possible right when we disable cache updates
             if (mIsCacheDirty) {
@@ -447,7 +452,7 @@
             mForceCacheUpdate = false;
         }
 
-        if (mIsCacheEnabled && getScaleX() < mMaxScaleForUsingBitmapCache) {
+        if (useBitmapCache) {
             mCachePaint.setAlpha((int)(255*getAlpha()));
             canvas.drawBitmap(mCache, mCacheRect, mBackgroundRect, mCachePaint);
         } else {
@@ -619,10 +624,11 @@
 
             child.setId(childId);
 
-            // We might be in the middle or end of shrinking/fading to a dimmed view
-            // Make sure this view's alpha is set the same as all the rest of the views
-            child.setAlpha(getAlpha());
             addView(child, index, lp);
+            if (child instanceof VisibilityChangedBroadcaster) {
+                VisibilityChangedBroadcaster v = (VisibilityChangedBroadcaster) child;
+                v.setVisibilityChangedListener(this);
+            }
 
             // invalidate the cache to have it reflect the new item
             invalidateCache();
@@ -646,34 +652,42 @@
 
     @Override
     public void removeAllViews() {
+        super.removeAllViews();
         clearOccupiedCells();
+        invalidateCache();
     }
 
     @Override
     public void removeAllViewsInLayout() {
+        super.removeAllViewsInLayout();
         clearOccupiedCells();
+        invalidateCache();
     }
 
     public void removeViewWithoutMarkingCells(View view) {
         super.removeView(view);
+        invalidateCache();
     }
 
     @Override
     public void removeView(View view) {
         markCellsAsUnoccupiedForView(view);
         super.removeView(view);
+        invalidateCache();
     }
 
     @Override
     public void removeViewAt(int index) {
         markCellsAsUnoccupiedForView(getChildAt(index));
         super.removeViewAt(index);
+        invalidateCache();
     }
 
     @Override
     public void removeViewInLayout(View view) {
         markCellsAsUnoccupiedForView(view);
         super.removeViewInLayout(view);
+        invalidateCache();
     }
 
     @Override
@@ -682,6 +696,7 @@
             markCellsAsUnoccupiedForView(getChildAt(i));
         }
         super.removeViews(start, count);
+        invalidateCache();
     }
 
     @Override
@@ -690,6 +705,7 @@
             markCellsAsUnoccupiedForView(getChildAt(i));
         }
         super.removeViewsInLayout(start, count);
+        invalidateCache();
     }
 
     @Override
@@ -946,7 +962,15 @@
 
                     if (lp.animateDrop) {
                         lp.animateDrop = false;
-                        ((Workspace) mParent).animateViewIntoPosition(child);
+
+                        // This call needs to be posted since it results in a requestLayout()
+                        // which shouldn't be called from within a layout pass (can cause a bad
+                        // state of the tree).
+                        post(new Runnable() {
+                            public void run() {
+                                ((Workspace) mParent).animateViewIntoPosition(child);
+                            }
+                        });
                     }
                 }
             }
@@ -1702,3 +1726,14 @@
         }
     }
 }
+
+// Custom interfaces used to listen to "visibility changed" events of *children* of Views. Avoided
+// using "onVisibilityChanged" in the names because there's a method of that name in framework
+// (which can only can be used to listen to ancestors' "visibility changed" events)
+interface VisibilityChangedBroadcaster {
+    public void setVisibilityChangedListener(VisibilityChangedListener listener);
+}
+
+interface VisibilityChangedListener {
+    public void receiveVisibilityChangedMessage(View v);
+}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 0b874bc..6a563f2 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -492,12 +492,13 @@
     }
 
     protected boolean beginDragging(View v) {
+        if (!v.isInTouchMode()) return false;
+        if (!super.beginDragging(v)) return false;
+
         // End the current choice mode before we start dragging anything
         if (isChoiceMode(CHOICE_MODE_SINGLE)) {
             endChoiceMode();
         }
-        super.beginDragging(v);
-
         boolean result = false;
         switch (mCustomizationType) {
         case WidgetCustomization: {
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 0f24cd9..b456030 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -390,6 +390,10 @@
         return mDragging;
     }
 
+    public boolean isDragging() {
+        return mDragging;
+    }
+
     /**
      * Stop dragging without dropping.
      */
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 83f13aa..7faa520 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -88,6 +88,7 @@
 import android.view.ViewGroup;
 import android.view.WindowManager;
 import android.view.View.OnLongClickListener;
+import android.view.accessibility.AccessibilityEvent;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.Advanceable;
 import android.widget.EditText;
@@ -416,6 +417,21 @@
         }
     }
 
+    @Override
+    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+        super.dispatchPopulateAccessibilityEvent(event);
+
+        // we want to take over text population so it is context dependent
+        event.getText().clear();
+        if (mState == State.ALL_APPS) {
+            event.getText().add(getString(R.string.all_apps_button_label));
+        } else if (mState == State.WORKSPACE) {
+            event.getText().add(getString(R.string.all_apps_home_button_label));
+        }
+
+        return true;
+    }
+
     private void checkForLocaleChange() {
         if (sLocaleConfiguration == null) {
             new AsyncTask<Void, Void, LocaleConfiguration>() {
@@ -2205,7 +2221,7 @@
 
         final View itemUnderLongClick = longClickCellInfo.cell;
 
-        if (mWorkspace.allowLongPress()) {
+        if (mWorkspace.allowLongPress() && !mDragController.isDragging()) {
             if (itemUnderLongClick == null) {
                 // User long pressed on empty space
                 mWorkspace.setAllowLongPress(false);
@@ -2878,8 +2894,10 @@
 
         // Change the state *after* we've called all the transition code
         mState = State.ALL_APPS;
-    }
 
+        // send an accessibility event to announce the context change
+        getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
+    }
 
     void showWorkspace(boolean animated) {
         showWorkspace(animated, null);
@@ -2901,6 +2919,9 @@
 
         // Change the state *after* we've called all the transition code
         mState = State.WORKSPACE;
+
+        // send an accessibility event to announce the context change
+        getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
 
     void enterSpringLoadedDragMode(CellLayout layout) {
diff --git a/src/com/android/launcher2/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index c45140e..85a80f9 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -28,13 +28,13 @@
 /**
  * {@inheritDoc}
  */
-public class LauncherAppWidgetHostView extends AppWidgetHostView {
+public class LauncherAppWidgetHostView extends AppWidgetHostView
+    implements VisibilityChangedBroadcaster {
     private boolean mHasPerformedLongPress;
-    
     private CheckForLongPress mPendingCheckForLongPress;
-    
     private LayoutInflater mInflater;
-    
+    private VisibilityChangedListener mOnVisibilityChangedListener;
+
     public LauncherAppWidgetHostView(Context context) {
         super(context);
         mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -110,4 +110,16 @@
             removeCallbacks(mPendingCheckForLongPress);
         }
     }
+
+    public void setVisibilityChangedListener(VisibilityChangedListener listener) {
+        mOnVisibilityChangedListener = listener;
+    }
+
+    @Override
+    protected void onVisibilityChanged(View changedView, int visibility) {
+        if (mOnVisibilityChangedListener != null) {
+            mOnVisibilityChangedListener.receiveVisibilityChangedMessage(this);
+        }
+        super.onVisibilityChanged(changedView, visibility);
+    }
 }
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index b1f199b..f24d7e0 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -50,8 +50,9 @@
     }
 
     protected boolean beginDragging(View v) {
+        boolean wasDragging = mIsDragging;
         mIsDragging = true;
-        return false;
+        return !wasDragging;
     }
 
     protected void cancelDragging() {