diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 57a6584..476d063 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -330,16 +330,4 @@
         }
         return true;
     }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
-                || super.onKeyDown(keyCode, event);
-    }
-
-    @Override
-    public boolean onKeyUp(int keyCode, KeyEvent event) {
-        return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
-                || super.onKeyUp(keyCode, event);
-    }
 }
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index 233fd6f..3783d56 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -31,9 +31,19 @@
 import java.util.Comparator;
 
 /**
+ * A keyboard listener we set on all the workspace icons.
+ */
+class BubbleTextViewKeyEventListener implements View.OnKeyListener {
+    @Override
+    public boolean onKey(View v, int keyCode, KeyEvent event) {
+        return FocusHelper.handleBubbleTextViewKeyEvent((BubbleTextView) v, keyCode, event);
+    }
+}
+
+/**
  * A keyboard listener we set on all the hotseat buttons.
  */
-class HotseatKeyEventListener implements View.OnKeyListener {
+class HotseatBubbleTextViewKeyEventListener implements View.OnKeyListener {
     @Override
     public boolean onKey(View v, int keyCode, KeyEvent event) {
         final Configuration configuration = v.getResources().getConfiguration();
@@ -612,6 +622,7 @@
         final Workspace workspace = (Workspace) layout.getParent();
         final ViewGroup launcher = (ViewGroup) workspace.getParent();
         final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.qsb_bar);
+        final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat);
         int iconIndex = parent.indexOfChild(v);
         int iconCount = parent.getChildCount();
         int pageIndex = workspace.indexOfChild(layout);
@@ -678,11 +689,13 @@
                 break;
             case KeyEvent.KEYCODE_DPAD_DOWN:
                 if (handleKeyEvent) {
-                    // Select the closest icon in the next line, otherwise select the tab bar
+                    // Select the closest icon in the next line, otherwise select the button bar
                     View newIcon = getClosestBubbleTextViewOnLine(layout, parent, v, 1);
                     if (newIcon != null) {
                         newIcon.requestFocus();
                         wasHandled = true;
+                    } else if (hotseat != null) {
+                        hotseat.requestFocus();
                     }
                 }
                 break;
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index deab131..491691e 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -57,6 +57,7 @@
 
     public void setup(Launcher launcher) {
         mLauncher = launcher;
+        setOnKeyListener(new HotseatBubbleTextViewKeyEventListener());
     }
 
     CellLayout getLayout() {
@@ -96,11 +97,14 @@
                 inflater.inflate(R.layout.application, mContent, false);
         allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
                 context.getResources().getDrawable(R.drawable.apps_hotseat_button), null, null);
-        // button.setText(context.getString(R.string.all_apps_button_label));
+        // allAppsButton.setText(context.getString(R.string.all_apps_button_label));
+        allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
         allAppsButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(android.view.View v) {
-                mLauncher.showAllApps(true);
+                if (mLauncher != null) {
+                    mLauncher.showAllApps(true);
+                }
             }
         });
 
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0abdec0..3050be4 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2874,6 +2874,13 @@
         final Workspace workspace = mWorkspace;
         for (int i=start; i<end; i++) {
             final ItemInfo item = shortcuts.get(i);
+
+            // Short circuit if we are loading dock items for a configuration which has no dock
+            if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
+                    mHotseat == null) {
+                continue;
+            }
+
             switch (item.itemType) {
                 case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
                 case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b86fa41..e71e0f8 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -453,6 +453,7 @@
         final CellLayout layout;
         if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
             layout = mLauncher.getHotseat().getLayout();
+            child.setOnKeyListener(null);
 
             if (screen < 0) {
                 screen = mLauncher.getHotseat().getOrderInHotseat(x, y);
@@ -464,6 +465,7 @@
             }
         } else {
             layout = (CellLayout) getChildAt(screen);
+            child.setOnKeyListener(new BubbleTextViewKeyEventListener());
         }
 
         CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
