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

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

Merge "Hide empty shade when qsExpansion >= 0.9" into main

parents d5306f77 b39cd6da
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import com.android.systemui.keyguard.shared.model.StatusBarState
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.data.repository.fakePowerRepository
import com.android.systemui.power.shared.model.WakefulnessState
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.domain.interactor.enableDualShade
import com.android.systemui.shade.domain.interactor.enableSingleShade
@@ -42,7 +41,6 @@ import com.android.systemui.statusbar.notification.data.repository.setActiveNoti
import com.android.systemui.statusbar.notification.headsup.PinnedStatus
import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository
import com.android.systemui.statusbar.policy.data.repository.fakeUserSetupRepository
import com.android.systemui.statusbar.policy.fakeConfigurationController
import com.android.systemui.testKosmos
import com.android.systemui.util.ui.isAnimating
import com.android.systemui.util.ui.value
@@ -69,7 +67,6 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
    private val testScope = kosmos.testScope

    private val activeNotificationListRepository = kosmos.activeNotificationListRepository
    private val fakeConfigurationController = kosmos.fakeConfigurationController
    private val fakeKeyguardRepository = kosmos.fakeKeyguardRepository
    private val fakePowerRepository = kosmos.fakePowerRepository
    private val fakeRemoteInputRepository = kosmos.fakeRemoteInputRepository
@@ -203,10 +200,9 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
            activeNotificationListRepository.setActiveNotifs(count = 0)
            // AND quick settings are expanded
            shadeTestUtil.setQsExpansion(1f)
            // AND split shade is expanded
            overrideResource(R.bool.config_use_split_notification_shade, true)
            // AND split shade is enabled
            shadeTestUtil.setShadeExpansion(1f)
            fakeConfigurationController.notifyConfigurationChanged()
            shadeTestUtil.setSplitShade(true)
            runCurrent()

            // THEN empty shade is visible
@@ -387,8 +383,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas
            fakeKeyguardRepository.setStatusBarState(StatusBarState.SHADE)
            shadeTestUtil.setShadeExpansion(1f)
            // AND split shade is enabled
            overrideResource(R.bool.config_use_split_notification_shade, true)
            fakeConfigurationController.notifyConfigurationChanged()
            shadeTestUtil.setSplitShade(true)
            runCurrent()

            // THEN footer is visible
+12 −3
Original line number Diff line number Diff line
@@ -93,12 +93,17 @@ constructor(
    val shouldShowEmptyShadeView: Flow<AnimatedValue<Boolean>> by lazy {
        combine(
                activeNotificationsInteractor.areAnyNotificationsPresent,
                shadeInteractor.isQsFullscreen,
                shadeInteractor.qsExpansion
                    .map { it >= QS_EXPANSION_THRESHOLD }
                    .distinctUntilChanged(),
                shadeModeInteractor.shadeMode.map { it == ShadeMode.Split },
                notificationStackInteractor.isShowingOnLockscreen,
            ) { hasNotifications, isQsFullScreen, isShowingOnLockscreen ->
            ) { hasNotifications, qsExpandedEnough, isSplitShade, isShowingOnLockscreen ->
                when {
                    hasNotifications -> false
                    isQsFullScreen -> false
                    // Hide the empty shade when QS is close to being full screen. We use this
                    // instead of isQsFullscreen to avoid some flickering.
                    qsExpandedEnough && !isSplitShade -> false
                    // Do not show the empty shade if the lockscreen is visible (including AOD
                    // b/228790482 and bouncer b/267060171), except if the shade is opened on
                    // top.
@@ -365,4 +370,8 @@ constructor(
    fun setHeadsUpAnimatingAway(animatingAway: Boolean) {
        headsUpNotificationInteractor.setHeadsUpAnimatingAway(animatingAway)
    }

    companion object {
        const val QS_EXPANSION_THRESHOLD = 0.9
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ class ShadeTestUtil(val delegate: ShadeTestUtilDelegate) {
    fun setQsFullscreen(qsFullscreen: Boolean) {
        delegate.assertFlagValid()
        delegate.setQsFullscreen(qsFullscreen)

        // If QS is full screen, expansion is 1 and split shade is off.
        delegate.setQsExpansion(1.0f)
        delegate.setSplitShade(false)
    }

    fun setLegacyExpandedOrAwaitingInputTransfer(legacyExpandedOrAwaitingInputTransfer: Boolean) {