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
This commit is contained in:
Tracy Zhou
2024-09-07 11:15:30 -07:00
parent 4cfbf6b7e0
commit acea86234a
@@ -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));
}