Fix issues with how the gestures pad was hidden when leaving Home.
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 0c54382..51b720b 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -230,6 +230,7 @@
     private Launcher.GesturesProcessor mGesturesProcessor;
     private Gesture mCurrentGesture;
     private GesturesAction mGesturesAction;
+    private boolean mHideGesturesPanel;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -337,6 +338,8 @@
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        mWaitingForResult = false;
+
         // The pattern used here is that a user PICKs a specific application,
         // which, depending on the target, might need to CREATE the actual target.
 
@@ -389,7 +392,6 @@
                 mAppWidgetHost.deleteAppWidgetId(appWidgetId);
             }
         }
-        mWaitingForResult = false;
     }
 
     @Override
@@ -417,7 +419,10 @@
     @Override
     protected void onStop() {
         super.onStop();
-        hideGesturesPanel();
+        if (mHideGesturesPanel) {
+            mHideGesturesPanel = false;
+            hideGesturesPanel();
+        }
     }
 
     @Override
@@ -1689,6 +1694,7 @@
     }
 
     void startActivitySafely(Intent intent) {
+        mHideGesturesPanel = true;
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         try {
             startActivity(intent);