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

Commit 2a7122cf authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition in BoundsAnimationController" into pi-dev

parents db7648f3 f8a96ddc
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -31,11 +31,13 @@ import android.os.IBinder;
import android.os.Debug;
import android.util.ArrayMap;
import android.util.Slog;
import android.view.Choreographer;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;

import com.android.internal.annotations.VisibleForTesting;

import com.android.internal.graphics.SfVsyncFrameCallbackProvider;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@@ -112,6 +114,7 @@ public class BoundsAnimationController {
    private final Interpolator mFastOutSlowInInterpolator;
    private boolean mFinishAnimationAfterTransition = false;
    private final AnimationHandler mAnimationHandler;
    private Choreographer mChoreographer;

    private static final int WAIT_FOR_DRAW_TIMEOUT_MS = 3000;

@@ -123,6 +126,12 @@ public class BoundsAnimationController {
        mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
                com.android.internal.R.interpolator.fast_out_slow_in);
        mAnimationHandler = animationHandler;
        if (animationHandler != null) {
            // If an animation handler is provided, then ensure that it runs on the sf vsync tick
            handler.runWithScissors(() -> mChoreographer = Choreographer.getSfInstance(),
                    0 /* timeout */);
            animationHandler.setProvider(new SfVsyncFrameCallbackProvider(mChoreographer));
        }
    }

    @VisibleForTesting
+0 −1
Original line number Diff line number Diff line
@@ -1005,7 +1005,6 @@ public class WindowManagerService extends IWindowManager.Stub
        mAppTransition.registerListenerLocked(mActivityManagerAppTransitionNotifier);

        final AnimationHandler animationHandler = new AnimationHandler();
        animationHandler.setProvider(new SfVsyncFrameCallbackProvider());
        mBoundsAnimationController = new BoundsAnimationController(context, mAppTransition,
                AnimationThread.getHandler(), animationHandler);