diff options
| author | 2025-01-30 18:39:37 -0600 | |
|---|---|---|
| committer | 2025-01-30 18:55:43 -0600 | |
| commit | 594bef17a15e4a8e622e7c45e5125ab04554cf94 (patch) | |
| tree | b8ac67a7efb22b7f5dcbf0d39c0d41a7ddfee6e0 | |
| parent | c67522ec58aa02a3dcf138c02f51a8f161db043f (diff) | |
Fix media carousel view size for scene container
In some cases an incorrect size could get cached in
MediaHostStatesManager and used in later layouts, even after we have a
scene container size - this adds a check to use the scene container size when
getting the view state
Flag: com.android.systemui.scene_container
Fixes: 371602434
Fixes: 390688474
Test: manual - view carousel with multiple players while rotating
Change-Id: Icd3fa1cf65e74a159170769ad8ec912502214a1d
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt index 975f8f45f9c4..0ef98636c050 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt @@ -899,7 +899,11 @@ constructor( // If the view isn't bound, we can drop the animation, otherwise we'll execute it animateNextStateChange = false if (transitionLayout == null) { - logger.logMediaLocation("setCurrentState: view not bound", startLocation, endLocation) + logger.logMediaLocation( + "setCurrentState: view not bound", + startLocation, + endLocation, + ) return } @@ -973,13 +977,20 @@ constructor( val overrideSize = mediaHostStatesManager.carouselSizes[location] var overridden = false overrideSize?.let { - // To be safe we're using a maximum here. The override size should always be set - // properly though. - if ( + if (SceneContainerFlag.isEnabled) { + result.measureWidth = widthInSceneContainerPx + result.measureHeight = heightInSceneContainerPx + overridden = true + } else if ( result.measureHeight != it.measuredHeight || result.measureWidth != it.measuredWidth ) { + // To be safe we're using a maximum here. The override size should always be set + // properly though. result.measureHeight = Math.max(it.measuredHeight, result.measureHeight) result.measureWidth = Math.max(it.measuredWidth, result.measureWidth) + overridden = true + } + if (overridden) { // The measureHeight and the shown height should both be set to the overridden // height result.height = result.measureHeight @@ -991,7 +1002,6 @@ constructor( state.width = result.width } } - overridden = true } } if (overridden && state != null && state.squishFraction <= 1f) { |