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

Commit 83483e6d authored by Liam, Lee Pong Lam's avatar Liam, Lee Pong Lam
Browse files

Fix redundant smartspace update

The VM representing 3 surfaces, and they all in same session. Actually
only general view needs to be refresh

Flag: EXEMPT bugfix
Test: Unit test/ manual
Bug: 414612938

Change-Id: I1e6e6b5be00f610fc3c3833df56fd65cc70fb308
parent 9ae9bad4
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -123,4 +123,26 @@ class SmartspaceViewModelTest : SysuiTestCase() {

            assertThat(dozeTimeTick).isEqualTo(0)
        }

    @Test
    fun weather_dozeTimeTick_noAodTimeTick() =
        testScope.runTest {
            underTest = smartspaceViewModelFactory.create(SmartspaceViewModel.SURFACE_WEATHER_VIEW)

            fakeKeyguardRepository.dozeTimeTick()
            val dozeTimeTick = withTimeoutOrNull(100) { underTest.aodTimeTick.firstOrNull() }

            assertThat(dozeTimeTick).isNull()
        }

    @Test
    fun date_dozeTimeTick_noAodTimeTick() =
        testScope.runTest {
            underTest = smartspaceViewModelFactory.create(SmartspaceViewModel.SURFACE_DATE_VIEW)

            fakeKeyguardRepository.dozeTimeTick()
            val dozeTimeTick = withTimeoutOrNull(100) { underTest.aodTimeTick.firstOrNull() }

            assertThat(dozeTimeTick).isNull()
        }
}
+2 −1
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ constructor(
        powerInteractor.isAwake.filter { surfaceName != SURFACE_WEATHER_VIEW }

    /** Time tick flow */
    val aodTimeTick: Flow<Long> = keyguardInteractor.dozeTimeTick
    val aodTimeTick: Flow<Long> =
        keyguardInteractor.dozeTimeTick.filter { surfaceName == SURFACE_GENERAL_VIEW }

    @AssistedFactory
    interface Factory {