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

Commit b828afed authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] FakeSceneContainerFlags.enabled defaults to...

Merge "[flexiglass] FakeSceneContainerFlags.enabled defaults to SceneContainerFlag.isEnabled" into main
parents 4e41d246 4dc61922
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@ import org.junit.runner.RunWith


@SmallTest
@SmallTest
@RunWith(AndroidJUnit4::class)
@RunWith(AndroidJUnit4::class)
@android.platform.test.annotations.EnabledOnRavenwood
class SceneContainerRepositoryTest : SysuiTestCase() {
class SceneContainerRepositoryTest : SysuiTestCase() {


    private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true }
    private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true }
+3 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.Kosmos
import com.google.common.truth.Truth
import com.google.common.truth.Truth
import org.junit.Test
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith
@@ -35,6 +36,7 @@ internal class SceneContainerFlagsTest : SysuiTestCase() {
    fun isNotEnabled_withoutAconfigFlags() {
    fun isNotEnabled_withoutAconfigFlags() {
        Truth.assertThat(SceneContainerFlag.isEnabled).isEqualTo(false)
        Truth.assertThat(SceneContainerFlag.isEnabled).isEqualTo(false)
        Truth.assertThat(SceneContainerFlagsImpl().isEnabled()).isEqualTo(false)
        Truth.assertThat(SceneContainerFlagsImpl().isEnabled()).isEqualTo(false)
        Truth.assertThat(Kosmos().sceneContainerFlags.isEnabled()).isEqualTo(false)
    }
    }


    @Test
    @Test
@@ -42,5 +44,6 @@ internal class SceneContainerFlagsTest : SysuiTestCase() {
    fun isEnabled_withAconfigFlags() {
    fun isEnabled_withAconfigFlags() {
        Truth.assertThat(SceneContainerFlag.isEnabled).isEqualTo(true)
        Truth.assertThat(SceneContainerFlag.isEnabled).isEqualTo(true)
        Truth.assertThat(SceneContainerFlagsImpl().isEnabled()).isEqualTo(true)
        Truth.assertThat(SceneContainerFlagsImpl().isEnabled()).isEqualTo(true)
        Truth.assertThat(Kosmos().sceneContainerFlags.isEnabled()).isEqualTo(true)
    }
    }
}
}
+11 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.common.shared.model.NotificationContainerBounds
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.coroutines.collectValues
import com.android.systemui.flags.BrokenWithSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.flags.andSceneContainer
@@ -50,6 +51,8 @@ import com.android.systemui.keyguard.ui.viewmodel.aodBurnInViewModel
import com.android.systemui.keyguard.ui.viewmodel.keyguardRootViewModel
import com.android.systemui.keyguard.ui.viewmodel.keyguardRootViewModel
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.flag.sceneContainerFlags
import com.android.systemui.shade.data.repository.shadeRepository
import com.android.systemui.shade.data.repository.shadeRepository
import com.android.systemui.shade.mockLargeScreenHeaderHelper
import com.android.systemui.shade.mockLargeScreenHeaderHelper
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
@@ -125,6 +128,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :


    @Before
    @Before
    fun setUp() {
    fun setUp() {
        assertThat(kosmos.sceneContainerFlags.isEnabled()).isEqualTo(SceneContainerFlag.isEnabled)
        overrideResource(R.bool.config_use_split_notification_shade, false)
        overrideResource(R.bool.config_use_split_notification_shade, false)
        movementFlow = MutableStateFlow(BurnInModel())
        movementFlow = MutableStateFlow(BurnInModel())
        whenever(aodBurnInViewModel.movement(any())).thenReturn(movementFlow)
        whenever(aodBurnInViewModel.movement(any())).thenReturn(movementFlow)
@@ -310,6 +314,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun glanceableHubAlpha_lockscreenToHub() =
    fun glanceableHubAlpha_lockscreenToHub() =
        testScope.runTest {
        testScope.runTest {
            val alpha by collectLastValue(underTest.glanceableHubAlpha)
            val alpha by collectLastValue(underTest.glanceableHubAlpha)
@@ -459,6 +464,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun isOnLockscreenWithoutShade() =
    fun isOnLockscreenWithoutShade() =
        testScope.runTest {
        testScope.runTest {
            val isOnLockscreenWithoutShade by collectLastValue(underTest.isOnLockscreenWithoutShade)
            val isOnLockscreenWithoutShade by collectLastValue(underTest.isOnLockscreenWithoutShade)
@@ -495,6 +501,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun isOnGlanceableHubWithoutShade() =
    fun isOnGlanceableHubWithoutShade() =
        testScope.runTest {
        testScope.runTest {
            val isOnGlanceableHubWithoutShade by
            val isOnGlanceableHubWithoutShade by
@@ -676,6 +683,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun maxNotificationsOnLockscreen_DoesNotUpdateWhenUserInteracting() =
    fun maxNotificationsOnLockscreen_DoesNotUpdateWhenUserInteracting() =
        testScope.runTest {
        testScope.runTest {
            var notificationCount = 10
            var notificationCount = 10
@@ -712,6 +720,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun maxNotificationsOnShade() =
    fun maxNotificationsOnShade() =
        testScope.runTest {
        testScope.runTest {
            val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> 10 }
            val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> 10 }
@@ -798,6 +807,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun alphaOnFullQsExpansion() =
    fun alphaOnFullQsExpansion() =
        testScope.runTest {
        testScope.runTest {
            val viewState = ViewStateAccessor()
            val viewState = ViewStateAccessor()
@@ -905,6 +915,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) :
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(bugId = 333132830)
    fun shadeCollapseFadeIn() =
    fun shadeCollapseFadeIn() =
        testScope.runTest {
        testScope.runTest {
            val fadeIn by collectValues(underTest.shadeCollapseFadeIn)
            val fadeIn by collectValues(underTest.shadeCollapseFadeIn)
+1 −1
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@ import dagger.Module
import dagger.Provides
import dagger.Provides


class FakeSceneContainerFlags(
class FakeSceneContainerFlags(
    var enabled: Boolean = false,
    var enabled: Boolean = SceneContainerFlag.isEnabled,
) : SceneContainerFlags {
) : SceneContainerFlags {


    override fun isEnabled(): Boolean {
    override fun isEnabled(): Boolean {