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

Commit 381920f0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Skip operation on content overlay if task's vanished" into sc-v2-dev...

Merge "Skip operation on content overlay if task's vanished" into sc-v2-dev am: 8dbc9003 am: b401cf51

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

Change-Id: I6729fb6cb3e29c0ce9d6f9f9d2f984c2b08e620d
parents a8b2f419 b401cf51
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -1377,11 +1377,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
        animator.setDuration(mCrossFadeAnimationDuration);
        animator.addUpdateListener(animation -> {
            if (mPipTransitionState.getTransitionState() == PipTransitionState.UNDEFINED) {
                // Could happen if onTaskVanished happens during the animation since we may have
                // set a start delay on this animation.
                Log.d(TAG, "Task vanished, skip fadeOutAndRemoveOverlay");
                animation.removeAllListeners();
                animation.removeAllUpdateListeners();
                animation.cancel();
            } else {
                final float alpha = (float) animation.getAnimatedValue();
                final SurfaceControl.Transaction transaction =
                        mSurfaceControlTransactionFactory.getTransaction();
                transaction.setAlpha(surface, alpha);
                transaction.apply();
            }
        });
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
@@ -1394,6 +1403,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
    }

    private void removeContentOverlay(SurfaceControl surface, Runnable callback) {
        if (mPipTransitionState.getTransitionState() == PipTransitionState.UNDEFINED) {
            // Avoid double removal, which is fatal.
            return;
        }
        final SurfaceControl.Transaction tx =
                mSurfaceControlTransactionFactory.getTransaction();
        tx.remove(surface);