From acea86234ad26e536357acd4a6eb906046161cc7 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sat, 7 Sep 2024 11:15:30 -0700 Subject: [PATCH] Cancel the stash animation if the stash controller is destroyed before then The TASKBAR_COLLAPSE CUJ is logged when folding the phone before it can't tell if it's folding or going to lockscreen unfolded before taskbar recreation flow kicks in. The animation never gets cancelled, reporting a CUJ that messes up the metrics Bug: 362713428 Test: manual Flag: EXEMPT bugfix Change-Id: I132ad28da982e08edba1909bf9e747a43dc11a84 --- .../android/launcher3/taskbar/TaskbarStashController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 60e65b34a2..21437f4154 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -1176,6 +1176,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Clean up on destroy from TaskbarControllers */ public void onDestroy() { + // If the controller is destroyed before the animation finishes, we cancel the animation + // so that we don't finish the CUJ. + if (mAnimator != null) { + mAnimator.cancel(); + mAnimator = null; + } UI_HELPER_EXECUTOR.execute( () -> mAccessibilityManager.unregisterSystemAction(SYSTEM_ACTION_ID_TASKBAR)); }