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

Commit aad59b51 authored by Chandru S's avatar Chandru S
Browse files

Blur notification shade when bouncer is open

Bug: 388068805
Test: verified manually
Flag: com.android.systemui.scene_container
Change-Id: I5277214fd69246d60846c5bf598894d19a54232f
parent 81f25bed
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -46,10 +46,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.blur
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.dp
@@ -152,13 +154,15 @@ constructor(
            rememberViewModel("ShadeScene-notifPlaceholderViewModel") {
            rememberViewModel("ShadeScene-notifPlaceholderViewModel") {
                notificationsPlaceholderViewModelFactory.create()
                notificationsPlaceholderViewModelFactory.create()
            }
            }
        val isShadeBlurred = viewModel.isShadeBlurred
        val shadeBlurRadius = with(LocalDensity.current) { viewModel.shadeBlurRadius.toDp() }
        ShadeScene(
        ShadeScene(
            notificationStackScrollView.get(),
            notificationStackScrollView.get(),
            viewModel = viewModel,
            viewModel = viewModel,
            headerViewModel = headerViewModel,
            headerViewModel = headerViewModel,
            notificationsPlaceholderViewModel = notificationsPlaceholderViewModel,
            notificationsPlaceholderViewModel = notificationsPlaceholderViewModel,
            jankMonitor = jankMonitor,
            jankMonitor = jankMonitor,
            modifier = modifier,
            modifier = modifier.thenIf(isShadeBlurred) { Modifier.blur(shadeBlurRadius) },
            shadeSession = shadeSession,
            shadeSession = shadeSession,
        )
        )
    }
    }
+13 −0
Original line number Original line Diff line number Diff line
@@ -18,11 +18,14 @@ package com.android.systemui.shade.ui.viewmodel


import androidx.annotation.FloatRange
import androidx.annotation.FloatRange
import androidx.compose.runtime.getValue
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleOwner
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.Flags
import com.android.systemui.Flags
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.ui.transitions.BlurConfig
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.lifecycle.Hydrator
import com.android.systemui.lifecycle.Hydrator
import com.android.systemui.media.controls.domain.pipeline.interactor.MediaCarouselInteractor
import com.android.systemui.media.controls.domain.pipeline.interactor.MediaCarouselInteractor
@@ -75,6 +78,8 @@ constructor(
    disableFlagsInteractor: DisableFlagsInteractor,
    disableFlagsInteractor: DisableFlagsInteractor,
    private val footerActionsViewModelFactory: FooterActionsViewModel.Factory,
    private val footerActionsViewModelFactory: FooterActionsViewModel.Factory,
    private val footerActionsController: FooterActionsController,
    private val footerActionsController: FooterActionsController,
    keyguardInteractor: KeyguardInteractor,
    blurConfig: BlurConfig,
    unfoldTransitionInteractor: UnfoldTransitionInteractor,
    unfoldTransitionInteractor: UnfoldTransitionInteractor,
    deviceEntryInteractor: DeviceEntryInteractor,
    deviceEntryInteractor: DeviceEntryInteractor,
    private val sceneInteractor: SceneInteractor,
    private val sceneInteractor: SceneInteractor,
@@ -103,6 +108,14 @@ constructor(
    val shadeMode: ShadeMode by
    val shadeMode: ShadeMode by
        hydrator.hydratedStateOf(traceName = "shadeMode", source = shadeModeInteractor.shadeMode)
        hydrator.hydratedStateOf(traceName = "shadeMode", source = shadeModeInteractor.shadeMode)


    val isShadeBlurred: Boolean by
        hydrator.hydratedStateOf(
            traceName = "isShadeBlurred",
            source = keyguardInteractor.primaryBouncerShowing,
        )

    val shadeBlurRadius: Float by mutableFloatStateOf(blurConfig.maxBlurRadiusPx)

    /** Whether clicking on the empty area of the shade should do something. */
    /** Whether clicking on the empty area of the shade should do something. */
    val isEmptySpaceClickable: Boolean by
    val isEmptySpaceClickable: Boolean by
        hydrator.hydratedStateOf(
        hydrator.hydratedStateOf(
+4 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.systemui.shade.ui.viewmodel
package com.android.systemui.shade.ui.viewmodel


import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.ui.transitions.blurConfig
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testDispatcher
@@ -52,6 +54,8 @@ val Kosmos.shadeSceneContentViewModel: ShadeSceneContentViewModel by Fixture {
        mediaViewModelFactory = mediaViewModelFactory,
        mediaViewModelFactory = mediaViewModelFactory,
        windowRootViewBlurInteractor = windowRootViewBlurInteractor,
        windowRootViewBlurInteractor = windowRootViewBlurInteractor,
        mediaInRowInLandscapeViewModelFactory = mediaInRowInLandscapeViewModelFactory,
        mediaInRowInLandscapeViewModelFactory = mediaInRowInLandscapeViewModelFactory,
        keyguardInteractor = keyguardInteractor,
        blurConfig = blurConfig,
    )
    )
}
}