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

Commit ab4b036f authored by Justin Weir's avatar Justin Weir
Browse files

Delete SceneContainerFlags

Replaces all calls to SceneContainerFlags with calls to
SceneContainerFlag and removes all injected instances of
SceneContainerFlags. Migrates affected tests to the annotation
EnableSceneContainer.

Bug: 333775705
Test: updated and ran affected tests
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: I31e2c7fab88075f3554680ba00bfd365f9bbcee7
parent f14f053f
Loading
Loading
Loading
Loading
+24 −19
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
@@ -65,8 +66,6 @@ import com.android.systemui.plugins.FalsingManager
import com.android.systemui.res.R
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
import com.android.systemui.scene.shared.flag.sceneContainerFlags
import com.android.systemui.scene.shared.model.FakeSceneDataSource
import com.android.systemui.scene.shared.model.FakeSceneDataSource
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.fakeSceneDataSource
import com.android.systemui.scene.shared.model.fakeSceneDataSource
@@ -87,7 +86,6 @@ import com.android.systemui.util.mockito.mock
import com.android.systemui.util.mockito.whenever
import com.android.systemui.util.mockito.whenever
import com.android.systemui.util.settings.GlobalSettings
import com.android.systemui.util.settings.GlobalSettings
import com.google.common.truth.Truth
import com.google.common.truth.Truth
import dagger.Lazy
import java.util.Optional
import java.util.Optional
import junit.framework.Assert
import junit.framework.Assert
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -171,7 +169,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
    private lateinit var sceneInteractor: SceneInteractor
    private lateinit var sceneInteractor: SceneInteractor
    private lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor
    private lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor
    private lateinit var deviceEntryInteractor: DeviceEntryInteractor
    private lateinit var deviceEntryInteractor: DeviceEntryInteractor
    @Mock private lateinit var primaryBouncerInteractor: Lazy<PrimaryBouncerInteractor>
    @Mock private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor
    private lateinit var sceneTransitionStateFlow: MutableStateFlow<ObservableTransitionState>
    private lateinit var sceneTransitionStateFlow: MutableStateFlow<ObservableTransitionState>
    private lateinit var fakeSceneDataSource: FakeSceneDataSource
    private lateinit var fakeSceneDataSource: FakeSceneDataSource


@@ -217,9 +215,13 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
        )
        )
        mSetFlagsRule.disableFlags(
        mSetFlagsRule.disableFlags(
            FLAG_SIDEFPS_CONTROLLER_REFACTOR,
            FLAG_SIDEFPS_CONTROLLER_REFACTOR,
        )
        if (!com.android.systemui.Flags.sceneContainer()) {
            mSetFlagsRule.disableFlags(
                AConfigFlags.FLAG_KEYGUARD_WM_STATE_REFACTOR,
                AConfigFlags.FLAG_KEYGUARD_WM_STATE_REFACTOR,
                AConfigFlags.FLAG_REFACTOR_KEYGUARD_DISMISS_INTENT,
                AConfigFlags.FLAG_REFACTOR_KEYGUARD_DISMISS_INTENT,
            )
            )
        }


        keyguardPasswordViewController =
        keyguardPasswordViewController =
            KeyguardPasswordViewController(
            KeyguardPasswordViewController(
@@ -268,7 +270,6 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
                falsingManager,
                falsingManager,
                userSwitcherController,
                userSwitcherController,
                featureFlags,
                featureFlags,
                kosmos.sceneContainerFlags,
                globalSettings,
                globalSettings,
                sessionTracker,
                sessionTracker,
                Optional.of(sideFpsController),
                Optional.of(sideFpsController),
@@ -283,7 +284,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
                deviceProvisionedController,
                deviceProvisionedController,
                faceAuthAccessibilityDelegate,
                faceAuthAccessibilityDelegate,
                keyguardTransitionInteractor,
                keyguardTransitionInteractor,
                primaryBouncerInteractor,
                { primaryBouncerInteractor },
            ) {
            ) {
                deviceEntryInteractor
                deviceEntryInteractor
            }
            }
@@ -804,17 +805,17 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @EnableSceneContainer
    fun dismissesKeyguard_whenSceneChangesToGone() =
    fun dismissesKeyguard_whenSceneChangesToGone() =
        kosmos.testScope.runTest {
        kosmos.testScope.runTest {
            kosmos.fakeSceneContainerFlags.enabled = true
            // Upon init, we have never dismisses the keyguard.
            // Upon init, we have never dismisses the keyguard.
            underTest.onInit()
            underTest.onInit()
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback, never()).keyguardDone(anyInt())
            verify(primaryBouncerInteractor, never())
                .notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // Once the view is attached, we start listening but simply going to the bouncer scene
            // Once the view is attached, we start listening but simply going to the bouncer scene
            // is
            // is not enough to trigger a dismissal of the keyguard.
            // not enough to trigger a dismissal of the keyguard.
            underTest.onViewAttached()
            underTest.onViewAttached()
            fakeSceneDataSource.pause()
            fakeSceneDataSource.pause()
            sceneInteractor.changeScene(Scenes.Bouncer, "reason")
            sceneInteractor.changeScene(Scenes.Bouncer, "reason")
@@ -830,7 +831,8 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Bouncer)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Bouncer)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Bouncer)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Bouncer)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback, never()).keyguardDone(anyInt())
            verify(primaryBouncerInteractor, never())
                .notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // While listening, going from the bouncer scene to the gone scene, does dismiss the
            // While listening, going from the bouncer scene to the gone scene, does dismiss the
            // keyguard.
            // keyguard.
@@ -852,11 +854,11 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback).keyguardDone(anyInt())
            verify(primaryBouncerInteractor).notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // While listening, moving back to the bouncer scene does not dismiss the keyguard
            // While listening, moving back to the bouncer scene does not dismiss the keyguard
            // again.
            // again.
            clearInvocations(viewMediatorCallback)
            clearInvocations(primaryBouncerInteractor)
            fakeSceneDataSource.pause()
            fakeSceneDataSource.pause()
            sceneInteractor.changeScene(Scenes.Bouncer, "reason")
            sceneInteractor.changeScene(Scenes.Bouncer, "reason")
            sceneTransitionStateFlow.value =
            sceneTransitionStateFlow.value =
@@ -871,7 +873,8 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Bouncer)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Bouncer)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Bouncer)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Bouncer)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback, never()).keyguardDone(anyInt())
            verify(primaryBouncerInteractor, never())
                .notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // Detaching the view stops listening, so moving from the bouncer scene to the gone
            // Detaching the view stops listening, so moving from the bouncer scene to the gone
            // scene
            // scene
@@ -891,7 +894,8 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback, never()).keyguardDone(anyInt())
            verify(primaryBouncerInteractor, never())
                .notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // While not listening, moving to the lockscreen does not dismiss the keyguard.
            // While not listening, moving to the lockscreen does not dismiss the keyguard.
            fakeSceneDataSource.pause()
            fakeSceneDataSource.pause()
@@ -908,7 +912,8 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Lockscreen)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Lockscreen)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Lockscreen)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Lockscreen)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback, never()).keyguardDone(anyInt())
            verify(primaryBouncerInteractor, never())
                .notifyKeyguardAuthenticatedPrimaryAuth(anyInt())


            // Reattaching the view starts listening again so moving from the bouncer scene to the
            // Reattaching the view starts listening again so moving from the bouncer scene to the
            // gone scene now does dismiss the keyguard again, this time from lockscreen.
            // gone scene now does dismiss the keyguard again, this time from lockscreen.
@@ -927,7 +932,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            fakeSceneDataSource.unpause(expectedScene = Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            sceneTransitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
            runCurrent()
            runCurrent()
            verify(viewMediatorCallback).keyguardDone(anyInt())
            verify(primaryBouncerInteractor).notifyKeyguardAuthenticatedPrimaryAuth(anyInt())
        }
        }


    @Test
    @Test
+0 −2
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.systemui.coroutines.collectValues
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.scene.shared.flag.sceneContainerFlags
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.util.FakeMobileMappingsProxy
import com.android.systemui.statusbar.pipeline.mobile.util.FakeMobileMappingsProxy
import com.android.systemui.testKosmos
import com.android.systemui.testKosmos
@@ -86,7 +85,6 @@ class AuthenticationRepositoryTest : SysuiTestCase() {
            AuthenticationRepositoryImpl(
            AuthenticationRepositoryImpl(
                applicationScope = testScope.backgroundScope,
                applicationScope = testScope.backgroundScope,
                backgroundDispatcher = kosmos.testDispatcher,
                backgroundDispatcher = kosmos.testDispatcher,
                flags = kosmos.sceneContainerFlags,
                clock = clock,
                clock = clock,
                getSecurityMode = getSecurityMode,
                getSecurityMode = getSecurityMode,
                userRepository = userRepository,
                userRepository = userRepository,
+2 −2
Original line number Original line Diff line number Diff line
@@ -29,10 +29,10 @@ import com.android.systemui.authentication.data.repository.fakeAuthenticationRep
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
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.flags.EnableSceneContainer
import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER
import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository
import com.android.systemui.telephony.data.repository.fakeTelephonyRepository
import com.android.systemui.telephony.data.repository.fakeTelephonyRepository
@@ -56,6 +56,7 @@ import org.mockito.MockitoAnnotations
@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@SmallTest
@RunWith(AndroidJUnit4::class)
@RunWith(AndroidJUnit4::class)
@EnableSceneContainer
class BouncerActionButtonInteractorTest : SysuiTestCase() {
class BouncerActionButtonInteractorTest : SysuiTestCase() {


    @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor
    @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor
@@ -75,7 +76,6 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() {
    @Before
    @Before
    fun setUp() {
    fun setUp() {
        MockitoAnnotations.initMocks(this)
        MockitoAnnotations.initMocks(this)
        kosmos.fakeSceneContainerFlags.enabled = true


        mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository
        mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository


+3 −2
Original line number Original line Diff line number Diff line
@@ -28,11 +28,11 @@ import com.android.systemui.authentication.shared.model.AuthenticationPatternCoo
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.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.data.repository.fakePowerRepository
import com.android.systemui.power.data.repository.fakePowerRepository
import com.android.systemui.res.R
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
import com.android.systemui.testKosmos
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertThat
import kotlin.time.Duration.Companion.seconds
import kotlin.time.Duration.Companion.seconds
@@ -48,9 +48,10 @@ import org.mockito.MockitoAnnotations
@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@SmallTest
@RunWith(AndroidJUnit4::class)
@RunWith(AndroidJUnit4::class)
@EnableSceneContainer
class BouncerInteractorTest : SysuiTestCase() {
class BouncerInteractorTest : SysuiTestCase() {


    private val kosmos = testKosmos().apply { fakeSceneContainerFlags.enabled = true }
    private val kosmos = testKosmos()
    private val testScope = kosmos.testScope
    private val testScope = kosmos.testScope
    private val authenticationInteractor = kosmos.authenticationInteractor
    private val authenticationInteractor = kosmos.authenticationInteractor


+2 −2
Original line number Original line Diff line number Diff line
@@ -34,10 +34,10 @@ import com.android.systemui.authentication.shared.model.AuthenticationMethodMode
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel.Sim
import com.android.systemui.bouncer.domain.interactor.bouncerInteractor
import com.android.systemui.bouncer.domain.interactor.bouncerInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.fakeSceneDataSource
import com.android.systemui.scene.shared.model.fakeSceneDataSource
import com.android.systemui.testKosmos
import com.android.systemui.testKosmos
@@ -60,6 +60,7 @@ import org.junit.runner.RunWith
@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@SmallTest
@RunWith(AndroidJUnit4::class)
@RunWith(AndroidJUnit4::class)
@EnableSceneContainer
class BouncerViewModelTest : SysuiTestCase() {
class BouncerViewModelTest : SysuiTestCase() {


    private val kosmos = testKosmos()
    private val kosmos = testKosmos()
@@ -70,7 +71,6 @@ class BouncerViewModelTest : SysuiTestCase() {


    @Before
    @Before
    fun setUp() {
    fun setUp() {
        kosmos.fakeSceneContainerFlags.enabled = true
        underTest = kosmos.bouncerViewModel
        underTest = kosmos.bouncerViewModel
    }
    }


Loading