From 04b163370ba700652ecf93abe3fc877c37808b1f Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" Date: Thu, 1 Apr 2021 13:43:14 -0700 Subject: [PATCH] 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 --- .../wm/shell/pip/PipTaskOrganizer.java | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index ffa821daf7f81..54e6492619880 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -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);