Merge "Only call setCurrentPage in applyLoadPlan if mCurrentPage is outdated" into sc-dev am: 464fc41df7

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15742147

Change-Id: I554eb8ef08418a955baa6a0f8da890b05c3115a0
This commit is contained in:
Alex Chau
2021-09-07 17:43:56 +00:00
committed by Automerger Merge Worker

View File

@@ -1146,20 +1146,24 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} }
updateTaskSize(); updateTaskSize();
int targetPage = -1;
if (mNextPage == INVALID_PAGE) { if (mNextPage == INVALID_PAGE) {
// Set the current page to the running task, but not if settling on new task. // Set the current page to the running task, but not if settling on new task.
TaskView runningTaskView = getRunningTaskView(); TaskView runningTaskView = getRunningTaskView();
if (runningTaskView != null) { if (runningTaskView != null) {
setCurrentPage(indexOfChild(runningTaskView)); targetPage = indexOfChild(runningTaskView);
} else if (getTaskViewCount() > 0) { } else if (getTaskViewCount() > 0) {
setCurrentPage(indexOfChild(getTaskViewAt(0))); targetPage = indexOfChild(getTaskViewAt(0));
} }
} else if (currentTaskId != -1) { } else if (currentTaskId != -1) {
currentTaskView = getTaskView(currentTaskId); currentTaskView = getTaskView(currentTaskId);
if (currentTaskView != null) { if (currentTaskView != null) {
setCurrentPage(indexOfChild(currentTaskView)); targetPage = indexOfChild(currentTaskView);
} }
} }
if (targetPage != -1 && mCurrentPage != targetPage) {
setCurrentPage(targetPage);
}
if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreResetTaskView) { if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreResetTaskView) {
// If the taskView mapping is changing, do not preserve the visuals. Since we are // If the taskView mapping is changing, do not preserve the visuals. Since we are