Merge "Run wallpaper chooser in a separate process" into ics-mr0
diff --git a/res/color/tab_widget_indicator_color.xml b/res/color/tab_widget_indicator_color.xml
deleted file mode 100644
index cbe9e3e..0000000
--- a/res/color/tab_widget_indicator_color.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_selected="true" android:color="#FFEFEFEF" />
-    <item android:color="#909090" />
-</selector>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index faad606..27e00b3 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -52,7 +52,7 @@
 <!-- AllApps/Customize/AppsCustomize -->
     <!-- The height of the tab bar - if this changes, we should update the
          external icon width/height above to compensate -->
-    <dimen name="apps_customize_tab_bar_height">56dp</dimen>
+    <dimen name="apps_customize_tab_bar_height">52dp</dimen>
     <dimen name="app_icon_size">48dp</dimen>
     <!-- The width can be 72dp because we don't have L/R padding -->
     <dimen name="apps_customize_cell_width">74dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8368388..04bddf1 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -158,17 +158,13 @@
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">match_parent</item>
         <item name="android:gravity">center</item>
-        <item name="android:paddingLeft">15dp</item>
-        <item name="android:paddingRight">15dp</item>
-        <item name="android:paddingTop">10dp</item>
-        <item name="android:paddingBottom">15dp</item>
+        <item name="android:paddingLeft">35dp</item>
+        <item name="android:paddingRight">35dp</item>
         <item name="android:background">@drawable/tab_widget_indicator_selector</item>
-        <item name="android:textColor">@color/tab_widget_indicator_color</item>
-        <item name="android:textSize">16sp</item>
-        <item name="android:shadowColor">#393939</item>
-        <item name="android:shadowDx">0.0</item>
-        <item name="android:shadowDy">1.0</item>
-        <item name="android:shadowRadius">1.0</item>
+        <item name="android:textColor">?android:attr/textColorPrimary</item>
+        <item name="android:textSize">12sp</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:textAllCaps">true</item>
     </style>
     <style name="TabIndicator.AppsCustomize">
         <!-- Overridden in values-land -->
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 8b7b956..d37b1c9 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -107,11 +107,16 @@
 
         // Create the tabs
         TextView tabView;
+        String label;
+        label = mContext.getString(R.string.all_apps_button_label);
         tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
-        tabView.setText(mContext.getString(R.string.all_apps_button_label));
+        tabView.setText(label);
+        tabView.setContentDescription(label);
         addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
+        label = mContext.getString(R.string.widgets_tab_label);
         tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
-        tabView.setText(mContext.getString(R.string.widgets_tab_label));
+        tabView.setText(label);
+        tabView.setContentDescription(label);
         addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
         setOnTabChangedListener(this);
 
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index f1fb6ab..f7fa380 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -21,6 +21,7 @@
 import android.content.res.TypedArray;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.widget.FrameLayout;
 
@@ -103,6 +104,17 @@
                 context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);
         // allAppsButton.setText(context.getString(R.string.all_apps_button_label));
         allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
+        allAppsButton.setOnTouchListener(new View.OnTouchListener() {
+            @Override
+            public boolean onTouch(View v, MotionEvent event) {
+                if (mLauncher != null &&
+                    (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
+                    mLauncher.onTouchDownAllAppsButton(v);
+                }
+                return false;
+            }
+        });
+
         allAppsButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(android.view.View v) {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 6d95555..dc7b77e 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -246,7 +246,9 @@
 
     private Runnable mBuildLayersRunnable = new Runnable() {
         public void run() {
-            mWorkspace.buildPageHardwareLayers();
+            if (mWorkspace != null) {
+                mWorkspace.buildPageHardwareLayers();
+            }
         }
     };
 
@@ -559,6 +561,7 @@
         if (!mWorkspaceLoading) {
             mWorkspace.post(mBuildLayersRunnable);
         }
+        clearTypedText();
     }
 
     @Override
@@ -748,8 +751,19 @@
                 mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
         mAppsCustomizeContent.setup(this, dragController);
 
-
-
+        // Get the all apps button
+        mAllAppsButton = findViewById(R.id.all_apps_button);
+        if (mAllAppsButton != null) {
+            mAllAppsButton.setOnTouchListener(new View.OnTouchListener() {
+                @Override
+                public boolean onTouch(View v, MotionEvent event) {
+                    if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
+                        onTouchDownAllAppsButton(v);
+                    }
+                    return false;
+                }
+            });
+        }
         // Setup the drag controller (drop targets have to be added in reverse order in priority)
         dragController.setDragScoller(mWorkspace);
         dragController.setScrollView(mDragLayer);
@@ -1248,6 +1262,7 @@
         // Remove all pending runnables
         mHandler.removeMessages(ADVANCE_MSG);
         mHandler.removeMessages(0);
+        mWorkspace.removeCallbacks(mBuildLayersRunnable);
 
         // Stop callbacks from LauncherModel
         LauncherApplication app = ((LauncherApplication) getApplication());
@@ -1302,7 +1317,6 @@
         if (initialQuery == null) {
             // Use any text typed in the launcher as the initial query
             initialQuery = getTypedText();
-            clearTypedText();
         }
         if (appSearchData == null) {
             appSearchData = new Bundle();
@@ -1731,9 +1745,12 @@
      * @param v The view that was clicked.
      */
     public void onClickAllAppsButton(View v) {
+        showAllApps(true);
+    }
+
+    public void onTouchDownAllAppsButton(View v) {
         // Provide the same haptic feedback that the system offers for virtual keys.
         v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
-        showAllApps(true);
     }
 
     public void onClickAppMarketButton(View v) {
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 53f7b42..6cec101 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -602,6 +602,9 @@
             if (c != null && c.moveToNext()) {
                 id = c.getLong(maxIdIndex);
             }
+            if (c != null) {
+                c.close();
+            }
 
             if (id == -1) {
                 throw new RuntimeException("Error: could not query max id");