Interim quick settings update.

Make existing QS panel available via pulldown from header
(or keyguard status view on keyguard), update the affordances
as a hint.

Don't allow QS to scroll, cap to max rows.

Add scrim over panel to indicate that this is purely temporary.

Bug:14081801
Bug:14059974
Change-Id: I166033975cbc44b91f45ee70ea5c7540390670dd
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 6f93bed..45ac50b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -30,11 +30,14 @@
     public static final boolean DEBUG_GESTURES = true;
 
     PhoneStatusBar mStatusBar;
+    private View mHeader;
+    private View mKeyguardStatusView;
+
     private NotificationStackScrollLayout mNotificationStackScroller;
     private int[] mTempLocation = new int[2];
     private int[] mTempChildLocation = new int[2];
     private View mNotificationParent;
-
+    private boolean mTrackingSettings;
 
     public NotificationPanelView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -59,6 +62,8 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
 
+        mHeader = findViewById(R.id.header);
+        mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
         mNotificationStackScroller = (NotificationStackScrollLayout)
                 findViewById(R.id.notification_stack_scroller);
         mNotificationParent = findViewById(R.id.notification_container_parent);
@@ -99,9 +104,38 @@
     }
 
     @Override
+    public boolean onInterceptTouchEvent(MotionEvent event) {
+        // intercept for quick settings
+        if (event.getAction() == MotionEvent.ACTION_DOWN) {
+            final View target = mStatusBar.isOnKeyguard() ?  mKeyguardStatusView : mHeader;
+            final boolean inTarget = PhoneStatusBar.inBounds(target, event, true);
+            if (inTarget && !isInSettings()) {
+                mTrackingSettings = true;
+                return true;
+            }
+            if (!inTarget && isInSettings()) {
+                mTrackingSettings = true;
+                return true;
+            }
+        }
+        return super.onInterceptTouchEvent(event);
+    }
+
+    @Override
     public boolean onTouchEvent(MotionEvent event) {
         // TODO: Handle doublefinger swipe to notifications again. Look at history for a reference
         // implementation.
+        if (mTrackingSettings) {
+            mStatusBar.onSettingsEvent(event);
+            if (event.getAction() == MotionEvent.ACTION_UP
+                    || event.getAction() == MotionEvent.ACTION_CANCEL) {
+                mTrackingSettings = false;
+            }
+            return true;
+        }
+        if (isInSettings()) {
+            return true;
+        }
         return super.onTouchEvent(event);
     }