summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-07-01 23:34:58 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-07-01 23:34:58 +0000
commit1eeb5d79ea47143d51787623384d54ccddb51b24 (patch)
treeee5840684f8dd2a88c916db66f19169175c17f56
parentb08edfd5b5cdf49a2ad373f17e0373ceba0249a6 (diff)
parent6455510f710d232e3328bd10ed058e8fee49b4cc (diff)
Merge "Fixed an issue where the media would reappear animated" into rvc-dev am: 93920d3b10 am: 6455510f71
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12051979 Change-Id: Iadab83c5c53a46f411ad5d1f12cbbc09cf3d4b2d
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt24
1 files changed, 23 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt
index 3d2b72d8fd83..fc33391a9ad1 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt
@@ -40,6 +40,28 @@ import javax.inject.Inject
import javax.inject.Singleton
/**
+ * Similarly to isShown but also excludes views that have 0 alpha
+ */
+val View.isShownNotFaded: Boolean
+ get() {
+ var current: View = this
+ while (true) {
+ if (current.visibility != View.VISIBLE) {
+ return false
+ }
+ if (current.alpha == 0.0f) {
+ return false
+ }
+ val parent = current.parent ?: return false // We are not attached to the view root
+ if (parent !is View) {
+ // we reached the viewroot, hurray
+ return true
+ }
+ current = parent
+ }
+ }
+
+/**
* This manager is responsible for placement of the unique media view between the different hosts
* and animate the positions of the views to achieve seamless transitions.
*/
@@ -368,7 +390,7 @@ class MediaHierarchyManager @Inject constructor(
// non-trivial reattaching logic happening that will make the view not-shown earlier
return true
}
- return mediaFrame.isShown || animator.isRunning || animationPending
+ return mediaFrame.isShownNotFaded || animator.isRunning || animationPending
}
private fun adjustAnimatorForTransition(desiredLocation: Int, previousLocation: Int) {