summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beth Thibodeau <ethibodeau@google.com> 2024-10-08 23:41:55 -0500
committer Beth Thibodeau <ethibodeau@google.com> 2024-10-08 23:41:55 -0500
commit581650c7a61c0b8ddc72f542a26641e07cc1a1fe (patch)
treed75449f37f7ae139305b1aaa768c9b60fbcaa682
parentca5085b85068ebf7cdf1beed9a1cc5b84c0e0b1d (diff)
[flexiglass] Fix split shade loading
Split shade is part of ShadeScene, but is LOCATION_QS for media layout purposes Flag: com.android.systemui.scene_container Fixes: 371604686 Test: manual on tablet - verify media appears on first load, in both landscape and portrait Change-Id: If0afaacf0ae849621b1886420fa4a1c23aae8c3a
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarousel.kt5
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/media/controls/ui/composable/MediaCarouselStateLoader.kt17
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt4
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,
)
}