QuickSettings: Maintain tile panel Y in detail mode.

Hide the brightness slider to reduce visual clutter.
Stabilize the tile panel further by preventing it from
shrinking to less than the tiles height.

Bug:15341870
Change-Id: I785ff9c13f8489e86e3bdc8dde45ebd39f9a1413
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 dce5a30..802e5e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -34,7 +34,6 @@
 import android.widget.LinearLayout;
 
 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;
@@ -52,7 +51,7 @@
     PhoneStatusBar mStatusBar;
     private StatusBarHeaderView mHeader;
     private View mQsContainer;
-    private QSPanel mQsPanel;
+    private View mQsPanel;
     private View mKeyguardStatusView;
     private ObservableScrollView mScrollView;
     private View mStackScrollerContainer;
@@ -71,7 +70,6 @@
      */
     private boolean mIntercepting;
     private boolean mQsExpanded;
-    private boolean mQsFullyExpanded;
     private boolean mKeyguardShowing;
     private float mInitialHeightOnTouch;
     private float mInitialTouchX;
@@ -83,14 +81,13 @@
     private int mQsMaxExpansionHeight;
     private int mMinStackHeight;
     private int mQsPeekHeight;
-    private int mQsHeaderPeekHeight;
-    private boolean mQsShowingDetail;
     private float mNotificationTranslation;
     private int mStackScrollerIntrinsicPadding;
     private boolean mQsExpansionEnabled = true;
     private ValueAnimator mQsExpansionAnimator;
     private FlingAnimationUtils mFlingAnimationUtils;
     private int mStatusBarMinHeight;
+
     private Interpolator mFastOutSlowInInterpolator;
     private ObjectAnimator mClockAnimator;
     private int mClockAnimationTarget = -1;
@@ -133,8 +130,7 @@
         mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
         mStackScrollerContainer = findViewById(R.id.notification_container_parent);
         mQsContainer = findViewById(R.id.quick_settings_container);
-        mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
-        mQsPanel.setCallback(mQsPanelCallback);
+        mQsPanel = findViewById(R.id.quick_settings_panel);
         mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view);
         mScrollView.setListener(this);
         mNotificationStackScroller = (NotificationStackScrollLayout)
@@ -158,7 +154,6 @@
         mStatusBarMinHeight = getResources().getDimensionPixelSize(
                 com.android.internal.R.dimen.status_bar_height);
         mQsPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_peek_height);
-        mQsHeaderPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_header_peek_height);
         mClockPositionAlgorithm.loadDimens(getResources());
     }
 
@@ -170,9 +165,7 @@
         mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight;
         mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight();
         if (mQsExpanded) {
-            if (mQsFullyExpanded) {
-                setQsStackScrollerPadding(mQsMaxExpansionHeight);
-            }
+            setQsStackScrollerPadding(mQsMaxExpansionHeight);
         } else {
             setQsExpansion(mQsMinExpansionHeight);
             positionClockAndNotifications();
@@ -525,39 +518,10 @@
                 ? View.INVISIBLE
                 : View.VISIBLE);
         mScrollView.setTouchEnabled(mQsExpanded);
-        if (mQsShowingDetail) {
-            if (mQsFullyExpanded) {
-                setQsHeaderPeeking(true);
-            }
-        } else {
-            setQsHeaderPeeking(false);
-        }
-    }
-
-    private void setQsHeaderPeeking(boolean peeking) {
-        final boolean stackIsPeeking = mStackScrollerContainer.getTranslationY() != 0;
-        final boolean headerIsPeeking = mHeader.getTranslationY() != 0;
-        final int ty = mQsHeaderPeekHeight - mHeader.getExpandedHeight();
-        if (peeking) {
-            if (!headerIsPeeking) {
-                mHeader.animate().translationY(ty);
-            }
-            if (!stackIsPeeking) {
-                mStackScrollerContainer.animate().translationY(ty);
-            }
-        } else {
-            if (headerIsPeeking) {
-                mHeader.animate().translationY(0);
-            }
-            if (stackIsPeeking) {
-                mStackScrollerContainer.animate().translationY(0);
-            }
-        }
     }
 
     private void setQsExpansion(float height) {
         height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
-        mQsFullyExpanded = height == mQsMaxExpansionHeight;
         if (height > mQsMinExpansionHeight && !mQsExpanded) {
             setQsExpanded(true);
         } else if (height <= mQsMinExpansionHeight && mQsExpanded) {
@@ -650,16 +614,10 @@
         if (!mQsExpansionEnabled) {
             return false;
         }
-        final float ty = mHeader.getTranslationY();
         boolean onHeader = x >= mHeader.getLeft() && x <= mHeader.getRight()
-                && y >= mHeader.getTop() + ty && y <= mHeader.getBottom() + ty;
+                && y >= mHeader.getTop() && y <= mHeader.getBottom();
         if (mQsExpanded) {
-            if (mQsShowingDetail && onHeader) {
-                // bring back the header, crudely
-                setQsHeaderPeeking(false);
-                mQsPanel.setExpanded(false);
-            }
-            return !mQsShowingDetail && onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0);
+            return onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0);
         } else {
             return onHeader;
         }
@@ -823,12 +781,4 @@
     public View getRightIcon() {
         return mKeyguardBottomArea.getCameraImageView();
     }
-
-    private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() {
-        @Override
-        public void onShowingDetail(boolean showingDetail) {
-            mQsShowingDetail = showingDetail;
-            updateQsState();
-        }
-    };
 }