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

Commit 94664096 authored by burakov's avatar burakov
Browse files

[Dual Shade] Ensure ShadeMode is never `Dual` outside of SceneContainer.

Bug: 388793191
Test: Added a unit test case.
Test: Existing unit tests still pass.
Flag: com.android.systemui.scene_container
Change-Id: Ib3aa6b81b4bd4e41f81373bc8a23a0f09c572022
parent 673ab751
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
@@ -44,6 +45,7 @@ import org.junit.runner.RunWith
import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(ParameterizedAndroidJunit4::class)
class CommunalTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
@@ -65,7 +67,7 @@ class CommunalTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestC

    private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
    private val communalSceneRepository = kosmos.fakeCommunalSceneRepository
    private val sceneInteractor = kosmos.sceneInteractor
    private val sceneInteractor by lazy { kosmos.sceneInteractor }

    private val underTest: CommunalTransitionViewModel by lazy {
        kosmos.communalTransitionViewModel
+13 −6
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import com.android.systemui.user.data.model.SelectionStatus
import com.android.systemui.user.data.repository.fakeUserRepository
import com.android.systemui.util.mockito.eq
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
@@ -73,6 +74,7 @@ import org.mockito.ArgumentMatchers.anyInt
import org.mockito.Mockito.never
import org.mockito.Mockito.verify

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(AndroidJUnit4::class)
class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
@@ -80,21 +82,26 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
    private val testScope: TestScope = kosmos.testScope

    private lateinit var underTest: SystemUIDeviceEntryFaceAuthInteractor

    private val bouncerRepository = kosmos.fakeKeyguardBouncerRepository
    private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
    private val keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor
    private val faceAuthRepository = kosmos.fakeDeviceEntryFaceAuthRepository
    private val fakeUserRepository = kosmos.fakeUserRepository
    private val facePropertyRepository = kosmos.facePropertyRepository
    private val fakeDeviceEntryFingerprintAuthInteractor =
        kosmos.deviceEntryFingerprintAuthInteractor
    private val powerInteractor = kosmos.powerInteractor
    private val fakeBiometricSettingsRepository = kosmos.fakeBiometricSettingsRepository

    private val keyguardUpdateMonitor = kosmos.keyguardUpdateMonitor
    private val keyguardUpdateMonitor by lazy { kosmos.keyguardUpdateMonitor }
    private val faceWakeUpTriggersConfig = kosmos.fakeFaceWakeUpTriggersConfig
    private val trustManager = kosmos.trustManager
    private val deviceEntryFaceAuthStatusInteractor = kosmos.deviceEntryFaceAuthStatusInteractor

    private val keyguardTransitionInteractor by lazy { kosmos.keyguardTransitionInteractor }
    private val fakeDeviceEntryFingerprintAuthInteractor by lazy {
        kosmos.deviceEntryFingerprintAuthInteractor
    }
    private val powerInteractor by lazy { kosmos.powerInteractor }
    private val deviceEntryFaceAuthStatusInteractor by lazy {
        kosmos.deviceEntryFaceAuthStatusInteractor
    }

    @Before
    fun setup() {
+5 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import junit.framework.Assert.assertEquals
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
@@ -53,13 +54,15 @@ import org.junit.Assert.assertThrows
import org.junit.Test
import org.junit.runner.RunWith

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(AndroidJUnit4::class)
class KeyguardTransitionInteractorTest : SysuiTestCase() {
    val kosmos = testKosmos()
    val underTest = kosmos.keyguardTransitionInteractor
    val repository = kosmos.fakeKeyguardTransitionRepository
    val testScope = kosmos.testScope
    val repository = kosmos.fakeKeyguardTransitionRepository

    val underTest by lazy { kosmos.keyguardTransitionInteractor }

    @Test
    fun transitionCollectorsReceivesOnlyAppropriateEvents() =
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.qs.panels.domain.interactor
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runTest
@@ -34,6 +35,7 @@ import org.junit.runner.RunWith

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableSceneContainer
class GridLayoutTypeInteractorTest : SysuiTestCase() {
    val kosmos = testKosmos()

+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.common.ui.data.repository.configurationRepository
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testCase
import com.android.systemui.kosmos.testScope
import com.android.systemui.qs.panels.data.repository.QSColumnsRepository
@@ -76,6 +77,7 @@ class QSColumnsInteractorTest : SysuiTestCase() {
        }

    @Test
    @EnableSceneContainer
    fun withDualShade_returnsCorrectValue() =
        with(kosmos) {
            testScope.runTest {
Loading