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

Commit 8c983e8d authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "Fix CUJ_LAUNCHER_APP_CLOSE_TO_HOME Cuj for predictive back to home" into main

parents ada4e166 93af1db6
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -1644,7 +1644,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
    }

    private void addCujInstrumentation(Animator anim, int cuj) {
        anim.addListener(new AnimationSuccessListener() {
        anim.addListener(getCujAnimationSuccessListener(cuj));
    }

    private void addCujInstrumentation(RectFSpringAnim anim, int cuj) {
        anim.addAnimatorListener(getCujAnimationSuccessListener(cuj));
    }

    private AnimationSuccessListener getCujAnimationSuccessListener(int cuj) {
        return new AnimationSuccessListener() {
            @Override
            public void onAnimationStart(Animator animation) {
                mDragLayer.getViewTreeObserver().addOnDrawListener(
@@ -1678,7 +1686,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            public void onAnimationSuccess(Animator animator) {
                InteractionJankMonitorWrapper.end(cuj);
            }
        });
        };
    }

    /**
@@ -1759,10 +1767,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        // invisibility on touch down, and only reset it after the animation to home
        // is initialized.
        if (launcherIsForceInvisibleOrOpening || fromPredictiveBack) {
            addCujInstrumentation(anim, playFallBackAnimation
                    ? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
                    : Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);

            AnimatorListenerAdapter endListener = new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
@@ -1772,6 +1776,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                }
            };

            if (rectFSpringAnim != null && anim.getChildAnimations().isEmpty()) {
                addCujInstrumentation(rectFSpringAnim, Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
            } else {
                addCujInstrumentation(anim, playFallBackAnimation
                        ? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
                        : Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
            }

            if (fromPredictiveBack && rectFSpringAnim != null) {
                rectFSpringAnim.addAnimatorListener(endListener);
            } else {