Implement selection mode for All Apps with delete and info actions.
diff --git a/res/drawable-xlarge/info_button.png b/res/drawable-xlarge/info_button.png
index e3b27f4..253cdf7 100644
--- a/res/drawable-xlarge/info_button.png
+++ b/res/drawable-xlarge/info_button.png
Binary files differ
diff --git a/res/drawable-xlarge/trashcan.png b/res/drawable-xlarge/trashcan.png
index 284543c..22134b4 100644
--- a/res/drawable-xlarge/trashcan.png
+++ b/res/drawable-xlarge/trashcan.png
Binary files differ
diff --git a/res/drawable-xlarge/trashcan_hover.png b/res/drawable-xlarge/trashcan_hover.png
index 38695cd..3ac6922 100644
--- a/res/drawable-xlarge/trashcan_hover.png
+++ b/res/drawable-xlarge/trashcan_hover.png
Binary files differ
diff --git a/res/layout-xlarge/all_apps_tabbed.xml b/res/layout-xlarge/all_apps_tabbed.xml
index dbe192c..5a43361 100644
--- a/res/layout-xlarge/all_apps_tabbed.xml
+++ b/res/layout-xlarge/all_apps_tabbed.xml
@@ -15,7 +15,8 @@
 -->
 <com.android.launcher2.AllAppsTabbed
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:background="#30000000">
+    android:background="#30000000"
+    android:paddingTop="?android:attr/windowActionBarSize">
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
diff --git a/res/layout-xlarge/launcher.xml b/res/layout-xlarge/launcher.xml
index 3b39fd1..7018b3e 100644
--- a/res/layout-xlarge/launcher.xml
+++ b/res/layout-xlarge/launcher.xml
@@ -34,6 +34,7 @@
         android:id="@+id/workspace"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:paddingTop="?android:attr/windowActionBarSize"
         launcher:defaultScreen="2"
         launcher:cellCountX="8"
         launcher:cellCountY="7">
@@ -48,15 +49,14 @@
     <RelativeLayout
         android:id="@+id/all_apps_button_cluster"
         android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="top"
-        android:padding="@dimen/toolbar_padding">
+        android:layout_height="?android:attr/windowActionBarSize"
+        android:layout_gravity="top">
 
         <ImageView
             android:id="@+id/search_button"
             android:src="@drawable/search_button"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_gravity="left"
 
             android:onClick="onClickSearchButton"
@@ -67,7 +67,7 @@
             android:id="@+id/all_apps_button"
             android:src="@drawable/all_apps_button"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_alignParentRight="true"
             android:layout_marginLeft="@dimen/toolbar_button_spacing"
 
@@ -80,7 +80,7 @@
         <ImageView
             android:id="@+id/market_button"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_alignLeft="@id/all_apps_button"
 
             android:onClick="onClickAppMarketButton"
@@ -92,7 +92,7 @@
             android:id="@+id/configure_button"
             android:src="@drawable/configure_button"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_toLeftOf="@id/all_apps_button"
             android:layout_marginLeft="@dimen/toolbar_button_spacing"
 
@@ -104,7 +104,7 @@
             android:id="@+id/delete_zone"
             android:src="@drawable/delete_zone_selector"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_alignLeft="@id/all_apps_button"
 
             android:visibility="gone"
@@ -114,7 +114,7 @@
             android:id="@+id/info_button"
             android:src="@drawable/info_button"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_alignLeft="@id/configure_button"
 
             android:visibility="gone"
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index e4c047f..637b6ce 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -18,6 +18,11 @@
 -->
 
 <resources>
+    <style name="Theme" parent="Theme.Base">
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowActionModeOverlay">true</item>
+    </style>
+
     <style name="WorkspaceIcon.Portrait">
         <item name="android:drawablePadding">4dip</item>
         <item name="android:paddingTop">1dip</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 392584c..a009863 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -133,6 +133,17 @@
     <!-- Noun, menu item used to show the system settings -->
     <string name="menu_settings">Settings</string>
 
+    <!--  Strings for the contextual action bar (CAB) in All Apps -->
+    <skip />
+    <!-- Describes the button for uninstalling the currently selected application.
+         Text is not displayed, but provided for accessibility. [CHAR_LIMIT=none] -->
+    <string name="cab_menu_delete_app">Uninstall application</string>
+    <!-- Describes the button for getting details/info about currently selected application.
+         Text is not displayed, but provided for accessibility. [CHAR_LIMIT=none] -->
+    <string name="cab_menu_app_info">Application details</string>
+    <!-- Appears in the CAB when an app is selected in All Apps. [CHAR_LIMIT=50] -->
+    <string name="cab_selection_text">1 application selected</string>
+
     <!-- Permissions: -->
     <skip />
     <!-- Permission short label -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c208211..a97b3c5 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -18,7 +18,10 @@
 -->
 
 <resources>
-    <style name="Theme" parent="android:Theme.Wallpaper">
+    <style name="Theme.Base" parent="android:Theme.Wallpaper">
+    </style>
+
+    <style name="Theme" parent="Theme.Base">
         <item name="android:windowNoTitle">true</item>
     </style>
 
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 0aa7724..bdd7066 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -16,14 +16,14 @@
 
 package com.android.launcher2;
 
-import java.util.ArrayList;
-import java.util.Collections;
+import com.android.launcher.R;
 
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Rect;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.ActionMode;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -33,7 +33,8 @@
 import android.widget.Checkable;
 import android.widget.TextView;
 
-import com.android.launcher.R;
+import java.util.ArrayList;
+import java.util.Collections;
 
 /**
  * An implementation of PagedView that populates the pages of the workspace
@@ -46,6 +47,9 @@
     private static final String TAG = "AllAppsPagedView";
     private static final boolean DEBUG = false;
 
+    private static final int MENU_DELETE_APP = 1;
+    private static final int MENU_APP_INFO = 2;
+
     private Launcher mLauncher;
     private DragController mDragController;
 
@@ -159,14 +163,19 @@
         // if we are already in a choice mode, then just change the selection
         if (v instanceof Checkable) {
             if (!isChoiceMode(CHOICE_MODE_NONE)) {
+                Checkable c = (Checkable) v;
                 if (isChoiceMode(CHOICE_MODE_SINGLE)) {
-                    // reset all the previously checked items if in single selection mode
+                    // Uncheck all the other grandchildren, and toggle the clicked one
+                    boolean wasChecked = c.isChecked();
                     resetCheckedGrandchildren();
+                    c.setChecked(!wasChecked);
+                } else {
+                    c.toggle();
+                }
+                if (getCheckedGrandchildren().size() == 0) {
+                    endChoiceMode();
                 }
 
-                // then toggle this one
-                Checkable c = (Checkable) v;
-                c.toggle();
                 return;
             }
         }
@@ -194,8 +203,6 @@
             return false;
         }
 
-        /* Uncomment this to enable selection mode with the action bar
-
         // start the choice mode, and select the item that was long-pressed
         if (isChoiceMode(CHOICE_MODE_NONE)) {
             startChoiceMode(CHOICE_MODE_SINGLE, this);
@@ -210,7 +217,6 @@
             Checkable c = (Checkable) v;
             c.toggle();
         }
-         */
 
         ApplicationInfo app = (ApplicationInfo) v.getTag();
         app = new ApplicationInfo(app);
@@ -391,15 +397,17 @@
 
     @Override
     public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
-        mDragController.addDropTarget(this);
-
-        // REST TO BE IMPLEMENTED BY PAT
-        mode.setTitle("Customization title goes here");
+        mode.setTitle(R.string.cab_selection_text);
+        menu.add(0, MENU_APP_INFO, 0, R.string.cab_menu_app_info)
+                .setIcon(R.drawable.info_button);
+        menu.add(0, MENU_DELETE_APP, 0, R.string.cab_menu_delete_app)
+                .setIcon(R.drawable.delete_zone_selector);
         return true;
     }
 
     @Override
     public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+        mDragController.addDropTarget(this);
         return true;
     }
 
@@ -411,8 +419,17 @@
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        // TO BE IMPLEMENTED BY PAT
-        // get the checked grandchild, and handle the action here
+        final int id = item.getItemId();
+
+        // Assumes that we are in CHOICE_MODE_SINGLE
+        final View chosenView = (View) getSingleCheckedGrandchild();
+        final ApplicationInfo appInfo = (ApplicationInfo) chosenView.getTag();
+
+        if (id == MENU_APP_INFO) {
+            mLauncher.startApplicationDetailsActivity(appInfo.componentName);
+        } else if (id == MENU_DELETE_APP) {
+            mLauncher.startApplicationUninstallActivity(appInfo.componentName);
+        }
         return false;
     }
 
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index bee69b9..637f79f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1305,7 +1305,7 @@
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
-        if (isWorkspaceLocked()) {
+        if (isWorkspaceLocked() || LauncherApplication.isScreenXLarge()) {
             return false;
         }
 
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 48f42a1..df3f0cc 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -16,9 +16,8 @@
 
 package com.android.launcher2;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
+import com.android.launcher.R;
+
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
@@ -26,7 +25,6 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.ActionMode;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
@@ -40,7 +38,8 @@
 import android.widget.Checkable;
 import android.widget.Scroller;
 
-import com.android.launcher.R;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 /**
  * An abstraction of the original Workspace which supports browsing through a
@@ -104,6 +103,7 @@
     protected static final int CHOICE_MODE_SINGLE = 1;
     // Multiple selection mode is not supported by all Launcher actions atm
     protected static final int CHOICE_MODE_MULTIPLE = 2;
+
     private int mChoiceMode;
     private ActionMode mActionMode;
 
@@ -1011,10 +1011,10 @@
 
     protected void endChoiceMode() {
         if (!isChoiceMode(CHOICE_MODE_NONE)) {
-            mActionMode.finish();
-            mActionMode = null;
             mChoiceMode = CHOICE_MODE_NONE;
             resetCheckedGrandchildren();
+            mActionMode.finish();
+            mActionMode = null;
         }
     }
 
@@ -1030,7 +1030,7 @@
             final int grandChildCount = layout.getChildCount();
             for (int j = 0; j < grandChildCount; ++j) {
                 final View v = layout.getChildAt(j);
-                if (v instanceof Checkable) {
+                if (v instanceof Checkable && ((Checkable) v).isChecked()) {
                     checked.add((Checkable) v);
                 }
             }
@@ -1038,6 +1038,27 @@
         return checked;
     }
 
+    /**
+     * If in CHOICE_MODE_SINGLE and an item is checked, returns that item.
+     * Otherwise, returns null.
+     */
+    protected Checkable getSingleCheckedGrandchild() {
+        if (mChoiceMode == CHOICE_MODE_SINGLE) {
+            final int childCount = getChildCount();
+            for (int i = 0; i < childCount; ++i) {
+                final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i);
+                final int grandChildCount = layout.getChildCount();
+                for (int j = 0; j < grandChildCount; ++j) {
+                    final View v = layout.getChildAt(j);
+                    if (v instanceof Checkable && ((Checkable) v).isChecked()) {
+                        return (Checkable) v;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
     protected void resetCheckedGrandchildren() {
         // loop through children, and set all of their children to _not_ be checked
         final ArrayList<Checkable> checked = getCheckedGrandchildren();