Merge "[flexiglass] Disable NSSL height updates for some Lockscreen transitions" into main
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
index d246b04..129d4ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
@@ -224,6 +224,7 @@
* @param isSwipingUp Whether we are swiping up.
*/
public void setSwipingUp(boolean isSwipingUp) {
+ SceneContainerFlag.assertInLegacyMode();
if (!isSwipingUp && mIsSwipingUp) {
// Just stopped swiping up.
mIsFlingRequiredAfterLockScreenSwipeUp = true;
@@ -242,6 +243,7 @@
* @param isFlinging Whether we are flinging the shade open or closed.
*/
public void setFlinging(boolean isFlinging) {
+ SceneContainerFlag.assertInLegacyMode();
if (isOnKeyguard() && !isFlinging && mIsFlinging) {
// Just stopped flinging.
mIsFlingRequiredAfterLockScreenSwipeUp = false;
@@ -717,6 +719,7 @@
* @return Whether we need to do a fling down after swiping up on lockscreen.
*/
public boolean isFlingingAfterSwipeUpOnLockscreen() {
+ SceneContainerFlag.assertInLegacyMode();
return mIsFlinging && mIsFlingRequiredAfterLockScreenSwipeUp;
}
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 0a44a2b..b466bf0 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
@@ -568,6 +568,7 @@
private boolean mHasFilteredOutSeenNotifications;
@Nullable private SplitShadeStateController mSplitShadeStateController = null;
private boolean mIsSmallLandscapeLockscreenEnabled = false;
+ private boolean mSuppressHeightUpdates;
/** Pass splitShadeStateController to view and update split shade */
public void passSplitShadeStateController(SplitShadeStateController splitShadeStateController) {
@@ -1458,9 +1459,13 @@
* 2) Swiping up on lockscreen or flinging down after swipe up
*/
private boolean shouldSkipHeightUpdate() {
- return mAmbientState.isOnKeyguard()
- && (mAmbientState.isSwipingUp()
- || mAmbientState.isFlingingAfterSwipeUpOnLockscreen());
+ if (SceneContainerFlag.isEnabled()) {
+ return mSuppressHeightUpdates;
+ } else {
+ return mAmbientState.isOnKeyguard()
+ && (mAmbientState.isSwipingUp()
+ || mAmbientState.isFlingingAfterSwipeUpOnLockscreen());
+ }
}
/**
@@ -5399,6 +5404,7 @@
}
public void setPanelFlinging(boolean flinging) {
+ SceneContainerFlag.assertInLegacyMode();
mAmbientState.setFlinging(flinging);
if (!flinging) {
// re-calculate the stack height which was frozen while flinging
@@ -5406,6 +5412,12 @@
}
}
+ @Override
+ public void suppressHeightUpdates(boolean suppress) {
+ if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
+ mSuppressHeightUpdates = suppress;
+ }
+
public void setHeadsUpGoingAwayAnimationsAllowed(boolean headsUpGoingAwayAnimationsAllowed) {
mHeadsUpGoingAwayAnimationsAllowed = headsUpGoingAwayAnimationsAllowed;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 9c5fecf..7b02d0c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -1439,6 +1439,7 @@
}
public void setPanelFlinging(boolean flinging) {
+ SceneContainerFlag.assertInLegacyMode();
mView.setPanelFlinging(flinging);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationScrollView.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationScrollView.kt
index 0113e36..dbe81c1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationScrollView.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationScrollView.kt
@@ -124,4 +124,7 @@
/** @see addHeadsUpHeightChangedListener */
fun removeHeadsUpHeightChangedListener(runnable: Runnable)
+
+ /** Sets whether updates to the stack are are suppressed. */
+ fun suppressHeightUpdates(suppress: Boolean)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationScrollViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationScrollViewBinder.kt
index 99ff678..87d70ba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationScrollViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationScrollViewBinder.kt
@@ -111,6 +111,7 @@
launch {
viewModel.shouldCloseGuts.filter { it }.collect { view.closeGutsOnSceneTouch() }
}
+ launch { viewModel.suppressHeightUpdates.collect { view.suppressHeightUpdates(it) } }
launchAndDispose {
view.setSyntheticScrollConsumer(viewModel.syntheticScrollConsumer)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
index cd9c07e..c9eaec7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
@@ -18,6 +18,7 @@
package com.android.systemui.statusbar.notification.stack.ui.viewmodel
import com.android.compose.animation.scene.ContentKey
+import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.ObservableTransitionState.Idle
import com.android.compose.animation.scene.ObservableTransitionState.Transition
import com.android.compose.animation.scene.ObservableTransitionState.Transition.ChangeScene
@@ -48,6 +49,7 @@
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
+import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapNotNull
/** ViewModel which represents the state of the NSSL/Controller in the world of flexiglass */
@@ -129,6 +131,14 @@
}
}
+ /** Are notification stack height updates suppressed? */
+ val suppressHeightUpdates: Flow<Boolean> =
+ sceneInteractor.transitionState.map { transition: ObservableTransitionState ->
+ transition is Transition &&
+ transition.fromContent == Scenes.Lockscreen &&
+ (transition.toContent == Scenes.Bouncer || transition.toContent == Scenes.Gone)
+ }
+
/**
* The expansion fraction of the notification stack. It should go from 0 to 1 when transitioning
* from Gone to Shade scenes, and remain at 1 when in Lockscreen or Shade scenes and while