Merge "Fixing crash in Recents" into nyc-dev

This commit is contained in:
Winson Chung
2016-03-08 20:36:50 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 11 deletions

View File

@@ -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)) {

View File

@@ -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

View File

@@ -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,15 +307,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// measure/layout pass
updateLayoutAlgorithm(false /* boundScroll */, EMPTY_TASK_SET);
updateToInitialState();
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());
if (relayoutTaskStack) {
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());
}
}
}
}