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

Commit 13280939 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove isAwake check from dreaming flow" into main

parents 36c77d01 50de46ff
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING
import com.android.systemui.keyguard.shared.model.TransitionState.STARTED
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
@@ -76,7 +74,6 @@ class KeyguardInteractorTest : SysuiTestCase() {
    private val configRepository by lazy { kosmos.fakeConfigurationRepository }
    private val bouncerRepository by lazy { kosmos.keyguardBouncerRepository }
    private val shadeRepository by lazy { kosmos.shadeRepository }
    private val powerInteractor by lazy { kosmos.powerInteractor }
    private val keyguardRepository by lazy { kosmos.keyguardRepository }
    private val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository }

@@ -444,7 +441,6 @@ class KeyguardInteractorTest : SysuiTestCase() {
            repository.setDozeTransitionModel(
                DozeTransitionModel(from = DozeStateModel.DOZE, to = DozeStateModel.FINISH)
            )
            powerInteractor.setAwakeForTest()
            advanceTimeBy(1000L)

            assertThat(isAbleToDream).isEqualTo(false)
@@ -460,9 +456,6 @@ class KeyguardInteractorTest : SysuiTestCase() {
            repository.setDozeTransitionModel(
                DozeTransitionModel(from = DozeStateModel.DOZE, to = DozeStateModel.FINISH)
            )
            powerInteractor.setAwakeForTest()
            runCurrent()

            // After some delay, still false
            advanceTimeBy(300L)
            assertThat(isAbleToDream).isEqualTo(false)
+3 −6
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardClockRepository
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository;
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingObserver;
import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel;
@@ -335,16 +334,14 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
        mFeatureFlags.set(Flags.QS_USER_DETAIL_SHORTCUT, false);

        mMainDispatcher = getMainDispatcher();
        KeyguardInteractorFactory.WithDependencies keyguardInteractorDeps =
                KeyguardInteractorFactory.create();
        mFakeKeyguardRepository = keyguardInteractorDeps.getRepository();
        mFakeKeyguardRepository = mKosmos.getKeyguardRepository();
        mFakeKeyguardClockRepository = new FakeKeyguardClockRepository();
        mKeyguardClockInteractor = mKosmos.getKeyguardClockInteractor();
        mKeyguardInteractor = keyguardInteractorDeps.getKeyguardInteractor();
        mKeyguardInteractor = mKosmos.getKeyguardInteractor();
        mShadeRepository = new FakeShadeRepository();
        mShadeAnimationInteractor = new ShadeAnimationInteractorLegacyImpl(
                new ShadeAnimationRepository(), mShadeRepository);
        mPowerInteractor = keyguardInteractorDeps.getPowerInteractor();
        mPowerInteractor = mKosmos.getPowerInteractor();
        when(mKeyguardTransitionInteractor.isInTransitionWhere(any(), any())).thenReturn(
                MutableStateFlow(false));
        when(mKeyguardTransitionInteractor.isInTransition(any(), any()))
+1 −7
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED
import com.android.systemui.keyguard.shared.model.StatusBarState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
@@ -84,7 +83,6 @@ class KeyguardInteractor
@Inject
constructor(
    private val repository: KeyguardRepository,
    powerInteractor: PowerInteractor,
    bouncerRepository: KeyguardBouncerRepository,
    @ShadeDisplayAware configurationInteractor: ConfigurationInteractor,
    shadeRepository: ShadeRepository,
@@ -216,11 +214,7 @@ constructor(
                    // should actually be quite strange to leave AOD and then go straight to
                    // DREAMING so this should be fine.
                    delay(IS_ABLE_TO_DREAM_DELAY_MS)
                    isDreaming
                        .sample(powerInteractor.isAwake) { isDreaming, isAwake ->
                            isDreaming && isAwake
                        }
                        .debounce(50L)
                    isDreaming.debounce(50L)
                } else {
                    flowOf(false)
                }
+7 −7
Original line number Diff line number Diff line
@@ -28,9 +28,11 @@ import com.android.settingslib.notification.modes.TestModeBuilder.MANUAL_DND_INA
import com.android.systemui.SysuiTestCase
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.shared.model.Edge
import com.android.systemui.keyguard.shared.model.KeyguardState.AOD
import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING
@@ -159,14 +161,12 @@ class ClockEventControllerTest : SysuiTestCase() {
        dndModeId = MANUAL_DND_INACTIVE.id
        zenModeRepository.addMode(MANUAL_DND_INACTIVE)

        repository = FakeKeyguardRepository()
        repository = kosmos.fakeKeyguardRepository

        val withDeps = KeyguardInteractorFactory.create(repository = repository)

        withDeps.featureFlags.apply { set(Flags.REGION_SAMPLING, false) }
        kosmos.fakeFeatureFlagsClassic.set(Flags.REGION_SAMPLING, false)
        underTest =
            ClockEventController(
                withDeps.keyguardInteractor,
                kosmos.keyguardInteractor,
                keyguardTransitionInteractor,
                broadcastDispatcher,
                batteryController,
@@ -177,7 +177,7 @@ class ClockEventControllerTest : SysuiTestCase() {
                mainExecutor,
                bgExecutor,
                clockBuffers,
                withDeps.featureFlags,
                kosmos.fakeFeatureFlagsClassic,
                zenModeController,
                kosmos.zenModeInteractor,
                userTracker,
+0 −6
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.power.domain.interactor.PowerInteractorFactory
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.shade.data.repository.FakeShadeRepository
import com.android.systemui.util.mockito.mock
@@ -55,7 +53,6 @@ object KeyguardInteractorFactory {
        fromLockscreenTransitionInteractor: FromLockscreenTransitionInteractor = mock(),
        fromOccludedTransitionInteractor: FromOccludedTransitionInteractor = mock(),
        fromAlternateBouncerTransitionInteractor: FromAlternateBouncerTransitionInteractor = mock(),
        powerInteractor: PowerInteractor = PowerInteractorFactory.create().powerInteractor,
        testScope: CoroutineScope = TestScope(),
    ): WithDependencies {
        // Mock these until they are replaced by kosmos
@@ -73,10 +70,8 @@ object KeyguardInteractorFactory {
            bouncerRepository = bouncerRepository,
            configurationRepository = configurationRepository,
            shadeRepository = shadeRepository,
            powerInteractor = powerInteractor,
            KeyguardInteractor(
                repository = repository,
                powerInteractor = powerInteractor,
                bouncerRepository = bouncerRepository,
                configurationInteractor = ConfigurationInteractorImpl(configurationRepository),
                shadeRepository = shadeRepository,
@@ -99,7 +94,6 @@ object KeyguardInteractorFactory {
        val bouncerRepository: FakeKeyguardBouncerRepository,
        val configurationRepository: FakeConfigurationRepository,
        val shadeRepository: FakeShadeRepository,
        val powerInteractor: PowerInteractor,
        val keyguardInteractor: KeyguardInteractor,
    )
}
Loading