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

Commit 524018b7 authored by Lucas Silva's avatar Lucas Silva
Browse files

Update communal background to be animated by default

Use the animated variant of the communal hub background by default.

Fixes: 350545475
Test: atest CommunalSettingsRepositoryImplTest
Test: flashed device and verified background is animated
Flag: com.android.systemui.communal_hub
Change-Id: Icaad209de3c33ce12c01fd5dd98f6367bcf7f3a2
parent 37230d65
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ fun CommunalContainer(
        viewModel.showGestureIndicator.collectAsStateWithLifecycle(initialValue = false)
    val backgroundType by
        viewModel.communalBackground.collectAsStateWithLifecycle(
            initialValue = CommunalBackgroundType.DEFAULT
            initialValue = CommunalBackgroundType.ANIMATED
        )
    val state: MutableSceneTransitionLayoutState = remember {
        MutableSceneTransitionLayoutState(
@@ -243,7 +243,7 @@ private fun SceneScope.CommunalScene(
) {
    Box(modifier = Modifier.element(Communal.Elements.Scrim).fillMaxSize()) {
        when (backgroundType) {
            CommunalBackgroundType.DEFAULT -> DefaultBackground(colors = colors)
            CommunalBackgroundType.STATIC -> DefaultBackground(colors = colors)
            CommunalBackgroundType.STATIC_GRADIENT -> StaticLinearGradient()
            CommunalBackgroundType.ANIMATED -> AnimatedLinearGradient()
            CommunalBackgroundType.NONE -> BackgroundTopScrim()
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ class CommunalSettingsRepositoryImplTest : SysuiTestCase() {
    fun backgroundType_defaultValue() =
        testScope.runTest {
            val backgroundType by collectLastValue(underTest.getBackground(PRIMARY_USER))
            assertThat(backgroundType).isEqualTo(CommunalBackgroundType.DEFAULT)
            assertThat(backgroundType).isEqualTo(CommunalBackgroundType.ANIMATED)
        }

    @Test
+2 −2
Original line number Diff line number Diff line
@@ -115,11 +115,11 @@ constructor(
                val intType =
                    secureSettings.getIntForUser(
                        GLANCEABLE_HUB_BACKGROUND_SETTING,
                        CommunalBackgroundType.DEFAULT.value,
                        CommunalBackgroundType.ANIMATED.value,
                        user.id
                    )
                CommunalBackgroundType.entries.find { type -> type.value == intType }
                    ?: CommunalBackgroundType.DEFAULT
                    ?: CommunalBackgroundType.ANIMATED
            }

    private fun getEnabledByUser(user: UserInfo): Flow<Boolean> =
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.systemui.communal.shared.model

/** Models the types of background that can be shown on the hub. */
enum class CommunalBackgroundType(val value: Int) {
    DEFAULT(0),
    STATIC(0),
    STATIC_GRADIENT(1),
    ANIMATED(2),
    NONE(3),
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ constructor(
        Color.valueOf(
            Utils.getColorAttrDefaultColor(
                context,
                com.android.internal.R.attr.materialColorOutlineVariant
                com.android.internal.R.attr.materialColorPrimary
            )
        )
}