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

Commit 170b1929 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Post at front of queue for app launch and recents launch" into ub-launcher3-edmonton

parents ad007ba9 6e9f6838
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.launcher3;

import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -35,20 +36,31 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
    private static final int REFRESH_RATE_MS = 16;

    private final Handler mHandler;
    private final boolean mStartAtFrontOfQueue;
    private AnimationResult mAnimationResult;

    public LauncherAnimationRunner(Handler handler) {
    /**
     * @param startAtFrontOfQueue If true, the animation start will be posted at the front of the
     *                            queue to minimize latency.
     */
    public LauncherAnimationRunner(Handler handler, boolean startAtFrontOfQueue) {
        mHandler = handler;
        mStartAtFrontOfQueue = startAtFrontOfQueue;
    }

    @BinderThread
    @Override
    public void onAnimationStart(RemoteAnimationTargetCompat[] targetCompats, Runnable runnable) {
        postAsyncCallback(mHandler, () -> {
        Runnable r = () -> {
            finishExistingAnimation();
            mAnimationResult = new AnimationResult(runnable);
            onCreateAnimation(targetCompats, mAnimationResult);
        });
        };
        if (mStartAtFrontOfQueue) {
            postAtFrontOfQueueAsynchronously(mHandler, r);
        } else {
            postAsyncCallback(mHandler, r);
        }
    }

    /**
+3 −2
Original line number Diff line number Diff line
@@ -162,7 +162,8 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
    @Override
    public ActivityOptions getActivityLaunchOptions(Launcher launcher, View v) {
        if (hasControlRemoteAppTransitionPermission()) {
            RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mHandler) {
            RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mHandler,
                    true /* startAtFrontOfQueue */) {

                @Override
                public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
@@ -572,7 +573,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
     *         ie. pressing home, swiping up from nav bar.
     */
    private RemoteAnimationRunnerCompat getWallpaperOpenRunner() {
        return new LauncherAnimationRunner(mHandler) {
        return new LauncherAnimationRunner(mHandler, false /* startAtFrontOfQueue */) {
            @Override
            public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
                    AnimationResult result) {
+2 −1
Original line number Diff line number Diff line
@@ -172,7 +172,8 @@ public class RecentsActivity extends BaseDraggingActivity {
        }

        final TaskView taskView = (TaskView) v;
        RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mUiHandler) {
        RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mUiHandler,
                true /* startAtFrontOfQueue */) {

            @Override
            public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ public interface RemoteAnimationProvider {
    AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targets);

    default ActivityOptions toActivityOptions(Handler handler, long duration) {
        LauncherAnimationRunner runner = new LauncherAnimationRunner(handler) {
        LauncherAnimationRunner runner = new LauncherAnimationRunner(handler,
                false /* startAtFrontOfQueue */) {

            @Override
            public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,