Do not add jank monitor for stash state change when the drag layer is not attached to the window

An alternative here is to use the root layer when NO_RECREATE flag is on. However, we do not have a reference to it here (shall we consider passing it in?)

Fixes: 325096498
Test: Need to verify
Change-Id: I1709bc88753a90547f7a61dc6e24cdaf489d19e0
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 7a69c55..747c9cb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -803,6 +803,11 @@
     private void addJankMonitorListener(
             AnimatorSet animator, boolean expanding, @StashAnimation int animationType) {
         View v = mControllers.taskbarActivityContext.getDragLayer();
+        if (!v.isAttachedToWindow()) {
+            // If the task bar drag layer is not attached to window, we don't need to monitor jank
+            // (actually we can't pass in an unattached view either).
+            return;
+        }
         int action = expanding ? InteractionJankMonitor.CUJ_TASKBAR_EXPAND :
                 InteractionJankMonitor.CUJ_TASKBAR_COLLAPSE;
         animator.addListener(new AnimatorListenerAdapter() {