Remove redundant posting of the crossfade to the main executor

Now that the SyncTransactionQueue calls back on the main thread,
it is not necessary to move the crossfade animation to the main
thread again.

Bug: 171393374
Test: Enter PIP, resize, crossfade works
Change-Id: I4022733921f4655220a5c9ae186bf10a1838f59a
This commit is contained in:
jorgegil@google.com
2021-04-01 13:43:14 -07:00
parent b5cc4a537b
commit 04b163370b

View File

@@ -968,28 +968,26 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
destinationBounds.height());
mSurfaceTransactionHelper.scale(t, snapshotSurface, snapshotSrc, snapshotDest);
mMainExecutor.execute(() -> {
// Start animation to fade out the snapshot.
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
animator.setDuration(mEnterAnimationDuration);
animator.addUpdateListener(animation -> {
final float alpha = (float) animation.getAnimatedValue();
final SurfaceControl.Transaction transaction =
mSurfaceControlTransactionFactory.getTransaction();
transaction.setAlpha(snapshotSurface, alpha);
transaction.apply();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
final SurfaceControl.Transaction tx =
mSurfaceControlTransactionFactory.getTransaction();
tx.remove(snapshotSurface);
tx.apply();
}
});
animator.start();
// Start animation to fade out the snapshot.
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
animator.setDuration(mEnterAnimationDuration);
animator.addUpdateListener(animation -> {
final float alpha = (float) animation.getAnimatedValue();
final SurfaceControl.Transaction transaction =
mSurfaceControlTransactionFactory.getTransaction();
transaction.setAlpha(snapshotSurface, alpha);
transaction.apply();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
final SurfaceControl.Transaction tx =
mSurfaceControlTransactionFactory.getTransaction();
tx.remove(snapshotSurface);
tx.apply();
}
});
animator.start();
});
} else {
applyFinishBoundsResize(wct, direction);