Only call setCurrentPage in applyLoadPlan if mCurrentPage is outdated

- Apply the same for all 3 setCurrentPage cases as they can all causes page jumping

Bug: 197493120
Test: manual
Change-Id: I5f7013ce3ce4d6fe84c67123618c3bebeeffc43a
This commit is contained in:
Alex Chau
2021-09-01 18:43:40 +01:00
parent f0b8ef9dfd
commit 06c7d0cb56
@@ -1357,22 +1357,23 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
}
int targetPage = -1;
if (mNextPage == INVALID_PAGE) {
// Set the current page to the running task, but not if settling on new task.
if (runningTaskId != -1) {
setCurrentPage(indexOfChild(newRunningTaskView));
targetPage = indexOfChild(newRunningTaskView);
} else if (getTaskViewCount() > 0) {
setCurrentPage(indexOfChild(getTaskViewAt(0)));
targetPage = indexOfChild(getTaskViewAt(0));
}
} else if (currentTaskId != -1) {
currentTaskView = getTaskViewByTaskId(currentTaskId);
if (currentTaskView != null) {
int currentTaskViewIndex = indexOfChild(currentTaskView);
if (mCurrentPage != currentTaskViewIndex) {
setCurrentPage(currentTaskViewIndex);
}
targetPage = indexOfChild(currentTaskView);
}
}
if (targetPage != -1 && mCurrentPage != targetPage) {
setCurrentPage(targetPage);
}
if (mIgnoreResetTaskId != -1 &&
getTaskViewByTaskId(mIgnoreResetTaskId) != ignoreResetTaskView) {