summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
author Beth Thibodeau <ethibodeau@google.com> 2025-03-21 17:30:48 -0500
committer Beth Thibodeau <ethibodeau@google.com> 2025-03-21 19:12:50 -0500
commit6e44fbbf665a2f1688c662dcbc2c12da9e7e02c0 (patch)
tree50394fafa97bac251f4c1e2406f3b2a8a823fc86 /packages/SystemUI/src
parentafeda29963fcc672ead45c018ab8858ee1909efa (diff)
Update crossfade status when animation is canceled
And more media host state logging Bug: 342175696 Test: build Flag: EXEMPT bugfix Change-Id: I584e3040c3debbc220791059b42356a7db291402
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHostStatesManager.kt24
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java1
5 files changed, 31 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt
index 365389107648..d9174d3969b5 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt
@@ -77,7 +77,7 @@ constructor(@MediaCarouselControllerLog private val buffer: LogBuffer) {
bool1 = visible
bool2 = oldState
},
- { "media host visibility changed location=$location, visible:$visible, was:$oldState" },
+ { "media host visibility changed location=$int1, visible:$bool1, was:$bool2" },
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt
index ec7d3328a2fd..133b029731f2 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt
@@ -208,6 +208,7 @@ constructor(
cancelled = true
animationPending = false
rootView?.removeCallbacks(startAnimation)
+ isCrossFadeAnimatorRunning = false
}
override fun onAnimationEnd(animation: Animator) {
@@ -768,6 +769,7 @@ constructor(
if (!willFade || isCurrentlyInGuidedTransformation() || !animate) {
// if we're fading, we want the desired location / measurement only to change
// once fully faded. This is happening in the host attachment
+ logger.logMediaLocation("no fade", currentAttachmentLocation, desiredLocation)
mediaCarouselController.onDesiredLocationChanged(
desiredLocation,
host,
@@ -1188,8 +1190,8 @@ constructor(
// immediately
// when the desired location changes. This callback will update the measurement
// of the carousel, only once we've faded out at the old location and then
- // reattach
- // to fade it in at the new location.
+ // reattach to fade it in at the new location.
+ logger.logMediaLocation("crossfade", currentAttachmentLocation, newLocation)
mediaCarouselController.onDesiredLocationChanged(
newLocation,
getHost(newLocation),
@@ -1204,6 +1206,7 @@ constructor(
* should remain in the previous location, while after the switch it should be at the desired
* location.
*/
+ @MediaLocation
private fun resolveLocationForFading(): Int {
if (isCrossFadeAnimatorRunning) {
// When animating between two hosts with a fade, let's keep ourselves in the old
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHostStatesManager.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHostStatesManager.kt
index 782da4bd6a41..3b8ef6adf2dd 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHostStatesManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHostStatesManager.kt
@@ -17,19 +17,24 @@
package com.android.systemui.media.controls.ui.controller
import com.android.app.tracing.traceSection
+import com.android.systemui.Dumpable
import com.android.systemui.Flags.mediaControlsUmoInflationInBackground
import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.dump.DumpManager
import com.android.systemui.media.controls.ui.view.MediaHostState
import com.android.systemui.util.animation.MeasurementOutput
+import java.io.PrintWriter
import javax.inject.Inject
+private val TAG = "MediaHostStatesManager"
+
/**
* A class responsible for managing all media host states of the various host locations and
* coordinating the heights among different players. This class can be used to get the most up to
* date state for any location.
*/
@SysUISingleton
-class MediaHostStatesManager @Inject constructor() {
+class MediaHostStatesManager @Inject constructor(dumpManager: DumpManager) : Dumpable {
private val callbacks: MutableSet<Callback> = mutableSetOf()
private val controllers: MutableSet<MediaViewController> = mutableSetOf()
@@ -43,6 +48,10 @@ class MediaHostStatesManager @Inject constructor() {
/** A map with all media states of all locations. */
val mediaHostStates: MutableMap<Int, MediaHostState> = mutableMapOf()
+ init {
+ dumpManager.registerNormalDumpable(TAG, this)
+ }
+
/**
* Notify that a media state for a given location has changed. Should only be called from Media
* hosts themselves.
@@ -125,6 +134,19 @@ class MediaHostStatesManager @Inject constructor() {
controllers.remove(controller)
}
+ override fun dump(pw: PrintWriter, args: Array<out String>) {
+ pw.apply {
+ println("Controllers: $controllers")
+ println("Callbacks: $callbacks")
+ for ((location, size) in carouselSizes) {
+ println("Size $location: ${size.measuredWidth} x ${size.measuredHeight}")
+ }
+ for ((location, state) in mediaHostStates) {
+ println("Host $location: visible ${state.visible}")
+ }
+ }
+ }
+
interface Callback {
/**
* Notify the callbacks that a media state for a host has changed, and that the
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt
index 089d16b98de8..357091bea1a1 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt
@@ -73,7 +73,7 @@ class MediaViewLogger @Inject constructor(@MediaViewLog private val buffer: LogB
bool1 = shadeVisible
bool2 = mediaVisible
},
- { "User visibility shade: $shadeVisible media: $mediaVisible" },
+ { "User visibility shade: $bool1 media: $bool2" },
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
index b0b02fa28390..4d5366ca79a1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
@@ -584,6 +584,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
}
if (mMediaHost != null) {
pw.println(" media bounds: " + mMediaHost.getCurrentBounds());
+ pw.println(" media visibility: " + mMediaHost.getVisible());
pw.println(" horizontal layout: " + mUsingHorizontalLayout);
pw.println(" last orientation: " + mLastOrientation);
}