Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51b2453e authored by Tony Wickham's avatar Tony Wickham
Browse files

End any running taskbar animation in cleanup()

Test: Open an app, swipe to home and remove taskbar during animation,
ensure no crash
Fixes: 182163822

Change-Id: Ie92b4fdf03a23c8a205d1d7327a304cf1d996383
parent 1f4a3414
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class TaskbarController {
    // Contains all loaded Hotseat items.
    private ItemInfo[] mLatestLoadedHotseatItems;

    private @Nullable Animator mAnimator;
    private boolean mIsAnimatingToLauncher;

    public TaskbarController(BaseQuickstepLauncher launcher,
@@ -245,6 +246,10 @@ public class TaskbarController {
        mTaskbarVisibilityController.cleanup();
        mHotseatController.cleanup();
        mRecentsController.cleanup();

        if (mAnimator != null) {
            mAnimator.end();
        }
    }

    private void removeFromWindowManager() {
@@ -287,13 +292,21 @@ public class TaskbarController {
     */
    public void onLauncherResumedOrPaused(boolean isResumed) {
        long duration = QuickstepAppTransitionManagerImpl.CONTENT_ALPHA_DURATION;
        final Animator anim;
        if (mAnimator != null) {
            mAnimator.cancel();
        }
        if (isResumed) {
            anim = createAnimToLauncher(null, duration);
            mAnimator = createAnimToLauncher(null, duration);
        } else {
            anim = createAnimToApp(duration);
            mAnimator = createAnimToApp(duration);
        }
        anim.start();
        mAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mAnimator = null;
            }
        });
        mAnimator.start();
    }

    /**