From 91546d401d0d64d7b11e6223bb53be1550769549 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 13 Feb 2024 12:43:30 -0800 Subject: [PATCH] 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 --- .../android/launcher3/taskbar/TaskbarStashController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 7a69c556c0..747c9cb308 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -803,6 +803,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba 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() {