[flexiglass] Disable NSSL height updates for some Lockscreen transitions
Flag: com.android.systemui.scene_container
Fixes: 357651639
Test: verify stack doesn't update when transitioning to
bouncer/gone from lockscreen
Change-Id: If75ae09e314ab70aab24ffbbbe3e204cd75768cd
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 1431b28..5581966 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
@@ -222,6 +222,7 @@
* @param isSwipingUp Whether we are swiping up.
*/
public void setSwipingUp(boolean isSwipingUp) {
+ SceneContainerFlag.assertInLegacyMode();
if (!isSwipingUp && mIsSwipingUp) {
// Just stopped swiping up.
mIsFlingRequiredAfterLockScreenSwipeUp = true;
@@ -240,6 +241,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;
@@ -695,6 +697,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 cd3516d..4b8fc62 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
@@ -567,6 +567,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) {
@@ -1453,9 +1454,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());
+ }
}
/**
@@ -5374,6 +5379,7 @@
}
public void setPanelFlinging(boolean flinging) {
+ SceneContainerFlag.assertInLegacyMode();
mAmbientState.setFlinging(flinging);
if (!flinging) {
// re-calculate the stack height which was frozen while flinging
@@ -5381,6 +5387,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 dad6894..d38945f 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 41c0293..fd1b1fc 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
@@ -118,4 +118,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 2e37dea..67aa600 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
@@ -103,6 +103,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 5b2e02d..92d2a62 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 */
@@ -121,6 +123,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