Update shade transition on full expand or collapse
On the lockscreen, this is normally done by a call in
LockscreenShadeTransitionController when updating dragDownAmount.
However it seems that sometimes this update doesn't happen, leaving
MediaHierarchyManager in a bad state. This change listens to the
ShadeInteractor as a backup to ensure the state is updated when the
transition has finished.
Bug: 319244625
Test: manual - swipe shade while locked and unlocked and landscape mode
Test: manual - same on tablet device
Change-Id: I5c310ab038603c33f0a6a202ebcee9110e0612d9
Merged-In: I5c310ab038603c33f0a6a202ebcee9110e0612d9
(cherry picked from commit 5f17e34c0c1240e6f0ecd1b2401c9e1e57607cb3)
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 37a035c..5a3efea 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
@@ -460,8 +460,7 @@
object : StatusBarStateController.StateListener {
override fun onStatePreChange(oldState: Int, newState: Int) {
// We're updating the location before the state change happens, since we want
- // the
- // location of the previous state to still be up to date when the animation
+ // the location of the previous state to still be up to date when the animation
// starts
if (
newState == StatusBarState.SHADE_LOCKED &&
@@ -566,6 +565,15 @@
}
}
+ coroutineScope.launch {
+ shadeInteractor.shadeExpansion.collect { expansion ->
+ if (expansion >= 1f || expansion <= 0f) {
+ // Shade has fully expanded or collapsed: force transition amount update
+ setTransitionToFullShadeAmount(expansion)
+ }
+ }
+ }
+
val settingsObserver: ContentObserver =
object : ContentObserver(handler) {
override fun onChange(selfChange: Boolean, uri: Uri?) {