Restore previous currentPage in applyLoadPlan in case task is re-ordered

Fix: 186537288
Test: Repeatededly launch task from home and swipe to home, animation is correct
Test: Quick switch, launch task then swipe up, there is no jump
Change-Id: I9fd7416d9811ce4e54a1c6d20374d89d00417cd5
This commit is contained in:
Alex Chau 2021-07-01 16:34:58 +01:00
parent 9bb83f65cb
commit e0fcee01b3
1 changed files with 11 additions and 0 deletions

View File

@ -1087,6 +1087,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
return;
}
int currentTaskId = -1;
TaskView currentTaskView = getTaskViewAtByAbsoluteIndex(mCurrentPage);
if (currentTaskView != null) {
currentTaskId = currentTaskView.getTask().key.id;
}
// Unload existing visible task data
unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
@ -1126,6 +1132,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} else if (getTaskViewCount() > 0) {
setCurrentPage(indexOfChild(getTaskViewAt(0)));
}
} else if (currentTaskId != -1) {
currentTaskView = getTaskView(currentTaskId);
if (currentTaskView != null) {
setCurrentPage(indexOfChild(currentTaskView));
}
}
if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreResetTaskView) {