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

Commit b91693b1 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Block animation transfer after surface animation finishes." am: 4e54b2f3 am: 8057c823

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

Change-Id: I5af2fa814deca6d6e454fb75aa9c69e38988e854
parents c15388da 8057c823
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,8 @@ class SurfaceAnimator {


    private boolean mAnimationStartDelayed;
    private boolean mAnimationStartDelayed;


    private boolean mAnimationFinished;

    /**
    /**
     * @param animatable The object to animate.
     * @param animatable The object to animate.
     * @param staticAnimationFinishedCallback Callback to invoke when an animation has finished
     * @param staticAnimationFinishedCallback Callback to invoke when an animation has finished
@@ -134,6 +136,7 @@ class SurfaceAnimator {
                        || anim.shouldDeferAnimationFinish(resetAndInvokeFinish))) {
                        || anim.shouldDeferAnimationFinish(resetAndInvokeFinish))) {
                    resetAndInvokeFinish.run();
                    resetAndInvokeFinish.run();
                }
                }
                mAnimationFinished = true;
            }
            }
        };
        };
    }
    }
@@ -289,6 +292,9 @@ class SurfaceAnimator {
            Slog.w(TAG, "Unable to transfer animation, surface or parent is null");
            Slog.w(TAG, "Unable to transfer animation, surface or parent is null");
            cancelAnimation();
            cancelAnimation();
            return;
            return;
        } else if (from.mAnimationFinished) {
            Slog.w(TAG, "Unable to transfer animation, because " + from + " animation is finished");
            return;
        }
        }
        endDelayingAnimationStart();
        endDelayingAnimationStart();
        final Transaction t = mAnimatable.getPendingTransaction();
        final Transaction t = mAnimatable.getPendingTransaction();
@@ -367,6 +373,7 @@ class SurfaceAnimator {
        SurfaceControl leash = mLeash;
        SurfaceControl leash = mLeash;
        mLeash = null;
        mLeash = null;
        final boolean scheduleAnim = removeLeash(t, mAnimatable, leash, destroyLeash);
        final boolean scheduleAnim = removeLeash(t, mAnimatable, leash, destroyLeash);
        mAnimationFinished = false;
        if (scheduleAnim) {
        if (scheduleAnim) {
            mService.scheduleAnimationLocked();
            mService.scheduleAnimationLocked();
        }
        }