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

Commit 76765bb4 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Delete DeviceInactiveCondition" into main

parents 99790d29 5534104f
Loading
Loading
Loading
Loading
+0 −102
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.communal

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.keyguard.keyguardUpdateMonitor
import com.android.systemui.SysuiTestCase
import com.android.systemui.condition.testStart
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP
import com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
import com.android.systemui.keyguard.wakefulnessLifecycle
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.statusbar.policy.keyguardStateController
import com.android.systemui.testKosmos
import com.android.systemui.util.kotlin.javaAdapter
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever

@SmallTest
@RunWith(AndroidJUnit4::class)
class DeviceInactiveConditionTest : SysuiTestCase() {
    private val kosmos =
        testKosmos().useUnconfinedTestDispatcher().also {
            whenever(it.wakefulnessLifecycle.wakefulness) doReturn WAKEFULNESS_AWAKE
        }

    private val Kosmos.underTest by
        Kosmos.Fixture {
            DeviceInactiveCondition(
                applicationCoroutineScope,
                applicationCoroutineScope,
                keyguardStateController,
                wakefulnessLifecycle,
                keyguardUpdateMonitor,
                keyguardInteractor,
                javaAdapter,
            )
        }

    @Test
    fun asleep_conditionTrue() =
        kosmos.runTest {
            // Condition is false to start.
            testStart(underTest)
            assertThat(underTest.isConditionMet).isFalse()

            // Condition is true when device goes to sleep.
            sleep()
            assertThat(underTest.isConditionMet).isTrue()
        }

    @Test
    fun dozingAndAsleep_conditionFalse() =
        kosmos.runTest {
            // Condition is true when device is asleep.
            testStart(underTest)
            sleep()
            assertThat(underTest.isConditionMet).isTrue()

            // Condition turns false after doze starts.
            fakeKeyguardRepository.setDozeTransitionModel(
                DozeTransitionModel(from = DozeStateModel.UNINITIALIZED, to = DozeStateModel.DOZE)
            )
            assertThat(underTest.isConditionMet).isFalse()
        }

    fun Kosmos.sleep() {
        whenever(wakefulnessLifecycle.wakefulness) doReturn WAKEFULNESS_ASLEEP
        argumentCaptor<WakefulnessLifecycle.Observer>().apply {
            verify(wakefulnessLifecycle).addObserver(capture())
            firstValue.onStartedGoingToSleep()
        }
    }
}
+103 −33
Original line number Diff line number Diff line
@@ -27,13 +27,20 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.domain.interactor.displayStateInteractor
import com.android.systemui.display.data.repository.displayRepository
import com.android.systemui.dreams.domain.interactor.dreamSettingsInteractorKosmos
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.backgroundScope
import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.shared.condition.Condition
import com.android.systemui.shared.condition.Monitor
import com.android.systemui.statusbar.commandline.commandRegistry
@@ -47,12 +54,13 @@ import java.io.PrintWriter
import java.io.StringWriter
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.asExecutor
import kotlinx.coroutines.flow.MutableStateFlow
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.clearInvocations
import org.mockito.kotlin.any
import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify

@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -63,8 +71,19 @@ class LowLightMonitorTest : SysuiTestCase() {
            .apply { mainResources = mContext.orCreateTestableResources.resources }
            .useUnconfinedTestDispatcher()

    private val ambientLightMode: MutableStateFlow<Int> =
        MutableStateFlow(LowLightDreamManager.AMBIENT_LIGHT_MODE_UNKNOWN)

    private val Kosmos.lowLightDreamManager: LowLightDreamManager by
        Kosmos.Fixture { mock<LowLightDreamManager>() }
        Kosmos.Fixture {
            mock<LowLightDreamManager> {
                on { setAmbientLightMode(any()) } doAnswer
                    { invocation ->
                        val mode = invocation.arguments[0] as Int
                        ambientLightMode.value = mode
                    }
            }
        }

    private val Kosmos.monitor: Monitor by Kosmos.Fixture { Monitor(testDispatcher.asExecutor()) }

@@ -72,7 +91,7 @@ class LowLightMonitorTest : SysuiTestCase() {
        Kosmos.Fixture { LowLightLogger(logcatLogBuffer()) }

    private val Kosmos.condition: FakeCondition by
        Kosmos.Fixture { FakeCondition(scope = applicationCoroutineScope, initialValue = null) }
        Kosmos.Fixture { FakeCondition(scope = applicationCoroutineScope, initialValue = false) }

    private val Kosmos.underTest: LowLightMonitor by
        Kosmos.Fixture {
@@ -88,6 +107,8 @@ class LowLightMonitorTest : SysuiTestCase() {
                scope = backgroundScope,
                commandRegistry = commandRegistry,
                userLockedInteractor = userLockedInteractor,
                keyguardInteractor = keyguardInteractor,
                powerInteractor = powerInteractor,
            )
        }

@@ -126,6 +147,8 @@ class LowLightMonitorTest : SysuiTestCase() {
    fun setUp() {
        kosmos.setDisplayOn(false)
        kosmos.setUserUnlocked(true)
        kosmos.powerInteractor.setAwakeForTest()
        kosmos.fakeKeyguardRepository.setKeyguardShowing(true)

        // Activate dreams on charge by default
        mContext.orCreateTestableResources.addOverride(
@@ -149,22 +172,25 @@ class LowLightMonitorTest : SysuiTestCase() {
    @Test
    fun testSetAmbientLowLightWhenInLowLight() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            underTest.start()

            // Turn on screen
            setDisplayOn(true)

            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)

            // Set conditions to true
            condition.setValue(true)

            // Verify setting low light when condition is true
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
        }

    @Test
    fun testExitAmbientLowLightWhenNotInLowLight() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            underTest.start()

            // Turn on screen
@@ -172,12 +198,11 @@ class LowLightMonitorTest : SysuiTestCase() {

            // Set conditions to true then false
            condition.setValue(true)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            condition.setValue(false)

            // Verify ambient light toggles back to light mode regular
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    @Test
@@ -217,6 +242,63 @@ class LowLightMonitorTest : SysuiTestCase() {
            assertThat(condition.started).isTrue()
        }

    @Test
    fun testDoNotEnterLowLightIfDeviceNotIdle() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            setDisplayOn(true)
            setUserUnlocked(true)
            condition.setValue(true)

            fakeKeyguardRepository.setKeyguardShowing(true)
            fakeKeyguardRepository.setDreaming(false)

            underTest.start()
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            fakeKeyguardRepository.setKeyguardShowing(false)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    @Test
    fun testDoNotEnterLowLightIfNotDreaming() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            setDisplayOn(true)
            setUserUnlocked(true)
            fakeKeyguardRepository.setKeyguardShowing(false)
            fakeKeyguardRepository.setDreaming(true)
            condition.setValue(true)

            underTest.start()
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            fakeKeyguardRepository.setDreaming(false)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    @Test
    fun testDoNotEnterLowLightWhenDozingAndAsleep() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            underTest.start()

            setDisplayOn(true)
            setUserUnlocked(true)
            fakeKeyguardRepository.setKeyguardShowing(false)
            fakeKeyguardRepository.setDreaming(true)
            condition.setValue(true)

            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            // Dozing started
            fakeKeyguardRepository.setDozeTransitionModel(
                DozeTransitionModel(from = DozeStateModel.UNINITIALIZED, to = DozeStateModel.DOZE)
            )

            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    @Test
    fun testNoSubscribeIfDreamNotPresent() =
        kosmos.runTest {
@@ -230,73 +312,61 @@ class LowLightMonitorTest : SysuiTestCase() {
    @Test
    fun testForceLowlightToTrue() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            setDisplayOn(true)
            // low-light condition not met
            condition.setValue(false)

            underTest.start()
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)

            // force state to true
            sendDebugCommand(true)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            // clear forced state
            sendDebugCommand(null)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    @Test
    fun testForceLowlightToFalse() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            setDisplayOn(true)
            // low-light condition is met
            condition.setValue(true)

            underTest.start()
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            // force state to false
            sendDebugCommand(false)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)

            // clear forced state and ensure we go back to low-light
            sendDebugCommand(null)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
        }

    @Test
    fun testLowlightForcedToTrueWhenUserLocked() =
        kosmos.runTest {
            val mode by collectLastValue(ambientLightMode)
            setDisplayOn(true)
            // low-light condition is false
            condition.setValue(false)

            underTest.start()
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)

            // locked user forces lowlight
            setUserUnlocked(false)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)
            clearInvocations(lowLightDreamManager)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_LOW_LIGHT)

            // clear forced state and ensure we go back to regular mode
            setUserUnlocked(true)
            verify(lowLightDreamManager)
                .setAmbientLightMode(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
            assertThat(mode).isEqualTo(LowLightDreamManager.AMBIENT_LIGHT_MODE_REGULAR)
        }

    private class FakeCondition(
+0 −104
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.systemui.communal

import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.shared.model.DozeStateModel.Companion.isDozeOff
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
import com.android.systemui.shared.condition.Condition
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.util.kotlin.JavaAdapter
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch

/**
 * Condition which estimates device inactivity in order to avoid launching a full-screen activity
 * while the user is actively using the device.
 */
class DeviceInactiveCondition
@Inject
constructor(
    @Application private val applicationScope: CoroutineScope,
    @Background backgroundScope: CoroutineScope,
    private val keyguardStateController: KeyguardStateController,
    private val wakefulnessLifecycle: WakefulnessLifecycle,
    private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
    private val keyguardInteractor: KeyguardInteractor,
    private val javaAdapter: JavaAdapter,
) : Condition(backgroundScope) {
    private var anyDozeListenerJob: Job? = null
    private var anyDoze = false
    private val keyguardStateCallback: KeyguardStateController.Callback =
        object : KeyguardStateController.Callback {
            override fun onKeyguardShowingChanged() {
                updateState()
            }
        }
    private val wakefulnessObserver: WakefulnessLifecycle.Observer =
        object : WakefulnessLifecycle.Observer {
            override fun onStartedGoingToSleep() {
                updateState()
            }
        }
    private val keyguardUpdateCallback: KeyguardUpdateMonitorCallback =
        object : KeyguardUpdateMonitorCallback() {
            override fun onDreamingStateChanged(dreaming: Boolean) {
                updateState()
            }
        }

    override suspend fun start() {
        updateState()
        keyguardStateController.addCallback(keyguardStateCallback)

        // Keyguard update monitor callbacks must be registered on the main thread
        applicationScope.launch { keyguardUpdateMonitor.registerCallback(keyguardUpdateCallback) }
        wakefulnessLifecycle.addObserver(wakefulnessObserver)
        anyDozeListenerJob =
            javaAdapter.alwaysCollectFlow(keyguardInteractor.dozeTransitionModel) {
                dozeModel: DozeTransitionModel ->
                anyDoze = !isDozeOff(dozeModel.to)
                updateState()
            }
    }

    override fun stop() {
        keyguardStateController.removeCallback(keyguardStateCallback)
        keyguardUpdateMonitor.removeCallback(keyguardUpdateCallback)
        wakefulnessLifecycle.removeObserver(wakefulnessObserver)
        anyDozeListenerJob?.cancel(null)
    }

    override val startStrategy: Int
        get() = START_EAGERLY

    private fun updateState() {
        val asleep = wakefulnessLifecycle.wakefulness == WakefulnessLifecycle.WAKEFULNESS_ASLEEP
        // Doze/AoD is also a dream, but we should never override it with low light as to the user
        // it's totally unrelated.
        updateCondition(
            !anyDoze &&
                (asleep || keyguardStateController.isShowing || keyguardUpdateMonitor.isDreaming)
        )
    }
}
+35 −17
Original line number Diff line number Diff line
@@ -25,7 +25,10 @@ import com.android.systemui.dagger.qualifiers.SystemUser
import com.android.systemui.dreams.dagger.DreamModule
import com.android.systemui.dreams.domain.interactor.DreamSettingsInteractor
import com.android.systemui.dreams.shared.model.WhenToDream
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.shared.model.DozeStateModel.Companion.isDozeOff
import com.android.systemui.lowlightclock.dagger.LowLightModule
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.shared.condition.Condition
import com.android.systemui.shared.condition.Monitor
import com.android.systemui.statusbar.commandline.Command
@@ -33,6 +36,7 @@ import com.android.systemui.statusbar.commandline.CommandRegistry
import com.android.systemui.user.domain.interactor.UserLockedInteractor
import com.android.systemui.util.condition.ConditionalCoreStartable
import com.android.systemui.util.kotlin.BooleanFlowOperators.allOf
import com.android.systemui.util.kotlin.BooleanFlowOperators.anyOf
import com.android.systemui.util.kotlin.BooleanFlowOperators.not
import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import com.android.systemui.utils.coroutines.flow.flatMapLatestConflated
@@ -41,7 +45,6 @@ import java.io.PrintWriter
import javax.inject.Inject
import javax.inject.Named
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
@@ -72,7 +75,9 @@ constructor(
    private val packageManager: PackageManager,
    @Background private val scope: CoroutineScope,
    private val commandRegistry: CommandRegistry,
    userLockedInteractor: UserLockedInteractor,
    private val userLockedInteractor: UserLockedInteractor,
    keyguardInteractor: KeyguardInteractor,
    powerInteractor: PowerInteractor,
) : ConditionalCoreStartable(conditionsMonitor) {

    /** Whether the screen is currently on. */
@@ -103,22 +108,27 @@ constructor(
    }

    private val isLowLight: Flow<Boolean> =
        combine(
            not(userLockedInteractor.isUserUnlocked(UserHandle.CURRENT)),
            isLowLightForced,
            isLowLightFromSensor,
        ) { directBoot, forcedValue, sensorValue ->
            if (forcedValue != null) {
                forcedValue
            } else if (directBoot) {
                // If user is locked, normal dreams cannot start so we force lowlight dream.
                true
            } else {
                sensorValue
            }
        combine(isLowLightForced, isLowLightFromSensor) { forcedValue, sensorValue ->
            forcedValue ?: sensorValue
        }

    @OptIn(ExperimentalCoroutinesApi::class)
    private val anyDoze: Flow<Boolean> =
        keyguardInteractor.dozeTransitionModel.map { !isDozeOff(it.to) }

    /**
     * Whether the device is idle (lockscreen showing or dreaming or asleep) and not in doze/AOD, as
     * we do not want to override doze/AOD with lowlight dream.
     */
    private val isDeviceIdleAndNotDozing: Flow<Boolean> =
        allOf(
            not(anyDoze),
            anyOf(
                keyguardInteractor.isDreaming,
                keyguardInteractor.isKeyguardShowing,
                powerInteractor.isAsleep,
            ),
        )

    override fun onStart() {
        scope.launch {
            if (lowLightDreamService != null) {
@@ -139,7 +149,15 @@ constructor(
            allOf(isScreenOn, dreamEnabled)
                .flatMapLatestConflated { conditionsMet ->
                    if (conditionsMet) {
                        isLowLight
                        // Force lowlight only if idle and in either direct-boot mode or in
                        // a lowlight environment.
                        allOf(
                            isDeviceIdleAndNotDozing,
                            anyOf(
                                isLowLight,
                                not(userLockedInteractor.isUserUnlocked(UserHandle.CURRENT)),
                            ),
                        )
                    } else {
                        flowOf(false)
                    }
+0 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import android.content.res.Resources
import android.hardware.Sensor
import com.android.dream.lowlight.dagger.LowLightDreamModule
import com.android.systemui.CoreStartable
import com.android.systemui.communal.DeviceInactiveCondition
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.log.LogBuffer
@@ -41,11 +40,6 @@ import javax.inject.Named

@Module(includes = [LowLightDreamModule::class])
abstract class LowLightModule {
    @Binds
    @IntoSet
    @Named(LOW_LIGHT_PRECONDITIONS)
    abstract fun bindDeviceInactiveCondition(condition: DeviceInactiveCondition): Condition

    @Binds
    @IntoSet
    @Named(LOW_LIGHT_PRECONDITIONS)