From 06dbdcea4eab1d50270a3c548f6f30deeb029b76 Mon Sep 17 00:00:00 2001 From: Jordan Silva Date: Fri, 4 Oct 2024 07:28:09 +0000 Subject: [PATCH] Fix a bug where the last large task index was not being set correctly. This was causing the focused task shift to be calculated incorrectly, which was resulting in the focused task being shifted too far to the left. Bug: 330342294 Fix: 371490320 Flag: com.android.launcher3.enable_large_desktop_windowing_tile Test: Manual. Open 1 DesktopTask, 1 FocusedTask, 2 other tasks in the grid. Dismiss the focused task. The rebalance should work keeping the new focused task next to desktop task. Change-Id: If6f95814942c2cbadc30a0082649569f21dea60a --- quickstep/src/com/android/quickstep/views/RecentsView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 8b3ef04f8e..069cbd8933 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3141,7 +3141,9 @@ public abstract class RecentsView< // Horizontal grid translation for each task float[] gridTranslations = new float[taskCount]; - int lastLargeTaskIndex = Integer.MAX_VALUE; + TaskView lastLargeTaskView = mUtils.getLastLargeTaskView(getTaskViews()); + int lastLargeTaskIndex = + (lastLargeTaskView == null) ? Integer.MAX_VALUE : indexOfChild(lastLargeTaskView); Set largeTasksIndices = new HashSet<>(); int focusedTaskShift = 0; int largeTaskWidthAndSpacing = 0; @@ -3177,7 +3179,6 @@ public abstract class RecentsView< taskView.setGridTranslationY((mLastComputedTaskSize.height() + taskTopMargin - taskView.getLayoutParams().height) / 2f); - lastLargeTaskIndex = i; largeTasksIndices.add(i); largeTaskWidthAndSpacing = taskWidthAndSpacing;