From f93544c58cc2270ab61ec734e00fd91e25454b2c Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 20 Mar 2025 11:28:24 -0400 Subject: Revert "Reset leashes before starting taskbar app pair launch animation" This reverts commit ba25fd9523d1a303c54eef43f12f7b6e284f81aa. Bug: 399037701 Flag: EXEMPT bugfix Change-Id: Ifda203670c3273ce28fc6522f08cca830da95957 --- .../quickstep/util/SplitAnimationController.kt | 41 ---------------------- 1 file changed, 41 deletions(-) (limited to 'quickstep') diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt index d6e553d1b0..57f04e2b26 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt @@ -995,11 +995,6 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC val splitTree: Pair>? = extractTopParentAndChildren(transitionInfo) check(splitTree != null) { "Could not find a split root candidate" } val rootCandidate = splitTree.first - val stageRootTaskIds: Set = splitTree.second.map { it.taskInfo!!.taskId }.toSet() - val leafTasks: List = - transitionInfo.changes - .filter { it.taskInfo != null && it.taskInfo!!.parentTaskId in stageRootTaskIds } - .toList() // Starting position is a 34% size tile centered in the middle of the screen. // Ending position is the full device screen. @@ -1033,42 +1028,6 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC override fun onAnimationEnd(animation: Animator) { finishCallback.run() } - - override fun onAnimationStart(animation: Animator) { - // Reset leaf and stage root tasks, animation can begin from freeform windows - for (leaf in leafTasks) { - val endAbsBounds = leaf.endAbsBounds - - t.setAlpha(leaf.leash, 1f) - t.setCrop( - leaf.leash, - 0f, - 0f, - endAbsBounds.width().toFloat(), - endAbsBounds.height().toFloat(), - ) - t.setPosition(leaf.leash, 0f, 0f) - } - - for (stageRoot in splitTree.second) { - val endAbsBounds = stageRoot.endAbsBounds - - t.setAlpha(stageRoot.leash, 1f) - t.setCrop( - stageRoot.leash, - 0f, - 0f, - endAbsBounds.width().toFloat(), - endAbsBounds.height().toFloat(), - ) - t.setPosition( - stageRoot.leash, - endAbsBounds.left.toFloat(), - endAbsBounds.top.toFloat(), - ) - } - t.apply() - } } ) -- cgit v1.2.3-59-g8ed1b From f36726e58a434f5bd5d72bb20b4e5742d9b625b4 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 20 Mar 2025 11:53:00 -0400 Subject: Revert "Re-use existing method to get split root" This reverts commit 7f6f7aad7b26b62b9fdc765bd8be5d622386a666. * Fix forward at ag/32331020 Bug: 399037701 Flag: EXEMPT bugfix Change-Id: I48079ecb8232bc1026ba389cebe8ddf7d32b71f0 --- .../quickstep/util/SplitAnimationController.kt | 33 +++++++++++++++++++--- .../com/android/quickstep/util/SplitScreenUtils.kt | 4 +-- 2 files changed, 31 insertions(+), 6 deletions(-) (limited to 'quickstep') diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt index 57f04e2b26..dc394dffb0 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt @@ -65,7 +65,6 @@ import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource import com.android.launcher3.views.BaseDragLayer import com.android.quickstep.TaskViewUtils -import com.android.quickstep.util.SplitScreenUtils.Companion.extractTopParentAndChildren import com.android.quickstep.views.FloatingAppPairView import com.android.quickstep.views.FloatingTaskView import com.android.quickstep.views.GroupedTaskView @@ -992,9 +991,35 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC progressUpdater.setDuration(QuickstepTransitionManager.APP_LAUNCH_DURATION) progressUpdater.interpolator = Interpolators.EMPHASIZED - val splitTree: Pair>? = extractTopParentAndChildren(transitionInfo) - check(splitTree != null) { "Could not find a split root candidate" } - val rootCandidate = splitTree.first + var rootCandidate: Change? = null + + for (change in transitionInfo.changes) { + val taskInfo: RunningTaskInfo = change.taskInfo ?: continue + + // TODO (b/316490565): Replace this logic when SplitBounds is available to + // startAnimation() and we can know the precise taskIds of launching tasks. + if ( + taskInfo.windowingMode == windowingMode && + (change.mode == TRANSIT_OPEN || change.mode == TRANSIT_TO_FRONT) + ) { + // Found one! + rootCandidate = change + break + } + } + + // If we could not find a proper root candidate, something went wrong. + check(rootCandidate != null) { "Could not find a split root candidate" } + + // Recurse up the tree until parent is null, then we've found our root. + var parentToken: WindowContainerToken? = rootCandidate.parent + while (parentToken != null) { + rootCandidate = transitionInfo.getChange(parentToken) ?: break + parentToken = rootCandidate.parent + } + + // Make sure nothing weird happened, like getChange() returning null. + check(rootCandidate != null) { "Failed to find a root leash" } // Starting position is a 34% size tile centered in the middle of the screen. // Ending position is the full device screen. diff --git a/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt b/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt index 7787e30b42..4005c5a813 100644 --- a/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt +++ b/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt @@ -46,8 +46,8 @@ class SplitScreenUtils { * Given a TransitionInfo, generates the tree structure for those changes and extracts out * the top most root and it's two immediate children. Changes can be provided in any order. * - * @return null if no root is found, otherwise a [Pair] where first -> top most split root, - * second -> [List] of 2, leftTop/bottomRight stage roots + * @return a [Pair] where first -> top most split root, second -> [List] of 2, + * leftTop/bottomRight stage roots */ fun extractTopParentAndChildren( transitionInfo: TransitionInfo -- cgit v1.2.3-59-g8ed1b