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

Commit 513bde42 authored by Evan Rosky's avatar Evan Rosky
Browse files

Fix issues with early-finish

There were a couple of situations where both cancel and finish
collided. In those cases make sure only one is called.

Somewhat related, launcher actually continues to use leashes
even after calling the finishCallback. Since we make leashes
for launcher anyways, just use launcher's existing leash
clean-up logic.

Bug: 235616350
Test: run/monitor wm presubmits.
      Try launching and closing apps in rapid succession.
Change-Id: I7553ba9f9bbad052632a4d8d5a7225ab6c3dbce5
parent 0d61ab9e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -866,13 +866,19 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
            });
        };
        va.addListener(new AnimatorListenerAdapter() {
            private boolean mFinished = false;

            @Override
            public void onAnimationEnd(Animator animation) {
                if (mFinished) return;
                mFinished = true;
                finisher.run();
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                if (mFinished) return;
                mFinished = true;
                finisher.run();
            }
        });
+3 −3
Original line number Diff line number Diff line
@@ -220,9 +220,9 @@ public class RemoteAnimationAdapterCompat {
                        for (int i = info.getChanges().size() - 1; i >= 0; --i) {
                            info.getChanges().get(i).getLeash().release();
                        }
                        for (int i = leashMap.size() - 1; i >= 0; --i) {
                            leashMap.valueAt(i).release();
                        }
                        // Don't release here since launcher might still be using them. Instead
                        // let launcher release them (eg. via RemoteAnimationTargets)
                        leashMap.clear();
                        try {
                            finishCallback.onTransitionFinished(null /* wct */, finishTransaction);
                        } catch (RemoteException e) {