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

Commit 0726c589 authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Make recents transition wrapper implement IRAC" into udc-dev am: fb32cc4b

parents b309bbbd fb32cc4b
Loading
Loading
Loading
Loading
+18 −35
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.wm.shell.util.TransitionUtil;

import java.util.ArrayList;
@@ -56,7 +55,7 @@ public class RemoteTransitionCompat {

    /** Constructor specifically for recents animation */
    public static RemoteTransition newRemoteTransition(RecentsAnimationListener recents,
            RecentsAnimationControllerCompat controller, IApplicationThread appThread) {
            IApplicationThread appThread) {
        IRemoteTransition remote = new IRemoteTransition.Stub() {
            final RecentsControllerWrap mRecentsSession = new RecentsControllerWrap();
            IBinder mToken = null;
@@ -67,7 +66,7 @@ public class RemoteTransitionCompat {
                    IRemoteTransitionFinishedCallback finishedCallback) {
                // TODO(b/177438007): Move this set-up logic into launcher's animation impl.
                mToken = transition;
                mRecentsSession.start(controller, recents, mToken, info, t, finishedCallback);
                mRecentsSession.start(recents, mToken, info, t, finishedCallback);
            }

            @Override
@@ -96,9 +95,8 @@ public class RemoteTransitionCompat {
     * TODO(b/177438007): Remove this once Launcher handles shell transitions directly.
     */
    @VisibleForTesting
    static class RecentsControllerWrap extends RecentsAnimationControllerCompat {
    static class RecentsControllerWrap extends IRecentsAnimationController.Default {
        private RecentsAnimationListener mListener = null;
        private RecentsAnimationControllerCompat mWrapped = null;
        private IRemoteTransitionFinishedCallback mFinishCB = null;

        /**
@@ -135,7 +133,7 @@ public class RemoteTransitionCompat {
        /** The latest state that the recents animation is operating in. */
        private int mState = STATE_NORMAL;

        void start(RecentsAnimationControllerCompat wrapped, RecentsAnimationListener listener,
        void start(RecentsAnimationListener listener,
                IBinder transition, TransitionInfo info, SurfaceControl.Transaction t,
                IRemoteTransitionFinishedCallback finishedCallback) {
            if (mInfo != null) {
@@ -143,7 +141,6 @@ public class RemoteTransitionCompat {
                        + " recents is already active.");
            }
            mListener = listener;
            mWrapped = wrapped;
            mInfo = info;
            mFinishCB = finishedCallback;
            mPausingTasks = new ArrayList<>();
@@ -200,7 +197,8 @@ public class RemoteTransitionCompat {
                }
            }
            t.apply();
            mListener.onAnimationStart(this, apps.toArray(new RemoteAnimationTarget[apps.size()]),
            mListener.onAnimationStart(new RecentsAnimationControllerCompat(this),
                    apps.toArray(new RemoteAnimationTarget[apps.size()]),
                    wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]),
                    new Rect(0, 0, 0, 0), new Rect());
        }
@@ -342,13 +340,9 @@ public class RemoteTransitionCompat {
            }
        }

        @Override public ThumbnailData screenshotTask(int taskId) {
        @Override public TaskSnapshot screenshotTask(int taskId) {
            try {
                final TaskSnapshot snapshot =
                        ActivityTaskManager.getService().takeTaskSnapshot(taskId);
                if (snapshot != null) {
                    return new ThumbnailData(snapshot);
                }
                return ActivityTaskManager.getService().takeTaskSnapshot(taskId);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to screenshot task", e);
            }
@@ -356,7 +350,7 @@ public class RemoteTransitionCompat {
        }

        @Override public void setInputConsumerEnabled(boolean enabled) {
            if (enabled) {
            if (!enabled) return;
            // transient launches don't receive focus automatically. Since we are taking over
            // the gesture now, take focus explicitly.
            // This also moves recents back to top if the user gestured before a switch
@@ -367,19 +361,13 @@ public class RemoteTransitionCompat {
                Log.e(TAG, "Failed to set focused task", e);
            }
        }
            if (mWrapped != null) mWrapped.setInputConsumerEnabled(enabled);
        }

        @Override public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
            if (mWrapped != null) mWrapped.setAnimationTargetsBehindSystemBars(behindSystemBars);
        }

        @Override public void setFinishTaskTransaction(int taskId,
                PictureInPictureSurfaceTransaction finishTransaction, SurfaceControl overlay) {
            mPipTransaction = finishTransaction;
            if (mWrapped != null) {
                mWrapped.setFinishTaskTransaction(taskId, finishTransaction, overlay);
            }
        }

        @Override
@@ -389,7 +377,6 @@ public class RemoteTransitionCompat {
                Log.e(TAG, "Duplicate call to finish", new RuntimeException());
                return;
            }
            if (mWrapped != null) mWrapped.finish(toHome, sendUserLeaveHint);
            final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
            final WindowContainerTransaction wct = new WindowContainerTransaction();

@@ -462,7 +449,6 @@ public class RemoteTransitionCompat {
            // for releasing the leashes created by local.
            mInfo.releaseAllSurfaces();
            // Reset all members.
            mWrapped = null;
            mListener = null;
            mFinishCB = null;
            mPausingTasks = null;
@@ -476,23 +462,20 @@ public class RemoteTransitionCompat {
        }

        @Override public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
            if (mWrapped != null) mWrapped.setDeferCancelUntilNextTransition(defer, screenshot);
        }

        @Override public void cleanupScreenshot() {
            if (mWrapped != null) mWrapped.cleanupScreenshot();
        }

        @Override public void setWillFinishToHome(boolean willFinishToHome) {
            mWillFinishToHome = willFinishToHome;
            if (mWrapped != null) mWrapped.setWillFinishToHome(willFinishToHome);
        }

        /**
         * @see IRecentsAnimationController#removeTask
         */
        @Override public boolean removeTask(int taskId) {
            return mWrapped != null ? mWrapped.removeTask(taskId) : false;
            return false;
        }

        /**