diff options
18 files changed, 125 insertions, 33 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt index a9541d962639..eec74efd4751 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt @@ -40,6 +40,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.data.repository.FakeShadeRepository +import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -81,6 +82,10 @@ class KeyguardInteractorTest : SysuiTestCase() { keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, sceneInteractorProvider = { sceneInteractor }, fromGoneTransitionInteractor = { fromGoneTransitionInteractor }, + sharedNotificationContainerInteractor = { + kosmos.sharedNotificationContainerInteractor + }, + applicationScope = testScope, ) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelTest.kt index 2ccc8b44eff8..9e5f7c9ba648 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelTest.kt @@ -16,15 +16,20 @@ package com.android.systemui.statusbar.notification.stack.ui.viewmodel +import android.platform.test.annotations.DisableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.common.shared.model.NotificationContainerBounds +import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.domain.interactor.keyguardInteractor +import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor import com.android.systemui.statusbar.notification.stack.shared.model.StackBounds import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @@ -33,14 +38,22 @@ import org.junit.runner.RunWith class NotificationsPlaceholderViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() private val underTest = kosmos.notificationsPlaceholderViewModel + @Test - fun onBoundsChanged_setsNotificationContainerBounds() { - underTest.onBoundsChanged(left = 5f, top = 5f, right = 5f, bottom = 5f) - assertThat(kosmos.keyguardInteractor.notificationContainerBounds.value) - .isEqualTo(NotificationContainerBounds(top = 5f, bottom = 5f)) - assertThat(kosmos.notificationStackAppearanceInteractor.stackBounds.value) - .isEqualTo(StackBounds(left = 5f, top = 5f, right = 5f, bottom = 5f)) - } + @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) + fun onBoundsChanged_setsNotificationContainerBounds() = + kosmos.testScope.runTest { + underTest.onBoundsChanged(left = 5f, top = 5f, right = 5f, bottom = 5f) + val containerBounds by + collectLastValue(kosmos.keyguardInteractor.notificationContainerBounds) + val stackBounds by + collectLastValue(kosmos.notificationStackAppearanceInteractor.stackBounds) + assertThat(containerBounds) + .isEqualTo(NotificationContainerBounds(top = 5f, bottom = 5f)) + assertThat(stackBounds) + .isEqualTo(StackBounds(left = 5f, top = 5f, right = 5f, bottom = 5f)) + } + @Test fun onContentTopChanged_setsContentTop() { underTest.onContentTopChanged(padding = 5f) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt index 5256bb956bc4..8e2dd7360407 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt @@ -493,7 +493,7 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { showLockscreen() keyguardInteractor.setNotificationContainerBounds( - NotificationContainerBounds(top = 1f, bottom = 2f) + NotificationContainerBounds(top = 1f, bottom = 52f) ) runCurrent() @@ -521,7 +521,7 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { showLockscreen() keyguardInteractor.setNotificationContainerBounds( - NotificationContainerBounds(top = 1f, bottom = 2f) + NotificationContainerBounds(top = 1f, bottom = 52f) ) runCurrent() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index 283f1601846b..851eafa1a4df 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -29,6 +29,8 @@ import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCall import com.android.systemui.common.shared.model.NotificationContainerBounds import com.android.systemui.common.ui.domain.interactor.ConfigurationInteractor import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.data.repository.KeyguardRepository import com.android.systemui.keyguard.shared.model.BiometricUnlockModel import com.android.systemui.keyguard.shared.model.BiometricUnlockSource @@ -46,14 +48,17 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlags import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.data.repository.ShadeRepository import com.android.systemui.statusbar.CommandQueue +import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor import com.android.systemui.util.kotlin.sample import javax.inject.Inject import javax.inject.Provider +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine @@ -66,6 +71,7 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onStart +import kotlinx.coroutines.flow.stateIn /** * Encapsulates business-logic related to the keyguard but not to a more specific part within it. @@ -84,16 +90,33 @@ constructor( keyguardTransitionInteractor: KeyguardTransitionInteractor, sceneInteractorProvider: Provider<SceneInteractor>, private val fromGoneTransitionInteractor: Provider<FromGoneTransitionInteractor>, + sharedNotificationContainerInteractor: Provider<SharedNotificationContainerInteractor>, + @Application applicationScope: CoroutineScope, ) { // TODO(b/296118689): move to a repository - private val _sharedNotificationContainerBounds = MutableStateFlow(NotificationContainerBounds()) + private val _notificationPlaceholderBounds = MutableStateFlow(NotificationContainerBounds()) /** Bounds of the notification container. */ - val notificationContainerBounds: StateFlow<NotificationContainerBounds> = - _sharedNotificationContainerBounds.asStateFlow() + val notificationContainerBounds: StateFlow<NotificationContainerBounds> by lazy { + combine( + _notificationPlaceholderBounds, + sharedNotificationContainerInteractor.get().configurationBasedDimensions, + ) { bounds, cfg -> + // We offset the placeholder bounds by the configured top margin to account for + // legacy placement behavior within notifications for splitshade. + if (MigrateClocksToBlueprint.isEnabled && cfg.useSplitShade) { + bounds.copy(bottom = bounds.bottom - cfg.keyguardSplitShadeTopMargin) + } else bounds + } + .stateIn( + scope = applicationScope, + started = SharingStarted.WhileSubscribed(), + initialValue = NotificationContainerBounds(), + ) + } fun setNotificationContainerBounds(position: NotificationContainerBounds) { - _sharedNotificationContainerBounds.value = position + _notificationPlaceholderBounds.value = position } /** diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt index 2b601cdc012f..edcf97a81ea4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt @@ -25,7 +25,6 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet.BOTTOM import androidx.constraintlayout.widget.ConstraintSet.TOP -import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.res.R @@ -51,21 +50,18 @@ constructor( * indication area, whichever is higher. */ protected fun addNotificationPlaceholderBarrier(constraintSet: ConstraintSet) { - val lockId = - if (DeviceEntryUdfpsRefactor.isEnabled) { - R.id.device_entry_icon_view - } else { - R.id.lock_icon_view - } - constraintSet.apply { createBarrier( R.id.nssl_placeholder_barrier_bottom, Barrier.TOP, 0, - *intArrayOf(lockId, R.id.ambient_indication_container) + *intArrayOf( + R.id.device_entry_icon_view, + R.id.lock_icon_view, + R.id.ambient_indication_container + ) ) - connect(R.id.nssl_placeholder, BOTTOM, R.id.nssl_placeholder_barrier_bottom, TOP) + connect(placeHolderId, BOTTOM, R.id.nssl_placeholder_barrier_bottom, TOP) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt index 49f7565517da..c782e9d2d98d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt @@ -21,6 +21,7 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysUITestModule import com.android.systemui.SysuiTestCase import com.android.systemui.TestMocksModule +import com.android.systemui.biometrics.domain.BiometricsDomainLayerModule import com.android.systemui.coroutines.collectValues import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository @@ -441,6 +442,7 @@ class InWindowLauncherUnlockAnimationInteractorTest : SysuiTestCase() { modules = [ SysUITestModule::class, + BiometricsDomainLayerModule::class, ] ) interface TestComponent { diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt index e9399cc17158..33e9b363915c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt @@ -20,6 +20,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysUITestModule import com.android.systemui.SysuiTestCase +import com.android.systemui.biometrics.domain.BiometricsDomainLayerModule import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController @@ -118,6 +119,7 @@ class InWindowLauncherUnlockAnimationManagerTest : SysuiTestCase() { modules = [ SysUITestModule::class, + BiometricsDomainLayerModule::class, ] ) interface TestComponent { diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java index 1ee26db81826..02f2e16b9570 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java @@ -197,7 +197,9 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { shadeRepository, keyguardTransitionInteractor, () -> sceneInteractor, - () -> mKosmos.getFromGoneTransitionInteractor()); + () -> mKosmos.getFromGoneTransitionInteractor(), + () -> mKosmos.getSharedNotificationContainerInteractor(), + mTestScope); CommunalInteractor communalInteractor = mKosmos.getCommunalInteractor(); mFromLockscreenTransitionInteractor = mKosmos.getFromLockscreenTransitionInteractor(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java index b9451bafec90..ee279d892c1d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java @@ -223,7 +223,9 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase { mShadeRepository, keyguardTransitionInteractor, () -> sceneInteractor, - () -> mKosmos.getFromGoneTransitionInteractor()); + () -> mKosmos.getFromGoneTransitionInteractor(), + () -> mKosmos.getSharedNotificationContainerInteractor(), + mTestScope); mFromLockscreenTransitionInteractor = mKosmos.getFromLockscreenTransitionInteractor(); mFromPrimaryBouncerTransitionInteractor = diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt index f9e08fee2120..e54b53225320 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt @@ -50,7 +50,6 @@ import com.android.systemui.keyguard.domain.interactor.fromLockscreenTransitionI import com.android.systemui.keyguard.domain.interactor.fromPrimaryBouncerTransitionInteractor import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor -import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.power.data.repository.FakePowerRepository @@ -65,6 +64,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractorImpl import com.android.systemui.shade.domain.interactor.ShadeInteractorLegacyImpl import com.android.systemui.statusbar.disableflags.data.repository.FakeDisableFlagsRepository import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor +import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController import com.android.systemui.statusbar.policy.data.repository.FakeUserSetupRepository import com.android.systemui.statusbar.policy.domain.interactor.deviceProvisioningInteractor @@ -153,6 +153,8 @@ class StatusBarStateControllerImplTest : SysuiTestCase() { keyguardTransitionInteractor, { kosmos.sceneInteractor }, { kosmos.fromGoneTransitionInteractor }, + { kosmos.sharedNotificationContainerInteractor }, + testScope, ) whenever(deviceEntryUdfpsInteractor.isUdfpsSupported).thenReturn(MutableStateFlow(false)) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt index 7faf5628b40a..b410b33b97d9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt @@ -21,6 +21,7 @@ import com.android.systemui.SysUITestComponent import com.android.systemui.SysUITestModule import com.android.systemui.SysuiTestCase import com.android.systemui.TestMocksModule +import com.android.systemui.biometrics.domain.BiometricsDomainLayerModule import com.android.systemui.collectLastValue import com.android.systemui.dagger.SysUISingleton import com.android.systemui.deviceentry.data.repository.FakeDeviceEntryRepository @@ -155,7 +156,7 @@ class AlwaysOnDisplayNotificationIconsInteractorTest : SysuiTestCase() { private val bubbles: Bubbles = mock() - @Component(modules = [SysUITestModule::class]) + @Component(modules = [SysUITestModule::class, BiometricsDomainLayerModule::class]) @SysUISingleton interface TestComponent : SysUITestComponent<AlwaysOnDisplayNotificationIconsInteractor> { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java index d9e9c596ee4a..05fd63e96089 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java @@ -178,7 +178,9 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase { new FakeShadeRepository(), keyguardTransitionInteractor, () -> mKosmos.getSceneInteractor(), - () -> mKosmos.getFromGoneTransitionInteractor()); + () -> mKosmos.getFromGoneTransitionInteractor(), + () -> mKosmos.getSharedNotificationContainerInteractor(), + mTestScope); mViewModel = new KeyguardStatusBarViewModel( mTestScope.getBackgroundScope(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt index f63f79ff9835..865b312b6a4b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt @@ -23,6 +23,7 @@ import com.android.systemui.CoroutineTestScopeModule import com.android.systemui.SysUITestComponent import com.android.systemui.SysUITestModule import com.android.systemui.SysuiTestCase +import com.android.systemui.biometrics.domain.BiometricsDomainLayerModule import com.android.systemui.collectLastValue import com.android.systemui.collectValues import com.android.systemui.communal.dagger.CommunalModule @@ -60,6 +61,7 @@ class CollapsedStatusBarViewModelImplTest : SysuiTestCase() { [ SysUITestModule::class, CommunalModule::class, + BiometricsDomainLayerModule::class, ] ) interface TestComponent : SysUITestComponent<CollapsedStatusBarViewModelImpl> { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt index e4b9f102c51c..ae3425678abd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt @@ -35,6 +35,7 @@ import com.android.systemui.shade.data.repository.FakeShadeRepository import com.android.systemui.statusbar.CommandQueue import com.android.systemui.statusbar.data.repository.FakeKeyguardStatusBarRepository import com.android.systemui.statusbar.domain.interactor.KeyguardStatusBarInteractor +import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.testKosmos import com.android.systemui.util.mockito.argumentCaptor @@ -66,6 +67,8 @@ class KeyguardStatusBarViewModelTest : SysuiTestCase() { kosmos.keyguardTransitionInteractor, { kosmos.sceneInteractor }, { kosmos.fromGoneTransitionInteractor }, + { kosmos.sharedNotificationContainerInteractor }, + testScope, ) private val keyguardStatusBarInteractor = KeyguardStatusBarInteractor( diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index ec27f48f9570..aabd4e9e79be 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -442,7 +442,9 @@ public class BubblesTest extends SysuiTestCase { shadeRepository, keyguardTransitionInteractor, () -> sceneInteractor, - () -> mKosmos.getFromGoneTransitionInteractor()); + () -> mKosmos.getFromGoneTransitionInteractor(), + () -> mKosmos.getSharedNotificationContainerInteractor(), + mTestScope); mFromLockscreenTransitionInteractor = mKosmos.getFromLockscreenTransitionInteractor(); mFromPrimaryBouncerTransitionInteractor = diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt index 00cdc337bc06..e21c76672c1d 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt @@ -24,15 +24,20 @@ import com.android.systemui.flags.FakeFeatureFlags import com.android.systemui.keyguard.data.repository.FakeCommandQueue import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.keyguard.shared.model.KeyguardState +import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.domain.interactor.PowerInteractorFactory import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.FakeSceneContainerFlags import com.android.systemui.scene.shared.flag.SceneContainerFlags import com.android.systemui.shade.data.repository.FakeShadeRepository +import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor +import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor.ConfigurationBasedDimensions import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.test.TestScope /** * Simply put, I got tired of adding a constructor argument and then having to tweak dozens of @@ -52,13 +57,33 @@ object KeyguardInteractorFactory { shadeRepository: FakeShadeRepository = FakeShadeRepository(), sceneInteractor: SceneInteractor = mock(), fromGoneTransitionInteractor: FromGoneTransitionInteractor = mock(), + sharedNotificationContainerInteractor: SharedNotificationContainerInteractor? = null, powerInteractor: PowerInteractor = PowerInteractorFactory.create().powerInteractor, + testScope: CoroutineScope = TestScope(), ): WithDependencies { - // Mock this until the class is replaced by kosmos - val keyguardTransitionInteractor: KeyguardTransitionInteractor = mock() + // Mock these until they are replaced by kosmos val currentKeyguardStateFlow = MutableSharedFlow<KeyguardState>() - whenever(keyguardTransitionInteractor.currentKeyguardState) - .thenReturn(currentKeyguardStateFlow) + val keyguardTransitionInteractor = + mock<KeyguardTransitionInteractor>().also { + whenever(it.currentKeyguardState).thenReturn(currentKeyguardStateFlow) + } + val configurationDimensionFlow = MutableSharedFlow<ConfigurationBasedDimensions>() + configurationDimensionFlow.tryEmit( + ConfigurationBasedDimensions( + useSplitShade = false, + useLargeScreenHeader = false, + marginHorizontal = 0, + marginBottom = 0, + marginTop = 0, + marginTopLargeScreen = 0, + keyguardSplitShadeTopMargin = 0, + ) + ) + val sncInteractor = + sharedNotificationContainerInteractor + ?: mock<SharedNotificationContainerInteractor>().also { + whenever(it.configurationBasedDimensions).thenReturn(configurationDimensionFlow) + } return WithDependencies( repository = repository, commandQueue = commandQueue, @@ -79,6 +104,8 @@ object KeyguardInteractorFactory { keyguardTransitionInteractor = keyguardTransitionInteractor, powerInteractor = powerInteractor, fromGoneTransitionInteractor = { fromGoneTransitionInteractor }, + sharedNotificationContainerInteractor = { sncInteractor }, + applicationScope = testScope, ), ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorKosmos.kt index d61bc9f559bb..2a0c01c5c0af 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorKosmos.kt @@ -20,11 +20,13 @@ import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository import com.android.systemui.common.ui.domain.interactor.configurationInteractor import com.android.systemui.keyguard.data.repository.keyguardRepository import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.flag.sceneContainerFlags import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.statusbar.commandQueue +import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor val Kosmos.keyguardInteractor: KeyguardInteractor by Kosmos.Fixture { @@ -39,5 +41,7 @@ val Kosmos.keyguardInteractor: KeyguardInteractor by keyguardTransitionInteractor = keyguardTransitionInteractor, sceneInteractorProvider = { sceneInteractor }, fromGoneTransitionInteractor = { fromGoneTransitionInteractor }, + sharedNotificationContainerInteractor = { sharedNotificationContainerInteractor }, + applicationScope = testScope.backgroundScope, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt index 67d08f8d6284..1b23296ec4d3 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt @@ -49,6 +49,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.sceneContainerConfig import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags import com.android.systemui.scene.shared.model.sceneDataSource +import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor import com.android.systemui.statusbar.phone.screenOffAnimationController import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.policy.data.repository.fakeDeviceProvisioningRepository @@ -102,6 +103,9 @@ class KosmosJavaAdapter( val globalActionsInteractor by lazy { kosmos.globalActionsInteractor } val sceneDataSource by lazy { kosmos.sceneDataSource } val keyguardClockInteractor by lazy { kosmos.keyguardClockInteractor } + val sharedNotificationContainerInteractor by lazy { + kosmos.sharedNotificationContainerInteractor + } init { kosmos.applicationContext = testCase.context |