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

Commit a7c931dd authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes I29dab94f,Ie13db509 into ub-launcher3-master

* changes:
  Fix issue with out of order callbacks
  Skip setting end target if the recents animation was canceled or ended
parents 9c0ac6b2 b53573d6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -917,6 +917,12 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity>
            windowAnim.addAnimatorListener(new AnimationSuccessListener() {
                @Override
                public void onAnimationSuccess(Animator animator) {
                    if (mRecentsAnimationController == null) {
                        // If the recents animation is interrupted, we still end the running
                        // animation (not canceled) so this is still called. In that case, we can
                        // skip doing any future work here for the current gesture.
                        return;
                    }
                    // Finalize the state and notify of the change
                    mGestureState.setState(STATE_END_TARGET_ANIMATION_FINISHED);
                }
@@ -938,6 +944,12 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity>
            windowAnim.addListener(new AnimationSuccessListener() {
                @Override
                public void onAnimationSuccess(Animator animator) {
                    if (mRecentsAnimationController == null) {
                        // If the recents animation is interrupted, we still end the running
                        // animation (not canceled) so this is still called. In that case, we can
                        // skip doing any future work here for the current gesture.
                        return;
                    }
                    if (target == NEW_TASK && mRecentsView != null
                            && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) {
                        // We are about to launch the current running task, so use LAST_TASK state
+6 −0
Original line number Diff line number Diff line
@@ -62,6 +62,12 @@ public class RecentsAnimationCallbacks implements
        mListeners.remove(listener);
    }

    @UiThread
    public void removeAllListeners() {
        Preconditions.assertUIThread();
        mListeners.clear();
    }

    public void notifyAnimationCanceled() {
        mCancelled = true;
        onAnimationCanceled(null);
+3 −3
Original line number Diff line number Diff line
@@ -156,9 +156,9 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
            mTargets.release();
        }

        // Remove gesture state from callbacks
        if (mCallbacks != null && mLastGestureState != null) {
            mCallbacks.removeListener(mLastGestureState);
        // Clean up all listeners to ensure we don't get subsequent callbacks
        if (mCallbacks != null) {
            mCallbacks.removeAllListeners();
        }

        mController = null;