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

Commit 4333694d authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Fixing screenshot regression from ag/879131.

- We were not poking existing TaskViews from updating after their tasks
  have been updated (ie. with a new screenshot)

Change-Id: I33916aecf004afdb88a2462e69437ad1d9e8017d
parent 4e7ad35b
Loading
Loading
Loading
Loading
+30 −11
Original line number Diff line number Diff line
@@ -307,7 +307,16 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
            // measure/layout pass
            updateLayoutAlgorithm(false /* boundScroll */, EMPTY_TASK_SET);
            updateToInitialState();
            relayoutTaskViewsOnNextFrame(AnimationProps.IMMEDIATE);
            relayoutTaskViews(AnimationProps.IMMEDIATE);

            // Rebind all the task views.  This will not trigger new resources to be loaded unless
            // they have actually changed
            List<TaskView> taskViews = getTaskViews();
            int taskViewCount = taskViews.size();
            for (int i = 0; i < taskViewCount; i++) {
                TaskView tv = taskViews.get(i);
                bindTaskView(tv, tv.getTask());
            }
        }
    }

@@ -640,9 +649,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        List<TaskView> taskViews = getTaskViews();
        int taskViewCount = taskViews.size();
        for (int i = 0; i < taskViewCount; i++) {
            final TaskView tv = taskViews.get(i);
            final int taskIndex = mStack.indexOfStackTask(tv.getTask());
            final TaskViewTransform transform = mCurrentTaskTransforms.get(taskIndex);
            TaskView tv = taskViews.get(i);
            int taskIndex = mStack.indexOfStackTask(tv.getTask());
            TaskViewTransform transform = mCurrentTaskTransforms.get(taskIndex);

            if (ignoreTasksSet.contains(tv.getTask().key)) {
                continue;
@@ -1430,8 +1439,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    public void onReturnViewToPool(TaskView tv) {
        final Task task = tv.getTask();

        // Report that this task's data is no longer being used
        Recents.getTaskLoader().unloadTaskData(task);
        // Unbind the task from the task view
        unbindTaskView(tv, task);

        // Reset the view properties and view state
        tv.resetViewProperties();
@@ -1476,11 +1485,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        // Update the task views list after adding the new task view
        updateTaskViewsList();

        // Rebind the task and request that this task's data be filled into the TaskView
        tv.onTaskBound(task);

        // Load the task data
        Recents.getTaskLoader().loadTaskData(task, true /* fetchAndInvalidateThumbnails */);
        // Bind the task view to the new task
        bindTaskView(tv, task);

        // If the doze trigger has already fired, then update the state for this task view
        if (mUIDozeTrigger.isAsleep()) {
@@ -1512,6 +1518,19 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        return (tv.getTask() == preferredData);
    }

    private void bindTaskView(TaskView tv, Task task) {
        // Rebind the task and request that this task's data be filled into the TaskView
        tv.onTaskBound(task);

        // Load the task data
        Recents.getTaskLoader().loadTaskData(task, true /* fetchAndInvalidateThumbnails */);
    }

    private void unbindTaskView(TaskView tv, Task task) {
        // Report that this task's data is no longer being used
        Recents.getTaskLoader().unloadTaskData(task);
    }

    /**** TaskViewCallbacks Implementation ****/

    @Override