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

Commit 9e2b5fc9 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Keep notifications hidden when dreaming" into main

parents 7bc8de43 ae90088e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -290,10 +290,15 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
        testScope.runTest {
            val alpha by collectLastValue(underTest.glanceableHubAlpha)

            // Start on dream
            showDream()
            // Start on lockscreen, notifications should be unhidden.
            showLockscreen()
            assertThat(alpha).isEqualTo(1f)

            // Transition to dream, notifications should be hidden so that transition
            // from dream->hub doesn't cause notification flicker.
            showDream()
            assertThat(alpha).isEqualTo(0f)

            // Start transitioning to glanceable hub
            val progress = 0.6f
            keyguardTransitionRepository.sendTransitionStep(
+6 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.view.View
import android.view.WindowInsets
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.systemui.Flags.communalHub
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.ui.viewmodel.BurnInParameters
@@ -150,6 +151,7 @@ constructor(
                        }
                    }

                    if (communalHub()) {
                        launch {
                            viewModel.glanceableHubAlpha.collect {
                                controller.setMaxAlphaForGlanceableHub(it)
@@ -157,6 +159,7 @@ constructor(
                        }
                    }
                }
            }

        if (sceneContainerFlags.isEnabled()) {
            disposables += notificationStackViewBinder.bindWhileAttached()
+21 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.KeyguardState.ALTERNATE_BOUNCER
import com.android.systemui.keyguard.shared.model.KeyguardState.AOD
import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING
import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING
import com.android.systemui.keyguard.shared.model.KeyguardState.GLANCEABLE_HUB
import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
@@ -241,7 +242,22 @@ constructor(
                started = SharingStarted.Eagerly,
                initialValue = false,
            )
            .dumpWhileCollecting("isOnGlanceableHubWithoutShade")
            .dumpValue("isOnGlanceableHubWithoutShade")

    /** Are we on the dream without the shade/qs? */
    private val isDreamingWithoutShade: Flow<Boolean> =
        combine(
                keyguardTransitionInteractor.isFinishedInState(DREAMING),
                isAnyExpanded,
            ) { isDreaming, isAnyExpanded ->
                isDreaming && !isAnyExpanded
            }
            .stateIn(
                scope = applicationScope,
                started = SharingStarted.Eagerly,
                initialValue = false,
            )
            .dumpValue("isDreamingWithoutShade")

    /**
     * Fade in if the user swipes the shade back up, not if collapsed by going to AOD. This is
@@ -460,6 +476,7 @@ constructor(
        combineTransform(
                isOnGlanceableHubWithoutShade,
                isOnLockscreen,
                isDreamingWithoutShade,
                merge(
                        lockscreenToGlanceableHubTransitionViewModel.notificationAlpha,
                        glanceableHubToLockscreenTransitionViewModel.notificationAlpha,
@@ -467,9 +484,9 @@ constructor(
                    // Manually emit on start because [notificationAlpha] only starts emitting
                    // when transitions start.
                    .onStart { emit(1f) }
            ) { isOnGlanceableHubWithoutShade, isOnLockscreen, alpha,
            ) { isOnGlanceableHubWithoutShade, isOnLockscreen, isDreamingWithoutShade, alpha,
                ->
                if (isOnGlanceableHubWithoutShade && !isOnLockscreen) {
                if ((isOnGlanceableHubWithoutShade || isDreamingWithoutShade) && !isOnLockscreen) {
                    // Notifications should not be visible on the glanceable hub.
                    // TODO(b/321075734): implement a way to actually set the notifications to
                    // gone while on the hub instead of just adjusting alpha
@@ -484,6 +501,7 @@ constructor(
                    emit(1f)
                }
            }
            .distinctUntilChanged()
            .dumpWhileCollecting("glanceableHubAlpha")

    /**