Merge "Apply root task for launch activity animation." into udc-dev am: 181bcdba08

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23109637

Change-Id: I9a79bab00aef1322ddc8714a11208f93fb14145e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Wei Sheng Shih
2023-05-11 09:08:48 +00:00
committed by Automerger Merge Worker

View File

@@ -508,6 +508,26 @@ class ActivityLaunchAnimator(
startAnimation(apps, nonApps, callback)
}
private fun findRootTaskIfPossible(
apps: Array<out RemoteAnimationTarget>?
): RemoteAnimationTarget? {
if (apps == null) {
return null
}
var candidate: RemoteAnimationTarget? = null
for (it in apps) {
if (it.mode == RemoteAnimationTarget.MODE_OPENING) {
if (it.taskInfo != null && !it.hasAnimatingParent) {
return it
}
if (candidate == null) {
candidate = it
}
}
}
return candidate
}
private fun startAnimation(
apps: Array<out RemoteAnimationTarget>?,
nonApps: Array<out RemoteAnimationTarget>?,
@@ -517,8 +537,7 @@ class ActivityLaunchAnimator(
Log.d(TAG, "Remote animation started")
}
val window = apps?.firstOrNull { it.mode == RemoteAnimationTarget.MODE_OPENING }
val window = findRootTaskIfPossible(apps)
if (window == null) {
Log.i(TAG, "Aborting the animation as no window is opening")
removeTimeout()