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

Commit 9358d9b5 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge changes Id3b3a12b,I1a2b4244 into main

* changes:
  Fix shadeExpansion being 0 when QS partially expanded
  Fix qsFullScreen when QS only partially expanded
parents c8ba8603 c1db292b
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ class ShadeInteractorImplTest : SysuiTestCase() {
        }

    @Test
    fun shadeExpansionWhenNotInSplitShadeAndQsExpanded() =
    fun shadeExpansionWhenNotInSplitShadeAndQsPartiallyExpanded() =
        testScope.runTest {
            val actual by collectLastValue(underTest.shadeExpansion)

@@ -337,6 +337,22 @@ class ShadeInteractorImplTest : SysuiTestCase() {
            shadeRepository.setLegacyShadeExpansion(1f)
            runCurrent()

            // THEN shade expansion is zero
            assertThat(actual).isEqualTo(.5f)
        }

    @Test
    fun shadeExpansionWhenNotInSplitShadeAndQsFullyExpanded() =
        testScope.runTest {
            val actual by collectLastValue(underTest.shadeExpansion)

            // WHEN split shade is not enabled and QS is expanded
            keyguardRepository.setStatusBarState(StatusBarState.SHADE)
            overrideResource(R.bool.config_use_split_notification_shade, false)
            shadeRepository.setQsExpansion(1f)
            shadeRepository.setLegacyShadeExpansion(1f)
            runCurrent()

            // THEN shade expansion is zero
            assertThat(actual).isEqualTo(0f)
        }
+22 −4
Original line number Diff line number Diff line
@@ -95,14 +95,14 @@ class ShadeInteractorLegacyImplTest : SysuiTestCase() {
        }

    @Test
    fun shadeExpansionWhenNotInSplitShadeAndQsExpanded() =
    fun shadeExpansionWhenNotInSplitShadeAndQsFullyExpanded() =
        testScope.runTest {
            val actual by collectLastValue(underTest.shadeExpansion)

            // WHEN split shade is not enabled and QS is expanded
            keyguardRepository.setStatusBarState(StatusBarState.SHADE)
            overrideResource(R.bool.config_use_split_notification_shade, false)
            shadeRepository.setQsExpansion(.5f)
            shadeRepository.setQsExpansion(1f)
            shadeRepository.setLegacyShadeExpansion(1f)
            runCurrent()

@@ -110,17 +110,35 @@ class ShadeInteractorLegacyImplTest : SysuiTestCase() {
            assertThat(actual).isEqualTo(0f)
        }

    @Test
    fun shadeExpansionWhenNotInSplitShadeAndQsPartlyExpanded() =
        testScope.runTest {
            val actual by collectLastValue(underTest.shadeExpansion)

            // WHEN split shade is not enabled and QS partly expanded
            keyguardRepository.setStatusBarState(StatusBarState.SHADE)
            overrideResource(R.bool.config_use_split_notification_shade, false)
            shadeRepository.setQsExpansion(.4f)
            shadeRepository.setLegacyShadeExpansion(1f)
            runCurrent()

            // THEN shade expansion is the difference
            assertThat(actual).isEqualTo(.6f)
        }

    @Test
    fun shadeExpansionWhenNotInSplitShadeAndQsCollapsed() =
        testScope.runTest {
            val actual by collectLastValue(underTest.shadeExpansion)

            // WHEN split shade is not enabled and QS is expanded
            // WHEN split shade is not enabled and QS collapsed
            keyguardRepository.setStatusBarState(StatusBarState.SHADE)
            overrideResource(R.bool.config_use_split_notification_shade, false)
            shadeRepository.setQsExpansion(0f)
            shadeRepository.setLegacyShadeExpansion(.6f)
            runCurrent()

            // THEN shade expansion is zero
            // THEN shade expansion is the legacy one
            assertThat(actual).isEqualTo(.6f)
        }

+15 −0
Original line number Diff line number Diff line
@@ -482,6 +482,21 @@ class NotificationListViewModelTest : SysuiTestCase() {
            assertThat(shouldHide).isFalse()
        }

    @Test
    fun shouldHideFooterView_falseWhenQSPartiallyOpen() =
        testScope.runTest {
            val shouldHide by collectLastValue(underTest.shouldHideFooterView)

            // WHEN QS partially open
            fakeKeyguardRepository.setStatusBarState(StatusBarState.SHADE)
            fakeShadeRepository.setQsExpansion(0.5f)
            fakeShadeRepository.setLegacyShadeExpansion(0.5f)
            runCurrent()

            // THEN footer is hidden
            assertThat(shouldHide).isFalse()
        }

    @Test
    @EnableFlags(NotificationsHeadsUpRefactor.FLAG_NAME)
    fun pinnedHeadsUpRows_filtersForPinnedItems() =
+14 −2
Original line number Diff line number Diff line
@@ -965,14 +965,21 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
        }
    }

    void updateQsState() {
        boolean qsFullScreen = getExpanded() && !mSplitShadeEnabled;
    private void setQsFullScreen(boolean qsFullScreen) {
        mShadeRepository.setLegacyQsFullscreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        if (!SceneContainerFlag.isEnabled()) {
            mNotificationStackScrollLayoutController.setScrollingEnabled(
                    mBarState != KEYGUARD && (!qsFullScreen || mExpansionFromOverscroll));
        }
    }

    void updateQsState() {
        if (!FooterViewRefactor.isEnabled()) {
            // Update full screen state; note that this will be true if the QS panel is only
            // partially expanded, and that is fixed with the footer view refactor.
            setQsFullScreen(/* qsFullScreen = */ getExpanded() && !mSplitShadeEnabled);
        }

        if (mQsStateUpdateListener != null) {
            mQsStateUpdateListener.onQsStateUpdated(getExpanded(), mStackScrollerOverscrolling);
@@ -1035,6 +1042,11 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum

        // Update the light bar
        mLightBarController.setQsExpanded(mFullyExpanded);

        if (FooterViewRefactor.isEnabled()) {
            // Update full screen state
            setQsFullScreen(/* qsFullScreen = */ mFullyExpanded && !mSplitShadeEnabled);
        }
    }

    float getLockscreenShadeDragProgress() {
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ constructor(
                when (statusBarState) {
                    // legacyShadeExpansion is 1 instead of 0 when QS is expanded
                    StatusBarState.SHADE ->
                        if (!splitShadeEnabled && qsExpansion > 0f) 0f else legacyShadeExpansion
                        if (!splitShadeEnabled && qsExpansion > 0f) 1f - qsExpansion
                        else legacyShadeExpansion
                    StatusBarState.KEYGUARD -> lockscreenShadeExpansion
                    // dragDownAmount, which drives lockscreenShadeExpansion resets to 0f when
                    // the pointer is lifted and the lockscreen shade is fully expanded
Loading