Fixing crash when starting transparent activities

StateManager was setting the transition lenght to 0 when a workspace state transtion
was being created as part of launching a transparent activity.

Bug: 77635129
Change-Id: Ie9f40138d9b1387ba880bca0fbf130a4872e8733
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 73cff29..af81a59 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -149,11 +149,13 @@
                     @Override
                     public AnimatorSet getAnimator(RemoteAnimationTargetCompat[] targetCompats) {
                         AnimatorSet anim = new AnimatorSet();
-                        // Set the state animation first so that any state listeners are called
-                        // before our internal listeners.
-                        mLauncher.getStateManager().setCurrentAnimation(anim);
+
 
                         if (!composeRecentsLaunchAnimator(v, targetCompats, anim)) {
+                            // Set the state animation first so that any state listeners are called
+                            // before our internal listeners.
+                            mLauncher.getStateManager().setCurrentAnimation(anim);
+
                             anim.play(getIconAnimator(v));
                             if (launcherIsATargetWithMode(targetCompats, MODE_CLOSING)) {
                                 anim.play(getLauncherContentAnimator(false /* show */));
@@ -284,6 +286,11 @@
 
         target.play(getRecentsWindowAnimator(taskView, skipLauncherChanges, targets));
         target.play(launcherAnim);
+
+        // Set the current animation first, before adding windowAnimEndListener. Setting current
+        // animation adds some listeners which need to be called before windowAnimEndListener
+        // (the ordering of listeners matter in this case).
+        mLauncher.getStateManager().setCurrentAnimation(target);
         target.addListener(windowAnimEndListener);
         return true;
     }