Fix occasional jank when going to QS.

We change the listening state of the QS panel before the user
actually navigates there and when the animations are probably
not running (after expanding the panel).

Change-Id: Iad48b3459e7db09c423f6983a9fec17ec0088050
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index c82bdf6..fd2db8e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -35,6 +35,7 @@
 import android.widget.TextView;
 
 import com.android.systemui.R;
+import com.android.systemui.qs.QSPanel;
 import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.FlingAnimationUtils;
 import com.android.systemui.statusbar.GestureRecorder;
@@ -61,7 +62,7 @@
     private KeyguardPageSwipeHelper mPageSwiper;
     private StatusBarHeaderView mHeader;
     private View mQsContainer;
-    private View mQsPanel;
+    private QSPanel mQsPanel;
     private View mKeyguardStatusView;
     private ObservableScrollView mScrollView;
     private TextView mClockView;
@@ -136,7 +137,7 @@
         mHeader.setOverlayParent(this);
         mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
         mQsContainer = findViewById(R.id.quick_settings_container);
-        mQsPanel = findViewById(R.id.quick_settings_panel);
+        mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
         mClockView = (TextView) findViewById(R.id.clock_view);
         mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view);
         mScrollView.setListener(this);
@@ -873,6 +874,20 @@
         super.onExpandingFinished();
         mNotificationStackScroller.onExpansionStopped();
         mIsExpanding = false;
+        if (mExpandedHeight == 0f) {
+            mHeader.setListening(false);
+            mQsPanel.setListening(false);
+        } else {
+            mHeader.setListening(true);
+            mQsPanel.setListening(true);
+        }
+    }
+
+    @Override
+    public void instantExpand() {
+        super.instantExpand();
+        mHeader.setListening(true);
+        mQsPanel.setListening(true);
     }
 
     @Override