Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 842c4088 authored by Vania Januar's avatar Vania Januar Committed by Automerger Merge Worker
Browse files

Collapse the notification shade when closing the QS using the back button in...

Collapse the notification shade when closing the QS using the back button in split shade mode. am: 947e01c8 am: 30588979

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19293056



Change-Id: Ibe299bbaa07bbddce5a587cf0713c1d26adfc6a0
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f138afb8 30588979
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1702,10 +1702,17 @@ public final class NotificationPanelViewController extends PanelViewController {
    /**
     * Animate QS closing by flinging it.
     * If QS is expanded, it will collapse into QQS and stop.
     * If in split shade, it will collapse the whole shade.
     *
     * @param animateAway Do not stop when QS becomes QQS. Fling until QS isn't visible anymore.
     */
    public void animateCloseQs(boolean animateAway) {
        if (mSplitShadeEnabled) {
            collapsePanel(
                    /* animate= */true, /* delayed= */false, /* speedUpFactor= */1.0f);
            return;
        }

        if (mQsExpansionAnimator != null) {
            if (!mQsAnimatorExpand) {
                return;
@@ -3378,19 +3385,11 @@ public final class NotificationPanelViewController extends PanelViewController {
        return mQsExpanded;
    }

    public boolean isQsDetailShowing() {
        return mQs.isShowingDetail();
    }

    /** Returns whether the QS customizer is currently active. */
    public boolean isQsCustomizing() {
        return mQs.isCustomizing();
    }

    public void closeQsDetail() {
        mQs.closeDetail();
    }

    /** Close the QS customizer if it is open. */
    public void closeQsCustomizer() {
        mQs.closeCustomizer();
+0 −4
Original line number Diff line number Diff line
@@ -3308,11 +3308,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
            return true;
        }
        if (mNotificationPanelViewController.isQsExpanded()) {
            if (mNotificationPanelViewController.isQsDetailShowing()) {
                mNotificationPanelViewController.closeQsDetail();
            } else {
                mNotificationPanelViewController.animateCloseQs(false /* animateAway */);
            }
            return true;
        }
        if (mNotificationPanelViewController.closeUserSwitcherIfOpen()) {
+23 −0
Original line number Diff line number Diff line
@@ -1283,6 +1283,29 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        assertThat(mNotificationPanelViewController.isQsExpanded()).isFalse();
    }

    @Test
    public void testPanelClosedWhenClosingQsInSplitShade() {
        mPanelExpansionStateManager.onPanelExpansionChanged(/* fraction= */ 1,
                /* expanded= */ true, /* tracking= */ false, /* dragDownPxAmount= */ 0);
        enableSplitShade(/* enabled= */ true);
        mNotificationPanelViewController.setExpandedFraction(1f);

        assertThat(mNotificationPanelViewController.isClosing()).isFalse();
        mNotificationPanelViewController.animateCloseQs(false);
        assertThat(mNotificationPanelViewController.isClosing()).isTrue();
    }

    @Test
    public void testPanelStaysOpenWhenClosingQs() {
        mPanelExpansionStateManager.onPanelExpansionChanged(/* fraction= */ 1,
                /* expanded= */ true, /* tracking= */ false, /* dragDownPxAmount= */ 0);
        mNotificationPanelViewController.setExpandedFraction(1f);

        assertThat(mNotificationPanelViewController.isClosing()).isFalse();
        mNotificationPanelViewController.animateCloseQs(false);
        assertThat(mNotificationPanelViewController.isClosing()).isFalse();
    }

    @Test
    public void interceptTouchEvent_withinQs_shadeExpanded_startsQsTracking() {
        mNotificationPanelViewController.mQs = mQs;