diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 7b27cf45979f1..653d9dd8b6a49 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -442,20 +442,19 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca } private void updateQsState() { - final boolean expanded = mQsExpanded || mInSplitShade; - final boolean expandVisually = expanded || mStackScrollerOverscrolling + final boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling || mHeaderAnimating; - mQSPanelController.setExpanded(expanded); + mQSPanelController.setExpanded(mQsExpanded); boolean keyguardShowing = isKeyguardState(); - mHeader.setVisibility((expanded || !keyguardShowing || mHeaderAnimating + mHeader.setVisibility((mQsExpanded || !keyguardShowing || mHeaderAnimating || mShowCollapsedOnKeyguard) ? View.VISIBLE : View.INVISIBLE); mHeader.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard) - || (expanded && !mStackScrollerOverscrolling), mQuickQSPanelController); + || (mQsExpanded && !mStackScrollerOverscrolling), mQuickQSPanelController); boolean qsPanelVisible = !mQsDisabled && expandVisually; - boolean footerVisible = qsPanelVisible && (expanded || !keyguardShowing || mHeaderAnimating - || mShowCollapsedOnKeyguard); + boolean footerVisible = qsPanelVisible && (mQsExpanded || !keyguardShowing + || mHeaderAnimating || mShowCollapsedOnKeyguard); mFooter.setVisibility(footerVisible ? View.VISIBLE : View.INVISIBLE); if (mQSFooterActionController != null) { mQSFooterActionController.setVisible(footerVisible); @@ -463,7 +462,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca mQSFooterActionsViewModel.onVisibilityChangeRequested(footerVisible); } mFooter.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard) - || (expanded && !mStackScrollerOverscrolling)); + || (mQsExpanded && !mStackScrollerOverscrolling)); mQSPanelController.setVisibility(qsPanelVisible ? View.VISIBLE : View.INVISIBLE); if (DEBUG) { Log.d(TAG, "Footer: " + footerVisible + ", QS Panel: " + qsPanelVisible); diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 1011a6d831e60..03dd3369773ec 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -3123,26 +3123,24 @@ public final class NotificationPanelViewController extends PanelViewController { } if (mQsExpandImmediate || (mQsExpanded && !mQsTracking && mQsExpansionAnimator == null && !mQsExpansionFromOverscroll)) { - float t; - if (mKeyguardShowing) { - + float qsExpansionFraction; + if (mSplitShadeEnabled) { + qsExpansionFraction = 1; + } else if (mKeyguardShowing) { // On Keyguard, interpolate the QS expansion linearly to the panel expansion - t = expandedHeight / (getMaxPanelHeight()); + qsExpansionFraction = expandedHeight / (getMaxPanelHeight()); } else { // In Shade, interpolate linearly such that QS is closed whenever panel height is // minimum QS expansion + minStackHeight - float - panelHeightQsCollapsed = + float panelHeightQsCollapsed = mNotificationStackScrollLayoutController.getIntrinsicPadding() + mNotificationStackScrollLayoutController.getLayoutMinHeight(); float panelHeightQsExpanded = calculatePanelHeightQsExpanded(); - t = - (expandedHeight - panelHeightQsCollapsed) / (panelHeightQsExpanded - - panelHeightQsCollapsed); + qsExpansionFraction = (expandedHeight - panelHeightQsCollapsed) + / (panelHeightQsExpanded - panelHeightQsCollapsed); } - float - targetHeight = - mQsMinExpansionHeight + t * (mQsMaxExpansionHeight - mQsMinExpansionHeight); + float targetHeight = mQsMinExpansionHeight + + qsExpansionFraction * (mQsMaxExpansionHeight - mQsMinExpansionHeight); setQsExpansion(targetHeight); } updateExpandedHeight(expandedHeight); diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java index 5d5918de3d9e0..2a66773f924e2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java @@ -402,6 +402,19 @@ public class QSFragmentTest extends SysuiBaseFragmentTest { verify(mQSPanelController).setListening(eq(true), anyBoolean()); } + @Test + public void passCorrectExpansionState_inSplitShade() { + QSFragment fragment = resumeAndGetFragment(); + enableSplitShade(); + clearInvocations(mQSPanelController); + + fragment.setExpanded(true); + verify(mQSPanelController).setExpanded(true); + + fragment.setExpanded(false); + verify(mQSPanelController).setExpanded(false); + } + @Override protected Fragment instantiate(Context context, String className, Bundle arguments) { MockitoAnnotations.initMocks(this);