am 31bbf9cb: Stop trying to play tricks with the focusability of the search widget\'s TextView, as we weren\'t always doing it right, and it doesn\'t seem to help or hurt the frequency of the home screen sliding up when the widget is selected (that seems to be separate,

Merge commit '31bbf9cbff8d5db6ab3b1cd93497045acdb8f74a'

* commit '31bbf9cbff8d5db6ab3b1cd93497045acdb8f74a':
  Stop trying to play tricks with the focusability of the search widget's
diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml
index 9197c30..60bfe82 100644
--- a/res/xml/default_workspace.xml
+++ b/res/xml/default_workspace.xml
@@ -42,12 +42,14 @@
         launcher:x="2"
         launcher:y="3" />
 
+<!--
     <favorite
         launcher:packageName="com.google.android.apps.maps"
         launcher:className="com.google.android.maps.MapsActivity"
         launcher:screen="1"
         launcher:x="3"
         launcher:y="3" />
+-->
 
     <favorite
         launcher:packageName="com.android.mms"
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 3fd141d..f1af0b1 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -200,6 +200,9 @@
     private boolean mWaitingForResult;
     private boolean mLocaleChanged;
 
+    private boolean mHomeDown;
+    private boolean mBackDown;
+    
     private Bundle mSavedInstanceState;
 
     private DesktopBinder mBinder;
@@ -1305,18 +1308,39 @@
     }
 
     @Override
+    public void onWindowFocusChanged(boolean hasFocus) {
+        super.onWindowFocusChanged(hasFocus);
+        if (!hasFocus) {
+            mBackDown = mHomeDown = false;
+        }
+    }
+
+    @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         if (event.getAction() == KeyEvent.ACTION_DOWN) {
             switch (event.getKeyCode()) {
                 case KeyEvent.KEYCODE_BACK:
-                    mWorkspace.dispatchKeyEvent(event);
-                    if (mDrawer.isOpened()) {
-                        closeDrawer();
-                    } else {
-                        closeFolder();
-                    }
+                    mBackDown = true;
                     return true;
                 case KeyEvent.KEYCODE_HOME:
+                    mHomeDown = true;
+                    return true;
+            }
+        } else if (event.getAction() == KeyEvent.ACTION_UP) {
+            switch (event.getKeyCode()) {
+                case KeyEvent.KEYCODE_BACK:
+                    if (!event.isCanceled()) {
+                        mWorkspace.dispatchKeyEvent(event);
+                        if (mDrawer.isOpened()) {
+                            closeDrawer();
+                        } else {
+                            closeFolder();
+                        }
+                    }
+                    mBackDown = false;
+                    return true;
+                case KeyEvent.KEYCODE_HOME:
+                    mHomeDown = false;
                     return true;
             }
         }