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

Commit 4cfea695 authored by Winson's avatar Winson
Browse files

Fixing crash in Recents

- The change to setTasks() was causing us to queue items to be loaded 
  before the activity had even started.  This change ensures that we
  don’t do this for the dummy-transition-only stack view, and only when
  setting stack tasks for real.

Bug: 27538945
Change-Id: I4ff0413cb2fb961a4dedcad42471293bab4f955a
parent 29d6b9f0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -645,7 +645,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        if (stack != null) {
            stackLayout.initialize(taskStackBounds,
                    TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
            mDummyStackView.setTasks(stack, false /* notifyStackChanges */);
            mDummyStackView.setTasks(stack, false /* notifyStackChanges */,
                    false /* relayoutTaskStack */);
        }
        Rect taskViewBounds = stackLayout.getUntransformedTaskViewBounds();
        if (!taskViewBounds.equals(mLastTaskViewBounds)) {
+2 −1
Original line number Diff line number Diff line
@@ -184,7 +184,8 @@ public class RecentsView extends FrameLayout {

        // Update the stack
        mTaskStackView.onResume(isResumingFromVisible);
        mTaskStackView.setTasks(stack, isResumingFromVisible /* notifyStackChanges */);
        mTaskStackView.setTasks(stack, isResumingFromVisible /* notifyStackChanges */,
                true /* relayoutTaskStack */);

        if (isResumingFromVisible) {
            // If we are already visible, then restore the background scrim
+12 −9
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    /**
     * Sets the stack tasks of this TaskStackView from the given TaskStack.
     */
    public void setTasks(TaskStack stack, boolean notifyStackChanges) {
    public void setTasks(TaskStack stack, boolean notifyStackChanges, boolean relayoutTaskStack) {
        boolean isInitialized = mLayoutAlgorithm.isInitialized();
        mStack.setTasks(getContext(), stack.computeAllTasksList(),
                notifyStackChanges && isInitialized);
@@ -307,10 +307,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
            // measure/layout pass
            updateLayoutAlgorithm(false /* boundScroll */, EMPTY_TASK_SET);
            updateToInitialState();

            if (relayoutTaskStack) {
                relayoutTaskViews(AnimationProps.IMMEDIATE);

            // Rebind all the task views.  This will not trigger new resources to be loaded unless
            // they have actually changed
                // 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++) {
@@ -319,6 +321,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                }
            }
        }
    }

    /** Returns the task stack. */
    public TaskStack getStack() {