diff options
| author | 2025-03-06 23:53:11 -0800 | |
|---|---|---|
| committer | 2025-03-06 23:53:11 -0800 | |
| commit | 99beaf7c86731e5490036f59c33f1d1f03a8c07c (patch) | |
| tree | d4787fda5790223ec7e7d56998a4d27547ff4d30 | |
| parent | 6a06838efb54fe75d2795504568e9ff1f74b6f1d (diff) | |
| parent | 8be2b68b8326ebd2edc0edcc0d4abcb4f055c580 (diff) | |
Merge "[Flexiglass] Wire in NSSL#setFractionToShade" into main
5 files changed, 48 insertions, 2 deletions
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 c2c271bd6e81..e6bb1b9f0273 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 @@ -64,7 +64,6 @@ import android.util.AttributeSet; import android.util.IndentingPrintWriter; import android.util.Log; import android.util.MathUtils; -import android.util.Pair; import android.view.DisplayCutout; import android.view.InputDevice; import android.view.LayoutInflater; @@ -141,7 +140,6 @@ import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScr import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.SplitShadeStateController; -import com.android.systemui.statusbar.ui.SystemBarUtilsProxy; import com.android.systemui.util.Assert; import com.android.systemui.util.ColorUtilKt; import com.android.systemui.util.DumpUtilsKt; @@ -6004,6 +6002,7 @@ public class NotificationStackScrollLayout * LockscreenShadeTransitionController resets fraction to 0 * where it remains until the next lockscreen-to-shade transition. */ + @Override public void setFractionToShade(float fraction) { mAmbientState.setFractionToShade(fraction); updateContentHeight(); // Recompute stack height with different section gap. 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 bb3abc1fba38..f7f8acf5fda9 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 @@ -1735,6 +1735,7 @@ public class NotificationStackScrollLayoutController implements Dumpable { * they remain until the next lockscreen-to-shade transition. */ public void setTransitionToFullShadeAmount(float fraction) { + SceneContainerFlag.assertInLegacyMode(); mView.setFractionToShade(fraction); } 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 9c855e9cd9b7..ac89f3a63fcd 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 @@ -107,6 +107,9 @@ interface NotificationScrollView { /** sets the current expand fraction */ fun setExpandFraction(expandFraction: Float) + /** Sets the fraction of the LockScreen -> Shade transition. */ + fun setFractionToShade(fraction: Float) + /** sets the current QS expand fraction */ fun setQsExpandFraction(expandFraction: Float) 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 653344ae9203..40739b386d20 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 @@ -95,6 +95,11 @@ constructor( view.setExpandFraction(it.coerceIn(0f, 1f)) } } + launch { + viewModel.lockScreenToShadeTransitionProgress.collectTraced { + view.setFractionToShade(it.coerceIn(0f, 1f)) + } + } launch { viewModel.qsExpandFraction.collectTraced { view.setQsExpandFraction(it) } } launch { viewModel.blurRadius(maxBlurRadius).collect(view::setBlurRadius) } launch { 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 c1aa5f12aa99..940b2e541758 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 @@ -207,6 +207,44 @@ constructor( val qsExpandFraction: Flow<Float> = shadeInteractor.qsExpansion.dumpWhileCollecting("qsExpandFraction") + /** + * Fraction of the LockScreen -> Shade transition. 0..1 while the transition in progress, and + * snaps back to 0 when it is Idle. + */ + val lockScreenToShadeTransitionProgress: Flow<Float> = + combine( + shadeInteractor.shadeExpansion, + shadeModeInteractor.shadeMode, + sceneInteractor.transitionState, + ) { shadeExpansion, _, transitionState -> + when (transitionState) { + is Idle -> 0f + is ChangeScene -> + if ( + transitionState.isTransitioning( + from = Scenes.Lockscreen, + to = Scenes.Shade, + ) + ) { + shadeExpansion + } else { + 0f + } + + is Transition.OverlayTransition -> + if ( + transitionState.currentScene == Scenes.Lockscreen && + transitionState.isTransitioning(to = Overlays.NotificationsShade) + ) { + shadeExpansion + } else { + 0f + } + } + } + .distinctUntilChanged() + .dumpWhileCollecting("lockScreenToShadeTransitionProgress") + val isOccluded: Flow<Boolean> = bouncerInteractor.bouncerExpansion .map { it == 1f } |