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

Commit afd0d81a authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix some issues with taskbar

- Update Hotseat items in init() to ensure they are reloaded
- Don't update Recent items if we get the new tasks after cleanup()

Test: Fold and unfold, ensure Taskbar disappears/reappears without
crashing

Bug: 171917176
Change-Id: I1c2ae1022ae56cddece655b22db187684f691bf8
parent 73821a9c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class TaskbarHotseatController {

    protected void init() {
        mLauncher.getDragController().addDragListener(mDragListener);
        onHotseatUpdated();
    }

    protected void cleanup() {
+7 −1
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ public class TaskbarRecentsController {
    // The current background requests to load the task icons
    private CancellableTask[] mIconLoadRequests = new CancellableTask[mNumRecentIcons];

    private boolean mIsAlive;

    public TaskbarRecentsController(BaseQuickstepLauncher launcher,
            TaskbarController.TaskbarRecentsControllerCallbacks taskbarCallbacks) {
        mLauncher = launcher;
@@ -58,11 +60,13 @@ public class TaskbarRecentsController {
    }

    protected void init() {
        mIsAlive = true;
        TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackChangeListener);
        reloadRecentTasksIfNeeded();
    }

    protected void cleanup() {
        mIsAlive = false;
        TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
                mTaskStackChangeListener);
        cancelAllPendingIconLoadTasks();
@@ -84,8 +88,10 @@ public class TaskbarRecentsController {
    }

    private void onRecentTasksChanged(ArrayList<Task> tasks) {
        if (mIsAlive) {
            mTaskbarCallbacks.updateRecentItems(tasks);
        }
    }

    /**
     * For each Task, loads its icon from the cache in the background, then calls