Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +54 −34 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue Loading @@ -35,6 +36,8 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.notificationShadeWindowController import com.android.systemui.statusbar.phone.centralSurfaces import com.android.systemui.statusbar.phone.centralSurfacesOptional import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat Loading @@ -49,6 +52,7 @@ import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.whenever @OptIn(ExperimentalCoroutinesApi::class) @SmallTest Loading @@ -67,6 +71,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { CommunalSceneStartable( dockManager = dockManager, communalInteractor = communalInteractor, communalSceneInteractor = communalSceneInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, keyguardInteractor = keyguardInteractor, systemSettings = fakeSettings, Loading @@ -74,6 +79,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { applicationScope = applicationCoroutineScope, bgScope = applicationCoroutineScope, mainDispatcher = testDispatcher, centralSurfacesOpt = centralSurfacesOptional, ) .apply { start() } Loading @@ -90,9 +96,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun keyguardGoesAway_forceBlankScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -110,7 +116,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceDocked_forceCommunalScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) Loading @@ -127,8 +133,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun occluded_forceBlankScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(false) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) updateDocked(true) Loading @@ -141,11 +148,30 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Test fun occluded_doesNotForceBlankSceneIfLaunchingActivityOverLockscreen() = with(kosmos) { testScope.runTest { whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(true) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) updateDocked(true) fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.OCCLUDED, testScope = this ) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } @Test fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) Loading @@ -162,8 +188,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceAsleep_forceBlankSceneAfterTimeout() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -183,8 +209,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceAsleep_wakesUpBeforeTimeout_noChangeInScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -212,8 +238,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun dockingOnLockscreen_forcesCommunal() = with(kosmos) { testScope.runTest { communalInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalInteractor.desiredScene) communalSceneInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalSceneInteractor.currentScene) // device is docked while on the lockscreen fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -234,8 +260,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() = with(kosmos) { testScope.runTest { communalInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalInteractor.desiredScene) communalSceneInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalSceneInteractor.currentScene) // device is docked while on the lockscreen fakeKeyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -266,9 +292,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Scene times out back to blank after the screen timeout. Loading @@ -283,11 +309,11 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is not dreaming and on communal. updateDreaming(false) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) // Scene stays as Communal advanceTimeBy(SCREEN_TIMEOUT.milliseconds) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } Loading @@ -298,9 +324,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout. Loading @@ -321,9 +347,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is on communal, but not dreaming. updateDreaming(false) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout, then start dreaming. Loading @@ -342,11 +368,11 @@ class CommunalSceneStartableTest : SysuiTestCase() { with(kosmos) { testScope.runTest { // Device is on communal. communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) // Device stays on the hub after the timeout since we're not dreaming. advanceTimeBy(SCREEN_TIMEOUT.milliseconds * 2) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Start dreaming. Loading @@ -363,9 +389,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout. Loading @@ -392,9 +418,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Scene times out back to blank after the screen timeout. Loading @@ -421,12 +447,6 @@ class CommunalSceneStartableTest : SysuiTestCase() { runCurrent() } private suspend fun TestScope.enableCommunal() = with(kosmos) { setCommunalAvailable(true) runCurrent() } companion object { private const val SCREEN_TIMEOUT = 1000 } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import com.android.systemui.communal.data.repository.fakeCommunalMediaRepository import com.android.systemui.communal.data.repository.fakeCommunalTutorialRepository import com.android.systemui.communal.data.repository.fakeCommunalWidgetRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.log.CommunalUiEvent Loading Loading @@ -106,6 +107,7 @@ class CommunalEditModeViewModelTest : SysuiTestCase() { underTest = CommunalEditModeViewModel( kosmos.communalSceneInteractor, kosmos.communalInteractor, kosmos.communalSettingsInteractor, mediaHost, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.systemui.communal.data.repository.fakeCommunalRepository import com.android.systemui.communal.data.repository.fakeCommunalTutorialRepository import com.android.systemui.communal.data.repository.fakeCommunalWidgetRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalTutorialInteractor import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.model.CommunalScenes Loading Loading @@ -143,6 +144,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { context.resources, kosmos.keyguardTransitionInteractor, kosmos.keyguardInteractor, kosmos.communalSceneInteractor, kosmos.communalInteractor, kosmos.communalTutorialInteractor, kosmos.shadeInteractor, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() { verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(testIntent), eq(false), isNull(), notNull(), refEq(fillInIntent), Loading @@ -91,6 +92,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() { verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(testIntent), eq(false), isNull(), isNull(), refEq(fillInIntent), Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt +6 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.animation.LaunchableView import com.android.systemui.assist.AssistManager import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.plugins.ActivityStarter.OnDismissAction Loading Loading @@ -94,6 +95,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { @Mock private lateinit var deviceProvisionedController: DeviceProvisionedController @Mock private lateinit var userTracker: UserTracker @Mock private lateinit var activityIntentHelper: ActivityIntentHelper @Mock private lateinit var communalSceneInteractor: CommunalSceneInteractor private lateinit var underTest: LegacyActivityStarterInternalImpl private val mainExecutor = FakeExecutor(FakeSystemClock()) private val shadeAnimationInteractor = Loading Loading @@ -127,6 +129,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { userTracker = userTracker, activityIntentHelper = activityIntentHelper, mainExecutor = mainExecutor, communalSceneInteractor = communalSceneInteractor, ) whenever(userTracker.userHandle).thenReturn(UserHandle.OWNER) } Loading @@ -138,7 +141,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { whenever(keyguardStateController.isShowing).thenReturn(true) whenever(deviceProvisionedController.isDeviceProvisioned).thenReturn(true) underTest.startPendingIntentDismissingKeyguard(pendingIntent) underTest.startPendingIntentDismissingKeyguard(intent = pendingIntent, dismissShade = true) mainExecutor.runAllReady() verify(statusBarKeyguardViewManager) Loading Loading @@ -232,6 +235,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { underTest.startPendingIntentDismissingKeyguard( intent = pendingIntent, dismissShade = true, intentSentUiThreadCallback = null, associatedView = associatedView, ) Loading Loading @@ -344,6 +348,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) { underTest.startPendingIntentDismissingKeyguard( intent = intent, dismissShade = true, intentSentUiThreadCallback = intentSentUiThreadCallback, animationController = animationController, showOverLockscreen = true, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +54 −34 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue Loading @@ -35,6 +36,8 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.notificationShadeWindowController import com.android.systemui.statusbar.phone.centralSurfaces import com.android.systemui.statusbar.phone.centralSurfacesOptional import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat Loading @@ -49,6 +52,7 @@ import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.whenever @OptIn(ExperimentalCoroutinesApi::class) @SmallTest Loading @@ -67,6 +71,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { CommunalSceneStartable( dockManager = dockManager, communalInteractor = communalInteractor, communalSceneInteractor = communalSceneInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, keyguardInteractor = keyguardInteractor, systemSettings = fakeSettings, Loading @@ -74,6 +79,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { applicationScope = applicationCoroutineScope, bgScope = applicationCoroutineScope, mainDispatcher = testDispatcher, centralSurfacesOpt = centralSurfacesOptional, ) .apply { start() } Loading @@ -90,9 +96,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun keyguardGoesAway_forceBlankScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -110,7 +116,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceDocked_forceCommunalScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) Loading @@ -127,8 +133,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun occluded_forceBlankScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(false) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) updateDocked(true) Loading @@ -141,11 +148,30 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Test fun occluded_doesNotForceBlankSceneIfLaunchingActivityOverLockscreen() = with(kosmos) { testScope.runTest { whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(true) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) updateDocked(true) fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.OCCLUDED, testScope = this ) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } @Test fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) Loading @@ -162,8 +188,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceAsleep_forceBlankSceneAfterTimeout() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -183,8 +209,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun deviceAsleep_wakesUpBeforeTimeout_noChangeInScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) communalInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalSceneInteractor.currentScene) communalSceneInteractor.changeScene(CommunalScenes.Communal) assertThat(scene).isEqualTo(CommunalScenes.Communal) fakeKeyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -212,8 +238,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun dockingOnLockscreen_forcesCommunal() = with(kosmos) { testScope.runTest { communalInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalInteractor.desiredScene) communalSceneInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalSceneInteractor.currentScene) // device is docked while on the lockscreen fakeKeyguardTransitionRepository.sendTransitionSteps( Loading @@ -234,8 +260,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() = with(kosmos) { testScope.runTest { communalInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalInteractor.desiredScene) communalSceneInteractor.changeScene(CommunalScenes.Blank) val scene by collectLastValue(communalSceneInteractor.currentScene) // device is docked while on the lockscreen fakeKeyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -266,9 +292,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Scene times out back to blank after the screen timeout. Loading @@ -283,11 +309,11 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is not dreaming and on communal. updateDreaming(false) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) // Scene stays as Communal advanceTimeBy(SCREEN_TIMEOUT.milliseconds) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } Loading @@ -298,9 +324,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout. Loading @@ -321,9 +347,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is on communal, but not dreaming. updateDreaming(false) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout, then start dreaming. Loading @@ -342,11 +368,11 @@ class CommunalSceneStartableTest : SysuiTestCase() { with(kosmos) { testScope.runTest { // Device is on communal. communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) // Device stays on the hub after the timeout since we're not dreaming. advanceTimeBy(SCREEN_TIMEOUT.milliseconds * 2) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Start dreaming. Loading @@ -363,9 +389,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { testScope.runTest { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Wait a bit, but not long enough to timeout. Loading @@ -392,9 +418,9 @@ class CommunalSceneStartableTest : SysuiTestCase() { // Device is dreaming and on communal. updateDreaming(true) communalInteractor.changeScene(CommunalScenes.Communal) communalSceneInteractor.changeScene(CommunalScenes.Communal) val scene by collectLastValue(communalInteractor.desiredScene) val scene by collectLastValue(communalSceneInteractor.currentScene) assertThat(scene).isEqualTo(CommunalScenes.Communal) // Scene times out back to blank after the screen timeout. Loading @@ -421,12 +447,6 @@ class CommunalSceneStartableTest : SysuiTestCase() { runCurrent() } private suspend fun TestScope.enableCommunal() = with(kosmos) { setCommunalAvailable(true) runCurrent() } companion object { private const val SCREEN_TIMEOUT = 1000 } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import com.android.systemui.communal.data.repository.fakeCommunalMediaRepository import com.android.systemui.communal.data.repository.fakeCommunalTutorialRepository import com.android.systemui.communal.data.repository.fakeCommunalWidgetRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.log.CommunalUiEvent Loading Loading @@ -106,6 +107,7 @@ class CommunalEditModeViewModelTest : SysuiTestCase() { underTest = CommunalEditModeViewModel( kosmos.communalSceneInteractor, kosmos.communalInteractor, kosmos.communalSettingsInteractor, mediaHost, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.systemui.communal.data.repository.fakeCommunalRepository import com.android.systemui.communal.data.repository.fakeCommunalTutorialRepository import com.android.systemui.communal.data.repository.fakeCommunalWidgetRepository import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.domain.interactor.communalTutorialInteractor import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.model.CommunalScenes Loading Loading @@ -143,6 +144,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { context.resources, kosmos.keyguardTransitionInteractor, kosmos.keyguardInteractor, kosmos.communalSceneInteractor, kosmos.communalInteractor, kosmos.communalTutorialInteractor, kosmos.shadeInteractor, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() { verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(testIntent), eq(false), isNull(), notNull(), refEq(fillInIntent), Loading @@ -91,6 +92,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() { verify(activityStarter) .startPendingIntentMaybeDismissingKeyguard( eq(testIntent), eq(false), isNull(), isNull(), refEq(fillInIntent), Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt +6 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.animation.LaunchableView import com.android.systemui.assist.AssistManager import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.plugins.ActivityStarter.OnDismissAction Loading Loading @@ -94,6 +95,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { @Mock private lateinit var deviceProvisionedController: DeviceProvisionedController @Mock private lateinit var userTracker: UserTracker @Mock private lateinit var activityIntentHelper: ActivityIntentHelper @Mock private lateinit var communalSceneInteractor: CommunalSceneInteractor private lateinit var underTest: LegacyActivityStarterInternalImpl private val mainExecutor = FakeExecutor(FakeSystemClock()) private val shadeAnimationInteractor = Loading Loading @@ -127,6 +129,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { userTracker = userTracker, activityIntentHelper = activityIntentHelper, mainExecutor = mainExecutor, communalSceneInteractor = communalSceneInteractor, ) whenever(userTracker.userHandle).thenReturn(UserHandle.OWNER) } Loading @@ -138,7 +141,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { whenever(keyguardStateController.isShowing).thenReturn(true) whenever(deviceProvisionedController.isDeviceProvisioned).thenReturn(true) underTest.startPendingIntentDismissingKeyguard(pendingIntent) underTest.startPendingIntentDismissingKeyguard(intent = pendingIntent, dismissShade = true) mainExecutor.runAllReady() verify(statusBarKeyguardViewManager) Loading Loading @@ -232,6 +235,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { underTest.startPendingIntentDismissingKeyguard( intent = pendingIntent, dismissShade = true, intentSentUiThreadCallback = null, associatedView = associatedView, ) Loading Loading @@ -344,6 +348,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) { underTest.startPendingIntentDismissingKeyguard( intent = intent, dismissShade = true, intentSentUiThreadCallback = intentSentUiThreadCallback, animationController = animationController, showOverLockscreen = true, Loading