summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff DeCew <jeffdq@google.com> 2024-03-24 19:40:00 +0000
committer Jeff DeCew <jeffdq@google.com> 2024-04-04 01:59:25 +0000
commit8aef5589a0125423c3cf648b7771579fa21c8ef6 (patch)
treed7910f5cc2085a3d26a61310f969c60cc8edd132
parentfdf1804b42698e8ca3dcffb75bcd8461f85b1d6d (diff)
[flexiglass] Notification composables now set the particular placeholder values from the right place.
* Only the ConstrainedNotificationStack sets the constrained height used for keyguard calculation * The stack placeholder element sets the stack top and bottom * The scrim bounds are now actually set by the scrim element Bug: 296118689 Test: atest SystemUITests Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT Change-Id: Ic5ab3f387a6c15088dcc631e06f0909d422d5c98
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt4
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt46
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt9
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelTest.kt22
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt14
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt2
14 files changed, 124 insertions, 67 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
index fa0a1c4663b1..a31b53383014 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
@@ -33,7 +33,7 @@ import com.android.systemui.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel
-import com.android.systemui.notifications.ui.composable.NotificationStack
+import com.android.systemui.notifications.ui.composable.ConstrainedNotificationStack
import com.android.systemui.res.R
import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
@@ -94,7 +94,7 @@ constructor(
return
}
- NotificationStack(
+ ConstrainedNotificationStack(
viewModel = viewModel,
modifier =
modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) {
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt
index cc8ffe2c35ef..3efe92af526d 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt
@@ -118,15 +118,20 @@ fun SceneScope.HeadsUpNotificationSpace(
/** Adds the space where notification stack should appear in the scene. */
@Composable
-fun SceneScope.NotificationStack(
+fun SceneScope.ConstrainedNotificationStack(
viewModel: NotificationsPlaceholderViewModel,
modifier: Modifier = Modifier,
) {
- NotificationPlaceholder(
- viewModel = viewModel,
- form = Form.Stack,
- modifier = modifier,
- )
+ Box(
+ modifier =
+ modifier.onSizeChanged { viewModel.onConstrainedAvailableSpaceChanged(it.height) }
+ ) {
+ NotificationPlaceholder(
+ viewModel = viewModel,
+ form = Form.Stack,
+ modifier = Modifier.fillMaxSize(),
+ )
+ }
}
/**
@@ -235,6 +240,20 @@ fun SceneScope.NotificationScrollingStack(
.let { scrimRounding.value.toRoundedCornerShape(it) }
clip = true
}
+ .onGloballyPositioned { coordinates ->
+ val boundsInWindow = coordinates.boundsInWindow()
+ debugLog(viewModel) {
+ "SCRIM onGloballyPositioned:" +
+ " size=${coordinates.size}" +
+ " bounds=$boundsInWindow"
+ }
+ viewModel.onScrimBoundsChanged(
+ left = boundsInWindow.left,
+ top = boundsInWindow.top,
+ right = boundsInWindow.right,
+ bottom = boundsInWindow.bottom,
+ )
+ }
) {
// Creates a cutout in the background scrim in the shape of the notifications scrim.
// Only visible when notif scrim alpha < 1, during shade expansion.
@@ -311,7 +330,6 @@ fun SceneScope.NotificationShelfSpace(
debugLog(viewModel) {
("SHELF onPlaced:" +
" size=${coordinates.size}" +
- " position=${coordinates.positionInWindow()}" +
" bounds=${coordinates.boundsInWindow()}")
}
}
@@ -339,19 +357,17 @@ private fun SceneScope.NotificationPlaceholder(
debugLog(viewModel) { "STACK onSizeChanged: size=$size" }
}
.onGloballyPositioned { coordinates: LayoutCoordinates ->
- viewModel.onContentTopChanged(coordinates.positionInWindow().y)
+ val positionInWindow = coordinates.positionInWindow()
debugLog(viewModel) {
"STACK onGloballyPositioned:" +
" size=${coordinates.size}" +
- " position=${coordinates.positionInWindow()}" +
+ " position=$positionInWindow" +
" bounds=${coordinates.boundsInWindow()}"
}
- val boundsInWindow = coordinates.boundsInWindow()
- viewModel.onBoundsChanged(
- left = boundsInWindow.left,
- top = boundsInWindow.top,
- right = boundsInWindow.right,
- bottom = boundsInWindow.bottom,
+ // NOTE: positionInWindow.y scrolls off screen, but boundsInWindow.top will not
+ viewModel.onStackBoundsChanged(
+ top = positionInWindow.y,
+ bottom = positionInWindow.y + coordinates.size.height,
)
}
) {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
index c90b2319aae0..96be0c58803e 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
@@ -70,7 +70,12 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
val viewPosition = MutableStateFlow(ViewPosition(0, 0))
val shape by collectLastValue(appearanceViewModel.shadeScrimShape(radius, viewPosition))
- placeholderViewModel.onBoundsChanged(left = 0f, top = 200f, right = 100f, bottom = 550f)
+ placeholderViewModel.onScrimBoundsChanged(
+ left = 0f,
+ top = 200f,
+ right = 100f,
+ bottom = 550f
+ )
assertThat(shape)
.isEqualTo(
ShadeScrimShape(
@@ -83,7 +88,7 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
viewPosition.value = ViewPosition(200, 15)
radius.value = 24
- placeholderViewModel.onBoundsChanged(
+ placeholderViewModel.onScrimBoundsChanged(
left = 210f,
top = 200f,
right = 300f,
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 d4a704919a49..57bcdb7f6eb3 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
@@ -40,23 +40,21 @@ class NotificationsPlaceholderViewModelTest : SysuiTestCase() {
private val underTest = kosmos.notificationsPlaceholderViewModel
@Test
- @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
- fun onBoundsChanged_setsNotificationContainerBounds() =
+ fun onBoundsChanged() =
kosmos.testScope.runTest {
- underTest.onBoundsChanged(left = 5f, top = 5f, right = 5f, bottom = 5f)
- val containerBounds by
- collectLastValue(kosmos.keyguardInteractor.notificationContainerBounds)
+ underTest.onScrimBoundsChanged(left = 5f, top = 15f, right = 25f, bottom = 35f)
val stackBounds by
collectLastValue(kosmos.notificationStackAppearanceInteractor.shadeScrimBounds)
- assertThat(containerBounds)
- .isEqualTo(NotificationContainerBounds(top = 5f, bottom = 5f))
assertThat(stackBounds)
- .isEqualTo(ShadeScrimBounds(left = 5f, top = 5f, right = 5f, bottom = 5f))
+ .isEqualTo(ShadeScrimBounds(left = 5f, top = 15f, right = 25f, bottom = 35f))
}
@Test
- fun onContentTopChanged_setsContentTop() {
- underTest.onContentTopChanged(padding = 5f)
- assertThat(kosmos.notificationStackAppearanceInteractor.stackTop.value).isEqualTo(5f)
- }
+ fun onStackBoundsChanged() =
+ kosmos.testScope.runTest {
+ underTest.onStackBoundsChanged(top = 5f, bottom = 500f)
+ assertThat(kosmos.notificationStackAppearanceInteractor.stackTop.value).isEqualTo(5f)
+ assertThat(kosmos.notificationStackAppearanceInteractor.stackBottom.value)
+ .isEqualTo(500f)
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
index 68ea5d047e1b..141cca329419 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
@@ -21,6 +21,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.log.core.LogLevel.VERBOSE
import com.android.systemui.power.domain.interactor.PowerInteractor
+import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
import javax.inject.Inject
@@ -69,9 +70,11 @@ constructor(
}
}
- scope.launch {
- sharedNotificationContainerViewModel.bounds.collect {
- logger.log(TAG, VERBOSE, "Notif: bounds", it)
+ if (!SceneContainerFlag.isEnabled) {
+ scope.launch {
+ sharedNotificationContainerViewModel.bounds.collect {
+ logger.log(TAG, VERBOSE, "Notif: bounds", it)
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java b/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java
index c42fdf8e7b93..b24edd9beece 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java
@@ -25,6 +25,7 @@ import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import com.android.keyguard.LockIconViewController;
+import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import java.util.HashSet;
@@ -80,12 +81,14 @@ public class DebugDrawable extends Drawable {
mNotificationPanelViewController.getClockPositionResult()
.stackScrollerPadding),
Color.YELLOW, "calculatePanelHeightShade()");
- drawDebugInfo(canvas,
- (int) mQsController.calculateNotificationsTopPadding(
- mNotificationPanelViewController.isExpandingOrCollapsing(),
- mNotificationPanelViewController.getKeyguardNotificationStaticPadding(),
- mNotificationPanelViewController.getExpandedFraction()),
- Color.MAGENTA, "calculateNotificationsTopPadding()");
+ if (!SceneContainerFlag.isEnabled()) {
+ drawDebugInfo(canvas,
+ (int) mQsController.calculateNotificationsTopPadding(
+ mNotificationPanelViewController.isExpandingOrCollapsing(),
+ mNotificationPanelViewController.getKeyguardNotificationStaticPadding(),
+ mNotificationPanelViewController.getExpandedFraction()),
+ Color.MAGENTA, "calculateNotificationsTopPadding()");
+ }
drawDebugInfo(canvas, mNotificationPanelViewController.getClockPositionResult().clockY,
Color.GRAY, "mClockPositionResult.clockY");
drawDebugInfo(canvas, (int) mLockIconViewController.getTop(), Color.GRAY,
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index c9a4433fc5e5..e687c0c441e5 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -2485,6 +2485,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
/** Returns the topPadding of notifications when on keyguard not respecting QS expansion. */
int getKeyguardNotificationStaticPadding() {
+ SceneContainerFlag.assertInLegacyMode();
if (!isKeyguardShowing()) {
return 0;
}
@@ -2526,12 +2527,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
}
void requestScrollerTopPaddingUpdate(boolean animate) {
- float padding = mQsController.calculateNotificationsTopPadding(mIsExpandingOrCollapsing,
- getKeyguardNotificationStaticPadding(), mExpandedFraction);
- if (MigrateClocksToBlueprint.isEnabled()) {
- mSharedNotificationContainerInteractor.setTopPosition(padding);
- } else {
- mNotificationStackScrollLayoutController.updateTopPadding(padding, animate);
+ if (!SceneContainerFlag.isEnabled()) {
+ float padding = mQsController.calculateNotificationsTopPadding(mIsExpandingOrCollapsing,
+ getKeyguardNotificationStaticPadding(), mExpandedFraction);
+ if (MigrateClocksToBlueprint.isEnabled()) {
+ mSharedNotificationContainerInteractor.setTopPosition(padding);
+ } else {
+ mNotificationStackScrollLayoutController.updateTopPadding(padding, animate);
+ }
}
if (isKeyguardShowing()
diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java
index 35b40592a47e..2507507ce22e 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java
@@ -1371,6 +1371,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
@Override
public float calculateNotificationsTopPadding(boolean isShadeExpanding,
int keyguardNotificationStaticPadding, float expandedFraction) {
+ SceneContainerFlag.assertInLegacyMode();
float topPadding;
boolean keyguardShowing = mBarState == KEYGUARD;
if (mSplitShadeEnabled) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index a9a968fcdc07..1a6821cd8893 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -858,7 +858,8 @@ public class NotificationStackScrollLayout
drawDebugInfo(canvas, y, Color.MAGENTA,
/* label= */ "mContentHeight = " + y);
- drawDebugInfo(canvas, mRoundedRectClippingBottom, Color.DKGRAY,
+ y = mRoundedRectClippingBottom;
+ drawDebugInfo(canvas, y, Color.DKGRAY,
/* label= */ "mRoundedRectClippingBottom) = " + y);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt
index 462547ea2385..c2ea9bb104b7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/data/repository/NotificationPlaceholderRepository.kt
@@ -44,7 +44,7 @@ class NotificationPlaceholderRepository @Inject constructor() {
val headsUpTop = MutableStateFlow(0f)
/** height made available to the notifications in the size-constrained mode of lock screen. */
- val constrainedAvailableSpace = MutableStateFlow(0f)
+ val constrainedAvailableSpace = MutableStateFlow(0)
/**
* Whether the notification stack is scrolled to the top; i.e., it cannot be scrolled down any
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt
index 5753d612c9ec..4c23f191ddaf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt
@@ -78,6 +78,10 @@ constructor(
/** The y-coordinate in px of bottom of the contents of the notification stack. */
val stackBottom: StateFlow<Float> = placeholderRepository.stackBottom.asStateFlow()
+ /** The height of the keyguard's available space bounds */
+ val constrainedAvailableSpace: StateFlow<Int> =
+ placeholderRepository.constrainedAvailableSpace.asStateFlow()
+
/**
* Whether the notification stack is scrolled to the top; i.e., it cannot be scrolled down any
* further.
@@ -115,6 +119,11 @@ constructor(
placeholderRepository.stackTop.value = startY
}
+ /** Sets the y-coord in px of the bottom of the contents of the notification stack. */
+ fun setStackBottom(endY: Float) {
+ placeholderRepository.stackBottom.value = endY
+ }
+
/** Sets whether the notification stack is scrolled to the top. */
fun setScrolledToTop(scrolledToTop: Boolean) {
placeholderRepository.scrolledToTop.value = scrolledToTop
@@ -124,4 +133,8 @@ constructor(
fun setSyntheticScroll(delta: Float) {
viewHeightRepository.syntheticScroll.value = delta
}
+
+ fun setConstrainedAvailableSpace(height: Int) {
+ placeholderRepository.constrainedAvailableSpace.value = height
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
index 477f139bcd7d..40d11b509b40 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
@@ -49,28 +49,35 @@ constructor(
/** DEBUG: whether the debug logging should be output. */
val isDebugLoggingEnabled: Boolean = flags.isEnabled()
- /**
- * Notifies that the bounds of the notification placeholder have changed.
- *
- * @param top The position of the top of the container in its window coordinate system, in
- * pixels.
- * @param bottom The position of the bottom of the container in its window coordinate system, in
- * pixels.
- */
- fun onBoundsChanged(
+ /** Notifies that the bounds of the notification scrim have changed. */
+ fun onScrimBoundsChanged(
left: Float,
top: Float,
right: Float,
bottom: Float,
) {
- keyguardInteractor.setNotificationContainerBounds(
- NotificationContainerBounds(top = top, bottom = bottom)
- )
interactor.setShadeScrimBounds(
ShadeScrimBounds(top = top, bottom = bottom, left = left, right = right)
)
}
+ /** Notifies that the bounds of the notification placeholder have changed. */
+ fun onStackBoundsChanged(
+ top: Float,
+ bottom: Float,
+ ) {
+ keyguardInteractor.setNotificationContainerBounds(
+ NotificationContainerBounds(top = top, bottom = bottom)
+ )
+ interactor.setStackTop(top)
+ interactor.setStackBottom(bottom)
+ }
+
+ /** Sets the available space */
+ fun onConstrainedAvailableSpaceChanged(height: Int) {
+ interactor.setConstrainedAvailableSpace(height)
+ }
+
/** Corner rounding of the stack */
val shadeScrimRounding: Flow<ShadeScrimRounding> = interactor.shadeScrimRounding
@@ -94,11 +101,6 @@ constructor(
*/
val syntheticScroll: Flow<Float> = interactor.syntheticScroll
- /** Sets the y-coord in px of the top of the contents of the notification stack. */
- fun onContentTopChanged(padding: Float) {
- interactor.setStackTop(padding)
- }
-
/** Sets whether the notification stack is scrolled to the top. */
fun setScrolledToTop(scrolledToTop: Boolean) {
interactor.setScrolledToTop(scrolledToTop)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
index 9f576066cc98..692368de5aea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
@@ -60,7 +60,9 @@ import com.android.systemui.keyguard.ui.viewmodel.OccludedToLockscreenTransition
import com.android.systemui.keyguard.ui.viewmodel.PrimaryBouncerToGoneTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.PrimaryBouncerToLockscreenTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.ViewStateAccessor
+import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.domain.interactor.ShadeInteractor
+import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
import com.android.systemui.util.kotlin.BooleanFlowOperators.and
import com.android.systemui.util.kotlin.BooleanFlowOperators.or
@@ -97,6 +99,7 @@ constructor(
private val keyguardInteractor: KeyguardInteractor,
private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
private val shadeInteractor: ShadeInteractor,
+ private val notificationStackAppearanceInteractor: NotificationStackAppearanceInteractor,
private val alternateBouncerToGoneTransitionViewModel:
AlternateBouncerToGoneTransitionViewModel,
private val aodToLockscreenTransitionViewModel: AodToLockscreenTransitionViewModel,
@@ -364,6 +367,10 @@ constructor(
initialValue = NotificationContainerBounds(),
)
.dumpValue("bounds")
+ get() {
+ /* check if */ SceneContainerFlag.isUnexpectedlyInLegacyMode()
+ return field
+ }
/**
* Ensure view is visible when the shade/qs are expanded. Also, as QS is expanding, fade out
@@ -571,8 +578,11 @@ constructor(
.dumpWhileCollecting("translationX")
private val availableHeight: Flow<Float> =
- bounds
- .map { it.bottom - it.top }
+ if (SceneContainerFlag.isEnabled) {
+ notificationStackAppearanceInteractor.constrainedAvailableSpace.map { it.toFloat() }
+ } else {
+ bounds.map { it.bottom - it.top }
+ }
.distinctUntilChanged()
.dumpWhileCollecting("availableHeight")
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt
index de0cc6590593..d2de835ad954 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt
@@ -43,6 +43,7 @@ import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.shade.domain.interactor.shadeInteractor
+import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -55,6 +56,7 @@ val Kosmos.sharedNotificationContainerViewModel by Fixture {
keyguardInteractor = keyguardInteractor,
keyguardTransitionInteractor = keyguardTransitionInteractor,
shadeInteractor = shadeInteractor,
+ notificationStackAppearanceInteractor = notificationStackAppearanceInteractor,
alternateBouncerToGoneTransitionViewModel = alternateBouncerToGoneTransitionViewModel,
aodToLockscreenTransitionViewModel = aodToLockscreenTransitionViewModel,
aodToOccludedTransitionViewModel = aodToOccludedTransitionViewModel,