Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModelTest.kt +15 −0 Original line number Diff line number Diff line Loading @@ -21,8 +21,10 @@ import android.provider.Settings import android.service.dream.dreamManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLoggerFake import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.kosmos.collectLastValue Loading Loading @@ -50,6 +52,7 @@ import org.mockito.kotlin.whenever class CommunalToDreamButtonViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private val uiEventLoggerFake = kosmos.uiEventLoggerFake private val underTest: CommunalToDreamButtonViewModel by lazy { kosmos.communalToDreamButtonViewModel } Loading Loading @@ -119,4 +122,16 @@ class CommunalToDreamButtonViewModelTest : SysuiTestCase() { verify(activityStarter).postStartActivityDismissingKeyguard(any(), anyInt()) } } @Test fun onShowDreamButtonTap_eventLogged() = with(kosmos) { runTest { underTest.onShowDreamButtonTap() runCurrent() assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(CommunalUiEvent.COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP.id) } } } packages/SystemUI/src/com/android/systemui/communal/shared/log/CommunalUiEvent.kt +3 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,9 @@ enum class CommunalUiEvent(private val id: Int) : UiEventEnum { @UiEvent(doc = "User cancels the swipe gesture to exit the Communal Hub to go to Dream") COMMUNAL_HUB_TO_DREAM_SWIPE_CANCEL(1865), @UiEvent(doc = "A transition from Dream to Communal Hub starts due to dream awakening") DREAM_TO_COMMUNAL_HUB_DREAM_AWAKE_START(1866); DREAM_TO_COMMUNAL_HUB_DREAM_AWAKE_START(1866), @UiEvent(doc = "User long-pressed the button on Communal Hub to go to Dream") COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP(2065); override fun getId(): Int { return id Loading packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.annotation.SuppressLint import android.app.DreamManager import android.content.Intent import android.provider.Settings import com.android.internal.logging.UiEventLogger import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.plugins.ActivityStarter Loading Loading @@ -48,6 +50,7 @@ constructor( private val settingsInteractor: CommunalSettingsInteractor, private val activityStarter: ActivityStarter, private val dreamManager: DreamManager, private val uiEventLogger: UiEventLogger, ) : ExclusiveActivatable() { private val _requests = Channel<Unit>(Channel.BUFFERED) Loading @@ -59,6 +62,7 @@ constructor( /** Handle a tap on the "show dream" button. */ fun onShowDreamButtonTap() { uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP) _requests.trySend(Unit) } Loading packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.communal.ui.viewmodel import android.service.dream.dreamManager import com.android.internal.logging.uiEventLogger import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testDispatcher Loading @@ -31,5 +32,6 @@ val Kosmos.communalToDreamButtonViewModel by settingsInteractor = communalSettingsInteractor, activityStarter = activityStarter, dreamManager = dreamManager, uiEventLogger = uiEventLogger, ) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModelTest.kt +15 −0 Original line number Diff line number Diff line Loading @@ -21,8 +21,10 @@ import android.provider.Settings import android.service.dream.dreamManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLoggerFake import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.kosmos.collectLastValue Loading Loading @@ -50,6 +52,7 @@ import org.mockito.kotlin.whenever class CommunalToDreamButtonViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private val uiEventLoggerFake = kosmos.uiEventLoggerFake private val underTest: CommunalToDreamButtonViewModel by lazy { kosmos.communalToDreamButtonViewModel } Loading Loading @@ -119,4 +122,16 @@ class CommunalToDreamButtonViewModelTest : SysuiTestCase() { verify(activityStarter).postStartActivityDismissingKeyguard(any(), anyInt()) } } @Test fun onShowDreamButtonTap_eventLogged() = with(kosmos) { runTest { underTest.onShowDreamButtonTap() runCurrent() assertThat(uiEventLoggerFake[0].eventId) .isEqualTo(CommunalUiEvent.COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP.id) } } }
packages/SystemUI/src/com/android/systemui/communal/shared/log/CommunalUiEvent.kt +3 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,9 @@ enum class CommunalUiEvent(private val id: Int) : UiEventEnum { @UiEvent(doc = "User cancels the swipe gesture to exit the Communal Hub to go to Dream") COMMUNAL_HUB_TO_DREAM_SWIPE_CANCEL(1865), @UiEvent(doc = "A transition from Dream to Communal Hub starts due to dream awakening") DREAM_TO_COMMUNAL_HUB_DREAM_AWAKE_START(1866); DREAM_TO_COMMUNAL_HUB_DREAM_AWAKE_START(1866), @UiEvent(doc = "User long-pressed the button on Communal Hub to go to Dream") COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP(2065); override fun getId(): Int { return id Loading
packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.annotation.SuppressLint import android.app.DreamManager import android.content.Intent import android.provider.Settings import com.android.internal.logging.UiEventLogger import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.plugins.ActivityStarter Loading Loading @@ -48,6 +50,7 @@ constructor( private val settingsInteractor: CommunalSettingsInteractor, private val activityStarter: ActivityStarter, private val dreamManager: DreamManager, private val uiEventLogger: UiEventLogger, ) : ExclusiveActivatable() { private val _requests = Channel<Unit>(Channel.BUFFERED) Loading @@ -59,6 +62,7 @@ constructor( /** Handle a tap on the "show dream" button. */ fun onShowDreamButtonTap() { uiEventLogger.log(CommunalUiEvent.COMMUNAL_HUB_SHOW_DREAM_BUTTON_TAP) _requests.trySend(Unit) } Loading
packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalToDreamButtonViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.communal.ui.viewmodel import android.service.dream.dreamManager import com.android.internal.logging.uiEventLogger import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testDispatcher Loading @@ -31,5 +32,6 @@ val Kosmos.communalToDreamButtonViewModel by settingsInteractor = communalSettingsInteractor, activityStarter = activityStarter, dreamManager = dreamManager, uiEventLogger = uiEventLogger, ) }