Fix 6398209: SearchPanel gesture improvements

This fixes a few recent regressions caused by other bug fixes:
- add new flags to animateCollapse() so we can selectively close panels. Fixes regression caused by attempt to close recent apps from startAssistActivity() which had the side effect of closing the search panel before the animation completes.
- adds tuneable holdoff delay for responding to home key press.
- minor tweaks to MultiWaveView animations.

Change-Id: Ia48434b8d59e7b0290a5e9783960c2f684068218
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 4209354..a00d95a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -66,6 +66,13 @@
 
     private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT;
 
+    public static final int FLAG_EXCLUDE_NONE = 0;
+    public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
+    public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
+    public static final int FLAG_EXCLUDE_NOTIFICATION_PANEL = 1 << 2;
+    public static final int FLAG_EXCLUDE_INPUT_METHODS_PANEL = 1 << 3;
+    public static final int FLAG_EXCLUDE_COMPAT_MODE_PANEL = 1 << 4;
+
     private StatusBarIconList mList;
     private Callbacks mCallbacks;
     private Handler mHandler = new H();
@@ -88,7 +95,7 @@
         public void removeNotification(IBinder key);
         public void disable(int state);
         public void animateExpand();
-        public void animateCollapse();
+        public void animateCollapse(int flags);
         public void setSystemUiVisibility(int vis, int mask);
         public void topAppWindowChanged(boolean visible);
         public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
@@ -161,9 +168,13 @@
     }
 
     public void animateCollapse() {
+        animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE);
+    }
+
+    public void animateCollapse(int flags) {
         synchronized (mList) {
             mHandler.removeMessages(MSG_SET_VISIBILITY);
-            mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, 0, null).sendToTarget();
+            mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, flags, null).sendToTarget();
         }
     }
 
@@ -277,7 +288,7 @@
                     if (msg.arg1 == OP_EXPAND) {
                         mCallbacks.animateExpand();
                     } else {
-                        mCallbacks.animateCollapse();
+                        mCallbacks.animateCollapse(msg.arg2);
                     }
                     break;
                 case MSG_SET_SYSTEMUI_VISIBILITY: