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

Commit 8b16f865 authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Fix weird animation when switching back to split pair from recents"...

Merge "Fix weird animation when switching back to split pair from recents" into tm-dev am: ecbc9712

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



Change-Id: I694dcbb1f0ebe8deb4a6b45041957a7a8d1313e8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b1b3b872 ecbc9712
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseArray;
import android.view.IRecentsAnimationController;
import android.view.SurfaceControl;
import android.window.IRemoteTransition;
@@ -244,22 +245,28 @@ public class RemoteTransitionCompat implements Parcelable {
        @SuppressLint("NewApi")
        boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
                RecentsAnimationListener recents) {
            ArrayList<TransitionInfo.Change> openingTasks = null;
            SparseArray<TransitionInfo.Change> openingTasks = null;
            boolean cancelRecents = false;
            boolean homeGoingAway = false;
            boolean hasChangingApp = false;
            for (int i = info.getChanges().size() - 1; i >= 0; --i) {
                final TransitionInfo.Change change = info.getChanges().get(i);
                if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) {
                    if (change.getTaskInfo() != null) {
                        if (change.getTaskInfo().topActivityType == ACTIVITY_TYPE_HOME) {
                    final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
                    if (taskInfo != null) {
                        if (taskInfo.topActivityType == ACTIVITY_TYPE_HOME) {
                            // canceling recents animation
                            cancelRecents = true;
                        }
                        if (openingTasks == null) {
                            openingTasks = new ArrayList<>();
                            openingTasks = new SparseArray<>();
                        }
                        if (taskInfo.hasParentTask()) {
                            // Collects opening leaf tasks only since Launcher monitors leaf task
                            // ids to perform recents animation.
                            openingTasks.remove(taskInfo.parentTaskId);
                        }
                        openingTasks.add(change);
                        openingTasks.put(taskInfo.taskId, change);
                    }
                } else if (change.getMode() == TRANSIT_CLOSE
                        || change.getMode() == TRANSIT_TO_BACK) {
@@ -287,7 +294,7 @@ public class RemoteTransitionCompat implements Parcelable {
            int pauseMatches = 0;
            if (!cancelRecents) {
                for (int i = 0; i < openingTasks.size(); ++i) {
                    if (mPausingTasks.contains(openingTasks.get(i).getContainer())) {
                    if (mPausingTasks.contains(openingTasks.valueAt(i).getContainer())) {
                        ++pauseMatches;
                    }
                }
@@ -308,10 +315,11 @@ public class RemoteTransitionCompat implements Parcelable {
            final RemoteAnimationTargetCompat[] targets =
                    new RemoteAnimationTargetCompat[openingTasks.size()];
            for (int i = 0; i < openingTasks.size(); ++i) {
                mOpeningLeashes.add(openingTasks.get(i).getLeash());
                final TransitionInfo.Change change = openingTasks.valueAt(i);
                mOpeningLeashes.add(change.getLeash());
                // We are receiving new opening tasks, so convert to onTasksAppeared.
                final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
                        openingTasks.get(i), layer, info, t);
                        change, layer, info, t);
                mLeashMap.put(mOpeningLeashes.get(i), target.leash);
                t.reparent(target.leash, mInfo.getRootLeash());
                t.setLayer(target.leash, layer);