summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beth Thibodeau <ethibodeau@google.com> 2025-02-26 15:04:17 -0600
committer Beth Thibodeau <ethibodeau@google.com> 2025-02-26 15:29:35 -0600
commit53432b4c62ecb35cd69893e67c04755d9e36db82 (patch)
tree46837fd5d527f1a56c97ed300c5de3b93a430bf3
parent865fec2daa0f7e7cc356d03166cf3cd2ded14e92 (diff)
Additional host update check and logging
- Send updates from MediaHost whenever the state changes, even if the host view visibility had already been updated for some reason - Log media view visibility on more changes Bug: 342175696 Test: check dumpsys Flag: EXEMPT bugfix Change-Id: Ia82889282235a5759e5fd39d29a8fe89a400f4ca
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerLogger.kt5
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManager.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewLogger.kt28
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaHost.kt5
4 files changed, 36 insertions, 11 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 9b443f56636a..5d62c022efba 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
@@ -90,15 +90,16 @@ constructor(@MediaCarouselControllerLog private val buffer: LogBuffer) {
fun logCarouselVisible() = buffer.log(TAG, LogLevel.DEBUG, {}, { "showing carousel" })
- fun logMediaHostVisibility(location: Int, visible: Boolean) {
+ fun logMediaHostVisibility(location: Int, visible: Boolean, oldState: Boolean) {
buffer.log(
TAG,
LogLevel.DEBUG,
{
int1 = location
bool1 = visible
+ bool2 = oldState
},
- { "media host visibility changed location=$location, visible:$visible" },
+ { "media host visibility changed location=$location, visible:$visible, was:$oldState" },
)
}
}
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 c6894082f1c8..69006c6107cc 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
@@ -1129,10 +1129,11 @@ constructor(
traceSection("MediaHierarchyManager#updateHostAttachment") {
if (SceneContainerFlag.isEnabled) {
// No need to manage transition states - just update the desired location directly
- logger.logMediaHostAttachment(desiredLocation)
+ val host = getHost(desiredLocation)
+ logger.logMediaHostAttachment(desiredLocation, host?.visible)
mediaCarouselController.onDesiredLocationChanged(
desiredLocation = desiredLocation,
- desiredHostState = getHost(desiredLocation),
+ desiredHostState = host,
animate = false,
)
return
@@ -1169,7 +1170,8 @@ constructor(
// that and directly set the mediaFrame's bounds within the premeasured host.
targetHost.addView(mediaFrame)
}
- logger.logMediaHostAttachment(currentAttachmentLocation)
+ val host = getHost(currentAttachmentLocation)
+ logger.logMediaHostAttachment(currentAttachmentLocation, host?.visible)
if (isCrossFadeAnimatorRunning) {
// When cross-fading with an animation, we only notify the media carousel of the
// location change, once the view is reattached to the new place and not
@@ -1313,6 +1315,7 @@ constructor(
isHomeScreenShadeVisibleToUser() ||
isGlanceableHubVisibleToUser()
val mediaVisible = qsExpanded || hasActiveMediaOrRecommendation
+ logger.logUserVisibilityChange(shadeVisible, mediaVisible)
mediaCarouselController.mediaCarouselScrollHandler.visibleToUser =
shadeVisible && mediaVisible
}
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 1514db38d882..089d16b98de8 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
@@ -36,7 +36,7 @@ class MediaViewLogger @Inject constructor(@MediaViewLog private val buffer: LogB
int1 = width
int2 = height
},
- { "size ($str1): $int1 x $int2" }
+ { "size ($str1): $int1 x $int2" },
)
}
@@ -49,11 +49,31 @@ class MediaViewLogger @Inject constructor(@MediaViewLog private val buffer: LogB
int1 = startLocation
int2 = endLocation
},
- { "location ($str1): $int1 -> $int2" }
+ { "location ($str1): $int1 -> $int2" },
)
}
- fun logMediaHostAttachment(host: Int) {
- buffer.log(TAG, LogLevel.DEBUG, { int1 = host }, { "Host (updateHostAttachment): $int1" })
+ fun logMediaHostAttachment(host: Int, visible: Boolean?) {
+ buffer.log(
+ TAG,
+ LogLevel.DEBUG,
+ {
+ int1 = host
+ str1 = visible.toString()
+ },
+ { "Host (updateHostAttachment): $int1 visible $str1" },
+ )
+ }
+
+ fun logUserVisibilityChange(shadeVisible: Boolean, mediaVisible: Boolean) {
+ buffer.log(
+ TAG,
+ LogLevel.DEBUG,
+ {
+ bool1 = shadeVisible
+ bool2 = mediaVisible
+ },
+ { "User visibility shade: $shadeVisible media: $mediaVisible" },
+ )
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaHost.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaHost.kt
index 11251cdb6315..a518349ea424 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaHost.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaHost.kt
@@ -208,6 +208,7 @@ class MediaHost(
* the visibility has changed
*/
fun updateViewVisibility() {
+ val oldState = state.visible
state.visible =
if (mediaCarouselController.isLockedAndHidden()) {
false
@@ -217,9 +218,9 @@ class MediaHost(
mediaDataManager.hasAnyMediaOrRecommendation()
}
val newVisibility = if (visible) View.VISIBLE else View.GONE
- if (newVisibility != hostView.visibility) {
+ if (oldState != state.visible || newVisibility != hostView.visibility) {
hostView.visibility = newVisibility
- debugLogger.logMediaHostVisibility(location, visible)
+ debugLogger.logMediaHostVisibility(location, visible, oldState)
visibleChangedListeners.forEach { it.invoke(visible) }
}
}