diff options
3 files changed, 16 insertions, 10 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarousel.kt b/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarousel.kt index 3d8ca1e96a09..b5d78398028d 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarousel.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarousel.kt @@ -34,7 +34,6 @@ import androidx.compose.ui.viewinterop.AndroidView import com.android.compose.animation.scene.MovableElementKey import com.android.compose.animation.scene.SceneScope import com.android.compose.windowsizeclass.LocalWindowSizeClass -import com.android.internal.R.attr.layout import com.android.systemui.media.controls.ui.composable.MediaCarouselStateLoader.stateForMediaCarouselContent import com.android.systemui.media.controls.ui.controller.MediaCarouselController import com.android.systemui.media.controls.ui.view.MediaHost @@ -60,12 +59,12 @@ fun SceneScope.MediaCarousel( carouselController: MediaCarouselController, offsetProvider: (() -> IntOffset)? = null, usingCollapsedLandscapeMedia: Boolean = false, + isInSplitShade: Boolean = false, ) { if (!isVisible || carouselController.isLockedAndHidden()) { return } - - val carouselState = remember { { stateForMediaCarouselContent() } } + val carouselState = remember { { stateForMediaCarouselContent(isInSplitShade) } } val isCollapsed = usingCollapsedLandscapeMedia && isLandscape() val mediaHeight = if (isCollapsed && mediaHost.expansion == MediaHostState.COLLAPSED) { diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarouselStateLoader.kt b/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarouselStateLoader.kt index 4a0136c40c14..bad74052b669 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarouselStateLoader.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarouselStateLoader.kt @@ -43,10 +43,13 @@ object MediaCarouselStateLoader { /** Returns the corresponding media location for the given [scene] */ @MediaLocation - private fun getMediaLocation(scene: SceneKey): Int { + private fun getMediaLocation(scene: SceneKey, isSplitShade: Boolean): Int { return when (scene) { Scenes.QuickSettings -> MediaHierarchyManager.LOCATION_QS - Scenes.Shade -> MediaHierarchyManager.LOCATION_QQS + Scenes.Shade -> { + if (isSplitShade) MediaHierarchyManager.LOCATION_QS + else MediaHierarchyManager.LOCATION_QQS + } Scenes.Lockscreen -> MediaHierarchyManager.LOCATION_LOCKSCREEN Scenes.Communal -> MediaHierarchyManager.LOCATION_COMMUNAL_HUB else -> MediaHierarchyManager.LOCATION_UNKNOWN @@ -97,11 +100,11 @@ object MediaCarouselStateLoader { } /** Returns the state of media carousel */ - fun SceneScope.stateForMediaCarouselContent(): State { + fun SceneScope.stateForMediaCarouselContent(isInSplitShade: Boolean): State { return when (val transitionState = layoutState.transitionState) { is TransitionState.Idle -> { if (MediaContentPicker.contents.contains(transitionState.currentScene)) { - State.Idle(getMediaLocation(transitionState.currentScene)) + State.Idle(getMediaLocation(transitionState.currentScene, isInSplitShade)) } else { State.Gone } @@ -114,14 +117,14 @@ object MediaCarouselStateLoader { ) { State.InProgress( min(progress, 1.0F), - getMediaLocation(fromScene), - getMediaLocation(toScene), + getMediaLocation(fromScene, isInSplitShade), + getMediaLocation(toScene, isInSplitShade), ) } else if (MediaContentPicker.contents.contains(toScene)) { State.InProgress( transitionProgress = 1.0F, startLocation = MediaHierarchyManager.LOCATION_UNKNOWN, - getMediaLocation(toScene), + getMediaLocation(toScene, isInSplitShade), ) } else { State.Gone diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt index 3ec057becc18..491221f39191 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt @@ -361,6 +361,7 @@ private fun SceneScope.SingleShade( carouselController = mediaCarouselController, modifier = Modifier.layoutId(SingleShadeMeasurePolicy.LayoutId.Media), usingCollapsedLandscapeMedia = usingCollapsedLandscapeMedia, + isInSplitShade = false, ) NotificationScrollingStack( @@ -565,6 +566,7 @@ private fun SceneScope.SplitShade( Modifier.zIndex(1f) }, carouselController = mediaCarouselController, + isInSplitShade = true, ) } FooterActionsWithAnimatedVisibility( @@ -619,6 +621,7 @@ private fun SceneScope.ShadeMediaCarousel( mediaOffsetProvider: ShadeMediaOffsetProvider, modifier: Modifier = Modifier, usingCollapsedLandscapeMedia: Boolean = false, + isInSplitShade: Boolean, ) { MediaCarousel( modifier = modifier.fillMaxWidth(), @@ -632,5 +635,6 @@ private fun SceneScope.ShadeMediaCarousel( { mediaOffsetProvider.offset } }, usingCollapsedLandscapeMedia = usingCollapsedLandscapeMedia, + isInSplitShade = isInSplitShade, ) } |