summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-24 13:06:33 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-24 13:06:33 -0700
commit292e74623e0a382b4a8d804925e6ce7f5be2afab (patch)
tree459dc43708191769e96af4fb8687061ad2a50f40 /packages/SystemUI/src
parent7c41f9bb59a72f0f0c369d8a82bffbbf41b49dd2 (diff)
parent6cfa509b7afff8ee8542dd248c13cd910151b643 (diff)
Merge "Fix UMO flicks on lockscreen when disabled." into main
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt25
1 files changed, 23 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
index 13a9f345c04b..bfad3ecd989c 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
@@ -53,6 +53,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.Edge
+import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING
import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.TransitionState
@@ -330,6 +331,11 @@ constructor(
.isFinishedIn(Scenes.Gone, GONE)
.stateIn(applicationScope, SharingStarted.Eagerly, true)
+ private val isGoingToDozing =
+ keyguardTransitionInteractor
+ .isInTransition(Edge.create(to = DOZING))
+ .stateIn(applicationScope, SharingStarted.Eagerly, true)
+
init {
dumpManager.registerNormalDumpable(TAG, this)
mediaFrame = inflateMediaCarousel()
@@ -392,6 +398,7 @@ constructor(
repeatOnLifecycle(Lifecycle.State.STARTED) {
listenForAnyStateToGoneKeyguardTransition(this)
listenForAnyStateToLockscreenTransition(this)
+ listenForAnyStateToDozingTransition(this)
if (!SceneContainerFlag.isEnabled) return@repeatOnLifecycle
listenForMediaItemsChanges(this)
@@ -561,6 +568,20 @@ constructor(
}
}
+ @VisibleForTesting
+ internal fun listenForAnyStateToDozingTransition(scope: CoroutineScope): Job {
+ return scope.launch {
+ keyguardTransitionInteractor
+ .transition(Edge.create(to = DOZING))
+ .filter { it.transitionState == TransitionState.FINISHED }
+ .collect {
+ if (!allowMediaPlayerOnLockScreen) {
+ updateHostVisibility()
+ }
+ }
+ }
+ }
+
private fun listenForMediaItemsChanges(scope: CoroutineScope): Job {
return scope.launch {
mediaCarouselViewModel.mediaItems.collectLatest {
@@ -695,13 +716,13 @@ constructor(
updatePlayers(recreateMedia = true)
}
- /** Return true if the carousel should be hidden because lockscreen is currently visible */
+ /** Return true if the carousel should be hidden because device is locked. */
fun isLockedAndHidden(): Boolean {
val isOnLockscreen =
if (SceneContainerFlag.isEnabled) {
!deviceEntryInteractor.isDeviceEntered.value
} else {
- !isOnGone.value
+ !isOnGone.value || isGoingToDozing.value
}
return !allowMediaPlayerOnLockScreen && isOnLockscreen
}