Making sure QS tile pages are reset when collapsing split shade
Expanded state passed to QSPanelController was always true for split shade. Making it work as qsExpanded in QSFragment means controller can react to not expanded state correctly and reset tile pages. That required some extra changes in NPVC, otherwise QS expansion was broken when rotating between split and portrait shade. This should have been done some time ago already as QS expanded state is working properly in split shade, that is qsExpanded is true when split shade is expanded, false otherwise. Fixes: 247799702 Test: QSFragmentTest Test: expand split shade -> swipe to another qs tiles page -> close split shade and expand it again -> qs tiles should be back to the first page Change-Id: Id5865a18273e9e3becbdc3a85be975ea1e0dae7b
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user