Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f5a02e5 authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Integrate recent animation of single-root split with shell transition" into tm-dev

parents 0f95c436 bb750d8a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -344,7 +344,7 @@ public final class TransitionInfo implements Parcelable {
            if (parentChg.getMode() != TRANSIT_CHANGE) return false;
            if (parentChg.getMode() != TRANSIT_CHANGE) return false;


            // If there are no more parents left, then all the parents, so far, have not been
            // If there are no more parents left, then all the parents, so far, have not been
            // visibility changes which means this change is indpendent.
            // visibility changes which means this change is independent.
            if (parentChg.getParent() == null) return true;
            if (parentChg.getParent() == null) return true;


            parentChg = info.getChange(parentChg.getParent());
            parentChg = info.getChange(parentChg.getParent());
+30 −10
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.IntArray;
import android.util.SparseArray;
import android.util.SparseArray;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
@@ -269,6 +270,7 @@ public class RemoteAnimationTargetCompat {
            SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
            SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
        final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>();
        final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>();
        final SparseArray<RemoteAnimationTargetCompat> childTaskTargets = new SparseArray<>();
        final SparseArray<RemoteAnimationTargetCompat> childTaskTargets = new SparseArray<>();
        final IntArray excludedParentTaskIds = new IntArray();
        for (int i = 0; i < info.getChanges().size(); i++) {
        for (int i = 0; i < info.getChanges().size(); i++) {
            final TransitionInfo.Change change = info.getChanges().get(i);
            final TransitionInfo.Change change = info.getChanges().get(i);
            final boolean changeIsWallpaper =
            final boolean changeIsWallpaper =
@@ -282,22 +284,40 @@ public class RemoteAnimationTargetCompat {
            }
            }
            final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
            final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
            if (taskInfo != null) {
            if (taskInfo != null) {
                if (taskInfo.parentTaskId != -1) {
                // Skip wrapping excluded parent task animate target since it will animate its child
                    // Cache child task targets to override its parent target later and exclude
                // tasks instead.
                    // child task while wrapping up animate targets. Otherwise the child task might
                if (excludedParentTaskIds.binarySearch(taskInfo.taskId) != -1) {
                    // get transformed twice with the flow like RecentsView#redrawLiveTile.
                    childTaskTargets.put(taskInfo.parentTaskId, targetCompat);
                    continue;
                    continue;
                }
                }


                final RemoteAnimationTargetCompat childTaskTarget =
                // Check if there's a matching child task target in cache.
                        childTaskTargets.get(taskInfo.taskId);
                RemoteAnimationTargetCompat childTaskTarget = childTaskTargets.get(taskInfo.taskId);
                if (childTaskTarget != null) {
                if (childTaskTarget != null) {
                    // Launcher monitors leaf tasks to perform animation, hence override the parent
                    // Launcher monitors leaf task ids to perform animation, override the target
                    // task target with child task info so Launcher can locate and animate root
                    // with its child task information so Launcher can animate this parent surface
                    // surface directly with leaf task information.
                    // directly with leaf task information.
                    targetCompat.taskInfo = childTaskTarget.taskInfo;
                    targetCompat.taskInfo = childTaskTarget.taskInfo;
                    targetCompat.taskId = childTaskTarget.taskId;
                    targetCompat.taskId = childTaskTarget.taskId;
                    childTaskTargets.remove(taskInfo.taskId);
                }

                // Check if it has a parent task, cache its information for later use.
                if (taskInfo.parentTaskId != -1
                        && excludedParentTaskIds.binarySearch(taskInfo.parentTaskId) == -1) {
                    if (!childTaskTargets.contains(taskInfo.parentTaskId)) {
                        // Cache the target amd skip wrapping it info the final animation targets.
                        // Otherwise, the child task might get transformed multiple-times with the
                        // flow like RecentsView#redrawLiveTile.
                        childTaskTargets.put(taskInfo.parentTaskId, targetCompat);
                        continue;
                    }

                    // There is another child task target cached with the same parent task id.
                    // Which means the parent having multiple child tasks in transition. Stop
                    // propagate child task info.
                    childTaskTarget = childTaskTargets.removeReturnOld(taskInfo.parentTaskId);
                    out.add(childTaskTarget);
                    excludedParentTaskIds.add(taskInfo.parentTaskId);
                }
                }
            }
            }