Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -39,9 +39,9 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationScrollViewModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -149,8 +149,9 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { @Test fun onPanelShapeChanged() = testScope.runTest { val actual by collectLastValue(kosmos.notificationStackAppearanceInteractor.qsPanelShape) var actual: ShadeScrimShape? = null kosmos.notificationScrollViewModel.setQsScrimShapeConsumer { shape -> actual = shape } val expected = ShadeScrimShape( bounds = ShadeScrimBounds(left = 10f, top = 0f, right = 710f, bottom = 600f), Loading @@ -160,7 +161,7 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { underTest.onPanelShapeChanged(expected) assertThat(expected).isEqualTo(actual) assertThat(actual).isEqualTo(expected) } private fun TestScope.lockDevice() { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt +3 −5 Original line number Diff line number Diff line Loading @@ -54,10 +54,10 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { assertThat(stackBounds).isEqualTo(bounds2) } @Test fun setQsPanelShape() = testScope.runTest { val actual by collectLastValue(underTest.qsPanelShape) var actual: ShadeScrimShape? = null underTest.setQsPanelShapeConsumer { shape -> actual = shape } val expected1 = ShadeScrimShape( Loading @@ -65,11 +65,9 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { topRadius = 0, bottomRadius = 10, ) underTest.setQsPanelShape(expected1) assertThat(actual).isEqualTo(expected1) val expected2 = expected1.copy(topRadius = 10) underTest.setQsPanelShape(expected2) assertThat(expected2).isEqualTo(actual) } Loading Loading @@ -97,7 +95,7 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { fun setQsPanelShape_withImproperBounds_throwsException() = testScope.runTest { val invalidBounds = ShadeScrimBounds(top = 0f, bottom = -10f) underTest.setQsPanelShape( underTest.sendQsPanelShape( ShadeScrimShape(bounds = invalidBounds, topRadius = 10, bottomRadius = 10) ) } Loading packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ constructor( /** Notifies that the bounds of the QuickSettings panel have changed. */ fun onPanelShapeChanged(shape: ShadeScrimShape?) { notificationStackAppearanceInteractor.setQsPanelShape(shape) notificationStackAppearanceInteractor.sendQsPanelShape(shape) } fun onScrimClicked() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt +6 −8 Original line number Diff line number Diff line Loading @@ -45,14 +45,6 @@ class NotificationPlaceholderRepository @Inject constructor() { */ val notificationShadeScrimBounds = MutableStateFlow<ShadeScrimBounds?>(null) /** * The shape of the QuickSettings overlay panel. Used to clip Notification content when the QS * covers it. * * When `null`, it doesn't affect notification clipping. */ val qsPanelShape = MutableStateFlow<ShadeScrimShape?>(null) /** height made available to the notifications in the size-constrained mode of lock screen. */ val constrainedAvailableSpace = MutableStateFlow(0) Loading @@ -61,4 +53,10 @@ class NotificationPlaceholderRepository @Inject constructor() { /** A consumer of [AccessibilityScrollEvent]s. */ var accessibilityScrollEventConsumer: Consumer<AccessibilityScrollEvent>? = null /** * A consumer of [ShadeScrimShape], to be updated when the bounds of the QuickSettings Overlay * panel changes. */ var qsPanelShapeConsumer: ((ShadeScrimShape?) -> Unit)? = null } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt +15 −6 Original line number Diff line number Diff line Loading @@ -51,9 +51,6 @@ constructor( val notificationShadeScrimBounds: StateFlow<ShadeScrimBounds?> = placeholderRepository.notificationShadeScrimBounds.asStateFlow() /** The shape of the QuickSettingsShadeOverlay panel */ val qsPanelShape: StateFlow<ShadeScrimShape?> = placeholderRepository.qsPanelShape.asStateFlow() /** * Whether the stack is expanding from GONE-with-HUN to SHADE * Loading Loading @@ -128,10 +125,22 @@ constructor( placeholderRepository.notificationShadeScrimBounds.value = bounds } /** Sets the bounds of the QuickSettings overlay panel */ fun setQsPanelShape(shape: ShadeScrimShape?) { /** * Sends the bounds of the QuickSettings panel to the consumer set by [setQsPanelShapeConsumer]. * * Used to clip Notification content when the QuickSettings Overlay panel covers it. Sending * `null` resets the negative shape clipping of the Notification Stack. */ fun sendQsPanelShape(shape: ShadeScrimShape?) { checkValidBounds(shape?.bounds) placeholderRepository.qsPanelShape.value = shape placeholderRepository.qsPanelShapeConsumer?.invoke(shape) } /** * Sets a consumer to be notified when the QuickSettings Overlay panel changes size or position. */ fun setQsPanelShapeConsumer(consumer: ((ShadeScrimShape?) -> Unit)?) { placeholderRepository.qsPanelShapeConsumer = consumer } /** Updates the current scroll state of the notification shade. */ Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -39,9 +39,9 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationScrollViewModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -149,8 +149,9 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { @Test fun onPanelShapeChanged() = testScope.runTest { val actual by collectLastValue(kosmos.notificationStackAppearanceInteractor.qsPanelShape) var actual: ShadeScrimShape? = null kosmos.notificationScrollViewModel.setQsScrimShapeConsumer { shape -> actual = shape } val expected = ShadeScrimShape( bounds = ShadeScrimBounds(left = 10f, top = 0f, right = 710f, bottom = 600f), Loading @@ -160,7 +161,7 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { underTest.onPanelShapeChanged(expected) assertThat(expected).isEqualTo(actual) assertThat(actual).isEqualTo(expected) } private fun TestScope.lockDevice() { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt +3 −5 Original line number Diff line number Diff line Loading @@ -54,10 +54,10 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { assertThat(stackBounds).isEqualTo(bounds2) } @Test fun setQsPanelShape() = testScope.runTest { val actual by collectLastValue(underTest.qsPanelShape) var actual: ShadeScrimShape? = null underTest.setQsPanelShapeConsumer { shape -> actual = shape } val expected1 = ShadeScrimShape( Loading @@ -65,11 +65,9 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { topRadius = 0, bottomRadius = 10, ) underTest.setQsPanelShape(expected1) assertThat(actual).isEqualTo(expected1) val expected2 = expected1.copy(topRadius = 10) underTest.setQsPanelShape(expected2) assertThat(expected2).isEqualTo(actual) } Loading Loading @@ -97,7 +95,7 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() { fun setQsPanelShape_withImproperBounds_throwsException() = testScope.runTest { val invalidBounds = ShadeScrimBounds(top = 0f, bottom = -10f) underTest.setQsPanelShape( underTest.sendQsPanelShape( ShadeScrimShape(bounds = invalidBounds, topRadius = 10, bottomRadius = 10) ) } Loading
packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ constructor( /** Notifies that the bounds of the QuickSettings panel have changed. */ fun onPanelShapeChanged(shape: ShadeScrimShape?) { notificationStackAppearanceInteractor.setQsPanelShape(shape) notificationStackAppearanceInteractor.sendQsPanelShape(shape) } fun onScrimClicked() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt +6 −8 Original line number Diff line number Diff line Loading @@ -45,14 +45,6 @@ class NotificationPlaceholderRepository @Inject constructor() { */ val notificationShadeScrimBounds = MutableStateFlow<ShadeScrimBounds?>(null) /** * The shape of the QuickSettings overlay panel. Used to clip Notification content when the QS * covers it. * * When `null`, it doesn't affect notification clipping. */ val qsPanelShape = MutableStateFlow<ShadeScrimShape?>(null) /** height made available to the notifications in the size-constrained mode of lock screen. */ val constrainedAvailableSpace = MutableStateFlow(0) Loading @@ -61,4 +53,10 @@ class NotificationPlaceholderRepository @Inject constructor() { /** A consumer of [AccessibilityScrollEvent]s. */ var accessibilityScrollEventConsumer: Consumer<AccessibilityScrollEvent>? = null /** * A consumer of [ShadeScrimShape], to be updated when the bounds of the QuickSettings Overlay * panel changes. */ var qsPanelShapeConsumer: ((ShadeScrimShape?) -> Unit)? = null }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt +15 −6 Original line number Diff line number Diff line Loading @@ -51,9 +51,6 @@ constructor( val notificationShadeScrimBounds: StateFlow<ShadeScrimBounds?> = placeholderRepository.notificationShadeScrimBounds.asStateFlow() /** The shape of the QuickSettingsShadeOverlay panel */ val qsPanelShape: StateFlow<ShadeScrimShape?> = placeholderRepository.qsPanelShape.asStateFlow() /** * Whether the stack is expanding from GONE-with-HUN to SHADE * Loading Loading @@ -128,10 +125,22 @@ constructor( placeholderRepository.notificationShadeScrimBounds.value = bounds } /** Sets the bounds of the QuickSettings overlay panel */ fun setQsPanelShape(shape: ShadeScrimShape?) { /** * Sends the bounds of the QuickSettings panel to the consumer set by [setQsPanelShapeConsumer]. * * Used to clip Notification content when the QuickSettings Overlay panel covers it. Sending * `null` resets the negative shape clipping of the Notification Stack. */ fun sendQsPanelShape(shape: ShadeScrimShape?) { checkValidBounds(shape?.bounds) placeholderRepository.qsPanelShape.value = shape placeholderRepository.qsPanelShapeConsumer?.invoke(shape) } /** * Sets a consumer to be notified when the QuickSettings Overlay panel changes size or position. */ fun setQsPanelShapeConsumer(consumer: ((ShadeScrimShape?) -> Unit)?) { placeholderRepository.qsPanelShapeConsumer = consumer } /** Updates the current scroll state of the notification shade. */ Loading