diff options
6 files changed, 20 insertions, 20 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 16cfa2398fd5..1f8e29adc983 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 @@ -161,7 +161,7 @@ class CommunalInteractorTest : SysuiTestCase() { whenever(target1.remoteViews).thenReturn(mock(RemoteViews::class.java)) val targets = listOf(target1, target2, target3) - smartspaceRepository.setLockscreenSmartspaceTargets(targets) + smartspaceRepository.setCommunalSmartspaceTargets(targets) val smartspaceContent by collectLastValue(underTest.smartspaceContent) assertThat(smartspaceContent?.size).isEqualTo(1) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt index ce7db80db7da..1fc76f59b774 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt @@ -109,7 +109,7 @@ class CommunalEditModeViewModelTest : SysuiTestCase() { whenever(target.smartspaceTargetId).thenReturn("target") whenever(target.featureType).thenReturn(SmartspaceTarget.FEATURE_TIMER) whenever(target.remoteViews).thenReturn(Mockito.mock(RemoteViews::class.java)) - smartspaceRepository.setLockscreenSmartspaceTargets(listOf(target)) + smartspaceRepository.setCommunalSmartspaceTargets(listOf(target)) // Media playing. mediaRepository.mediaPlaying.value = true 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 32f4d075a873..ee472ada56b9 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 @@ -128,7 +128,7 @@ class CommunalViewModelTest : SysuiTestCase() { whenever(target.smartspaceTargetId).thenReturn("target") whenever(target.featureType).thenReturn(SmartspaceTarget.FEATURE_TIMER) whenever(target.remoteViews).thenReturn(Mockito.mock(RemoteViews::class.java)) - smartspaceRepository.setLockscreenSmartspaceTargets(listOf(target)) + smartspaceRepository.setCommunalSmartspaceTargets(listOf(target)) // Media playing. mediaRepository.mediaPlaying.value = true 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 e630fd4e3c54..0c6706ad8f91 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 @@ -108,7 +108,7 @@ constructor( if (!smartspaceRepository.isSmartspaceRemoteViewsEnabled) { flowOf(emptyList()) } else { - smartspaceRepository.lockscreenSmartspaceTargets.map { targets -> + smartspaceRepository.communalSmartspaceTargets.map { targets -> targets .filter { target -> target.featureType == SmartspaceTarget.FEATURE_TIMER && diff --git a/packages/SystemUI/src/com/android/systemui/smartspace/data/repository/SmartspaceRepository.kt b/packages/SystemUI/src/com/android/systemui/smartspace/data/repository/SmartspaceRepository.kt index 2fc0ec290a90..095d30ef55df 100644 --- a/packages/SystemUI/src/com/android/systemui/smartspace/data/repository/SmartspaceRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/smartspace/data/repository/SmartspaceRepository.kt @@ -19,9 +19,9 @@ package com.android.systemui.smartspace.data.repository import android.app.smartspace.SmartspaceTarget import android.os.Parcelable import android.widget.RemoteViews +import com.android.systemui.communal.smartspace.CommunalSmartspaceController import com.android.systemui.dagger.SysUISingleton import com.android.systemui.plugins.BcSmartspaceDataPlugin -import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow @@ -32,37 +32,37 @@ interface SmartspaceRepository { /** Whether [RemoteViews] are passed through smartspace targets. */ val isSmartspaceRemoteViewsEnabled: Boolean - /** Smartspace targets for the lockscreen surface. */ - val lockscreenSmartspaceTargets: Flow<List<SmartspaceTarget>> + /** Smartspace targets for the communal surface. */ + val communalSmartspaceTargets: Flow<List<SmartspaceTarget>> } @SysUISingleton class SmartspaceRepositoryImpl @Inject constructor( - private val lockscreenSmartspaceController: LockscreenSmartspaceController, + private val communalSmartspaceController: CommunalSmartspaceController, ) : SmartspaceRepository, BcSmartspaceDataPlugin.SmartspaceTargetListener { override val isSmartspaceRemoteViewsEnabled: Boolean get() = android.app.smartspace.flags.Flags.remoteViews() - private val _lockscreenSmartspaceTargets: MutableStateFlow<List<SmartspaceTarget>> = + private val _communalSmartspaceTargets: MutableStateFlow<List<SmartspaceTarget>> = MutableStateFlow(emptyList()) - override val lockscreenSmartspaceTargets: Flow<List<SmartspaceTarget>> = - _lockscreenSmartspaceTargets + override val communalSmartspaceTargets: Flow<List<SmartspaceTarget>> = + _communalSmartspaceTargets .onStart { - lockscreenSmartspaceController.addListener(listener = this@SmartspaceRepositoryImpl) + communalSmartspaceController.addListener(listener = this@SmartspaceRepositoryImpl) } .onCompletion { - lockscreenSmartspaceController.removeListener( + communalSmartspaceController.removeListener( listener = this@SmartspaceRepositoryImpl ) } override fun onSmartspaceTargetsUpdated(targetsNullable: MutableList<out Parcelable>?) { targetsNullable?.let { targets -> - _lockscreenSmartspaceTargets.value = targets.filterIsInstance<SmartspaceTarget>() + _communalSmartspaceTargets.value = targets.filterIsInstance<SmartspaceTarget>() } - ?: run { _lockscreenSmartspaceTargets.value = emptyList() } + ?: run { _communalSmartspaceTargets.value = emptyList() } } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/smartspace/data/repository/FakeSmartspaceRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/smartspace/data/repository/FakeSmartspaceRepository.kt index c8013ef96fa7..862e52d7703f 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/smartspace/data/repository/FakeSmartspaceRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/smartspace/data/repository/FakeSmartspaceRepository.kt @@ -10,12 +10,12 @@ class FakeSmartspaceRepository( override val isSmartspaceRemoteViewsEnabled = smartspaceRemoteViewsEnabled - private val _lockscreenSmartspaceTargets: MutableStateFlow<List<SmartspaceTarget>> = + private val _communalSmartspaceTargets: MutableStateFlow<List<SmartspaceTarget>> = MutableStateFlow(emptyList()) - override val lockscreenSmartspaceTargets: Flow<List<SmartspaceTarget>> = - _lockscreenSmartspaceTargets + override val communalSmartspaceTargets: Flow<List<SmartspaceTarget>> = + _communalSmartspaceTargets - fun setLockscreenSmartspaceTargets(targets: List<SmartspaceTarget>) { - _lockscreenSmartspaceTargets.value = targets + fun setCommunalSmartspaceTargets(targets: List<SmartspaceTarget>) { + _communalSmartspaceTargets.value = targets } } |