OSDN Git Service

Ensure QS does not expand when qs disabled.
authorAmin Shaikh <ashaikh@google.com>
Wed, 18 Apr 2018 14:45:13 +0000 (10:45 -0400)
committerAmin Shaikh <ashaikh@google.com>
Wed, 18 Apr 2018 15:03:43 +0000 (11:03 -0400)
Remove unnecessary QSContainerImpl measure logic to constrain the
height to QQS height when QS is disabled. This interferes with
NotificationPanelView's logic for determining QS expansion.

Change-Id: I7e6659cc12dae2fbaa16d15a63c709dd96177b97
Fixes: 72739219
Test: manual

packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
packages/SystemUI/src/com/android/systemui/qs/QSFragment.java

index 1c98ef0..a44f943 100644 (file)
@@ -100,16 +100,6 @@ public class QSContainerImpl extends FrameLayout {
 
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        if (mQsDisabled) {
-            // Only show the status bar contents in QQS header when QS is disabled.
-            mHeader.measure(widthMeasureSpec, heightMeasureSpec);
-            LayoutParams layoutParams = (LayoutParams) mHeader.getLayoutParams();
-            int height = layoutParams.topMargin + layoutParams.bottomMargin
-                    + mHeader.getMeasuredHeight();
-            super.onMeasure(
-                    widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
-            return;
-        }
         // Since we control our own bottom, be whatever size we want.
         // Otherwise the QSPanel ends up with 0 height when the window is only the
         // size of the status bar.
@@ -139,8 +129,7 @@ public class QSContainerImpl extends FrameLayout {
         if (disabled == mQsDisabled) return;
         mQsDisabled = disabled;
         mBackgroundGradient.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
-        mQSPanel.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
-        mQSFooter.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
+        mBackground.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
     }
 
     private void updateResources() {
index cb068e3..b82e355 100644 (file)
@@ -105,6 +105,13 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks {
             mQSCustomizer.setEditLocation(x, y);
             mQSCustomizer.restoreInstanceState(savedInstanceState);
         }
+        SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this);
+    }
+
+    @Override
+    public void onDestroyView() {
+        SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallbacks(this);
+        super.onDestroyView();
     }
 
     @Override
@@ -203,15 +210,13 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks {
                 : View.INVISIBLE);
         mHeader.setExpanded((mKeyguardShowing && !mHeaderAnimating)
                 || (mQsExpanded && !mStackScrollerOverscrolling));
-        mFooter.setVisibility((mQsExpanded || !mKeyguardShowing || mHeaderAnimating)
+        mFooter.setVisibility(
+                !mQsDisabled && (mQsExpanded || !mKeyguardShowing || mHeaderAnimating)
                 ? View.VISIBLE
                 : View.INVISIBLE);
-        if (mQsDisabled) {
-            mFooter.setVisibility(View.GONE);
-        }
         mFooter.setExpanded((mKeyguardShowing && !mHeaderAnimating)
                 || (mQsExpanded && !mStackScrollerOverscrolling));
-        mQSPanel.setVisibility(expandVisually ? View.VISIBLE : View.INVISIBLE);
+        mQSPanel.setVisibility(!mQsDisabled && expandVisually ? View.VISIBLE : View.INVISIBLE);
     }
 
     public QSPanel getQsPanel() {
@@ -278,12 +283,6 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks {
         mHeader.setListening(listening);
         mFooter.setListening(listening);
         mQSPanel.setListening(mListening && mQsExpanded);
-        if (listening) {
-            SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this);
-        } else {
-            SysUiServiceProvider.getComponent(getContext(), CommandQueue.class)
-                    .removeCallbacks(this);
-        }
     }
 
     @Override