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

Commit 08744d60 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "Fixes a race condition when merge animation transition" into tm-qpr-dev am: 8f3ab8cb

parents 393122ab 8f3ab8cb
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -186,6 +186,8 @@ public class RemoteTransitionCompat implements Parcelable {
                } catch (RemoteException e) {
                    Log.e(TAG, "Error merging transition.", e);
                }
                // commit taskAppeared after merge transition finished.
                mRecentsSession.commitTasksAppearedIfNeeded(recents);
            }
        };
        mTransition = new RemoteTransition(remote, appThread);
@@ -226,6 +228,7 @@ public class RemoteTransitionCompat implements Parcelable {
        private PictureInPictureSurfaceTransaction mPipTransaction = null;
        private IBinder mTransition = null;
        private boolean mKeyguardLocked = false;
        private RemoteAnimationTargetCompat[] mAppearedTargets;

        void setup(RecentsAnimationControllerCompat wrapped, TransitionInfo info,
                IRemoteTransitionFinishedCallback finishCB,
@@ -251,6 +254,7 @@ public class RemoteTransitionCompat implements Parcelable {
        boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
                RecentsAnimationListener recents) {
            SparseArray<TransitionInfo.Change> openingTasks = null;
            mAppearedTargets = null;
            boolean cancelRecents = false;
            boolean homeGoingAway = false;
            boolean hasChangingApp = false;
@@ -331,10 +335,17 @@ public class RemoteTransitionCompat implements Parcelable {
                targets[i] = target;
            }
            t.apply();
            recents.onTasksAppeared(targets);
            mAppearedTargets = targets;
            return true;
        }

        private void commitTasksAppearedIfNeeded(RecentsAnimationListener recents) {
            if (mAppearedTargets != null) {
                recents.onTasksAppeared(mAppearedTargets);
                mAppearedTargets = null;
            }
        }

        @Override public ThumbnailData screenshotTask(int taskId) {
            try {
                final TaskSnapshot snapshot =