Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt +0 −0 File moved. View file packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before Loading Loading @@ -654,7 +655,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : var notificationCount = 10 val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> notificationCount } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) showLockscreen() overrideResource(R.bool.config_use_split_notification_shade, false) Loading @@ -668,12 +669,14 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : // Also updates when directly requested (as it would from NotificationStackScrollLayout) notificationCount = 25 sharedNotificationContainerInteractor.notificationStackChanged() advanceTimeBy(50L) assertThat(maxNotifications).isEqualTo(25) // Also ensure another collection starts with the same value. As an example, folding // then unfolding will restart the coroutine and it must get the last value immediately. val newMaxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) assertThat(newMaxNotifications).isEqualTo(25) } Loading @@ -683,7 +686,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : var notificationCount = 10 val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> notificationCount } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) showLockscreen() overrideResource(R.bool.config_use_split_notification_shade, false) Loading Loading @@ -718,6 +721,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : testScope.runTest { val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> 10 } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) // Show lockscreen with shade expanded showLockscreenWithShadeExpanded() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt +4 −5 Original line number Diff line number Diff line Loading @@ -29,11 +29,10 @@ import com.android.systemui.statusbar.policy.SplitShadeStateController import dagger.Lazy import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart Loading @@ -54,9 +53,9 @@ constructor( private val _topPosition = MutableStateFlow(0f) val topPosition = _topPosition.asStateFlow() private val _notificationStackChanged = MutableSharedFlow<Unit>(extraBufferCapacity = 1) private val _notificationStackChanged = MutableStateFlow(0L) /** An internal modification was made to notifications */ val notificationStackChanged = _notificationStackChanged.asSharedFlow() val notificationStackChanged = _notificationStackChanged.debounce(20L) val configurationBasedDimensions: Flow<ConfigurationBasedDimensions> = configurationRepository.onAnyConfigurationChange Loading Loading @@ -113,7 +112,7 @@ constructor( /** An internal modification was made to notifications */ fun notificationStackChanged() { _notificationStackChanged.tryEmit(Unit) _notificationStackChanged.value = _notificationStackChanged.value + 1 } data class ConfigurationBasedDimensions( Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -636,7 +636,7 @@ constructor( showUnlimitedNotifications, shadeInteractor.isUserInteracting, availableHeight, interactor.notificationStackChanged.onStart { emit(Unit) }, interactor.notificationStackChanged, interactor.useExtraShelfSpace, ) { flows -> val showLimitedNotifications = flows[0] as Boolean Loading Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt +0 −0 File moved. View file
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before Loading Loading @@ -654,7 +655,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : var notificationCount = 10 val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> notificationCount } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) showLockscreen() overrideResource(R.bool.config_use_split_notification_shade, false) Loading @@ -668,12 +669,14 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : // Also updates when directly requested (as it would from NotificationStackScrollLayout) notificationCount = 25 sharedNotificationContainerInteractor.notificationStackChanged() advanceTimeBy(50L) assertThat(maxNotifications).isEqualTo(25) // Also ensure another collection starts with the same value. As an example, folding // then unfolding will restart the coroutine and it must get the last value immediately. val newMaxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) assertThat(newMaxNotifications).isEqualTo(25) } Loading @@ -683,7 +686,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : var notificationCount = 10 val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> notificationCount } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) showLockscreen() overrideResource(R.bool.config_use_split_notification_shade, false) Loading Loading @@ -718,6 +721,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization?) : testScope.runTest { val calculateSpace = { space: Float, useExtraShelfSpace: Boolean -> 10 } val maxNotifications by collectLastValue(underTest.getMaxNotifications(calculateSpace)) advanceTimeBy(50L) // Show lockscreen with shade expanded showLockscreenWithShadeExpanded() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt +4 −5 Original line number Diff line number Diff line Loading @@ -29,11 +29,10 @@ import com.android.systemui.statusbar.policy.SplitShadeStateController import dagger.Lazy import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart Loading @@ -54,9 +53,9 @@ constructor( private val _topPosition = MutableStateFlow(0f) val topPosition = _topPosition.asStateFlow() private val _notificationStackChanged = MutableSharedFlow<Unit>(extraBufferCapacity = 1) private val _notificationStackChanged = MutableStateFlow(0L) /** An internal modification was made to notifications */ val notificationStackChanged = _notificationStackChanged.asSharedFlow() val notificationStackChanged = _notificationStackChanged.debounce(20L) val configurationBasedDimensions: Flow<ConfigurationBasedDimensions> = configurationRepository.onAnyConfigurationChange Loading Loading @@ -113,7 +112,7 @@ constructor( /** An internal modification was made to notifications */ fun notificationStackChanged() { _notificationStackChanged.tryEmit(Unit) _notificationStackChanged.value = _notificationStackChanged.value + 1 } data class ConfigurationBasedDimensions( Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -636,7 +636,7 @@ constructor( showUnlimitedNotifications, shadeInteractor.isUserInteracting, availableHeight, interactor.notificationStackChanged.onStart { emit(Unit) }, interactor.notificationStackChanged, interactor.useExtraShelfSpace, ) { flows -> val showLimitedNotifications = flows[0] as Boolean Loading