diff options
3 files changed, 20 insertions, 5 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt index c9e7a5d7df05..ff137b768b65 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt @@ -398,6 +398,7 @@ class CommunalInteractorTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun ctaTile_showsByDefault() = kosmos.runTest { fakeCommunalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED) @@ -412,6 +413,7 @@ class CommunalInteractorTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun ctaTile_afterDismiss_doesNotShow() = kosmos.runTest { // Set to main user, so we can dismiss the tile for the main user. diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt index b70f46c4b01c..7866a7f01658 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt @@ -29,6 +29,7 @@ import com.android.systemui.Flags.FLAG_BOUNCER_UI_REVAMP import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.Flags.FLAG_COMMUNAL_RESPONSIVE_GRID import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_DIRECT_EDIT_MODE +import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2 import com.android.systemui.SysuiTestCase import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepository import com.android.systemui.communal.data.model.CommunalSmartspaceTimer @@ -219,6 +220,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun ordering_smartspaceBeforeUmoBeforeWidgetsBeforeCtaTile() = testScope.runTest { tutorialRepository.setTutorialSettingState(Settings.Secure.HUB_MODE_TUTORIAL_COMPLETED) @@ -258,7 +260,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { /** TODO(b/378171351): Handle ongoing content in responsive grid. */ @Test - @DisableFlags(FLAG_COMMUNAL_RESPONSIVE_GRID) + @DisableFlags(FLAG_COMMUNAL_RESPONSIVE_GRID, FLAG_GLANCEABLE_HUB_V2) fun ongoingContent_umoAndOneTimer_sizedAppropriately() = testScope.runTest { // Widgets available. @@ -296,7 +298,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { /** TODO(b/378171351): Handle ongoing content in responsive grid. */ @Test - @DisableFlags(FLAG_COMMUNAL_RESPONSIVE_GRID) + @DisableFlags(FLAG_COMMUNAL_RESPONSIVE_GRID, FLAG_GLANCEABLE_HUB_V2) fun ongoingContent_umoAndTwoTimers_sizedAppropriately() = testScope.runTest { // Widgets available. @@ -342,6 +344,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun communalContent_mediaHostVisible_umoIncluded() = testScope.runTest { // Media playing. @@ -353,6 +356,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun communalContent_mediaHostVisible_umoExcluded() = testScope.runTest { whenever(mediaHost.visible).thenReturn(false) @@ -408,6 +412,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun dismissCta_hidesCtaTileAndShowsPopup_thenHidesPopupAfterTimeout() = testScope.runTest { setIsMainUser(true) @@ -734,6 +739,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun communalContent_emitsFrozenContent_whenFrozen() = testScope.runTest { val communalContent by collectLastValue(underTest.communalContent) @@ -790,6 +796,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test + @DisableFlags(FLAG_GLANCEABLE_HUB_V2) fun communalContent_emitsLatestContent_whenNotFrozen() = testScope.runTest { val communalContent by collectLastValue(underTest.communalContent) diff --git a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt index b4e6e9348b3d..e46592265ef0 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt @@ -541,10 +541,16 @@ constructor( } /** CTA tile to be displayed in the glanceable hub (view mode). */ - val ctaTileContent: Flow<List<CommunalContentModel.CtaTileInViewMode>> = - communalPrefsInteractor.isCtaDismissed.map { isDismissed -> - if (isDismissed) emptyList() else listOf(CommunalContentModel.CtaTileInViewMode()) + val ctaTileContent: Flow<List<CommunalContentModel.CtaTileInViewMode>> by lazy { + if (communalSettingsInteractor.isV2FlagEnabled()) { + flowOf(listOf<CommunalContentModel.CtaTileInViewMode>()) + } else { + communalPrefsInteractor.isCtaDismissed.map { isDismissed -> + if (isDismissed) listOf<CommunalContentModel.CtaTileInViewMode>() + else listOf(CommunalContentModel.CtaTileInViewMode()) + } } + } /** A list of tutorial content to be displayed in the communal hub in tutorial mode. */ val tutorialContent: List<CommunalContentModel.Tutorial> = |