diff --git a/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt b/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt index 6acaeae8db..31edd65377 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt +++ b/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt @@ -472,31 +472,6 @@ class RecentsDismissUtils(private val recentsView: RecentsView<*, *>) { } private fun getDismissedTaskGapForReflow(dismissedTaskView: TaskView): Float { - val screenStart = recentsView.pagedOrientationHandler.getPrimaryScroll(recentsView) - val screenEnd = - screenStart + recentsView.pagedOrientationHandler.getMeasuredSize(recentsView) - val taskStart = - recentsView.pagedOrientationHandler.getChildStart(dismissedTaskView) + - dismissedTaskView.getOffsetAdjustment(recentsView.showAsGrid()) - val taskSize = - recentsView.pagedOrientationHandler.getMeasuredSize(dismissedTaskView) * - dismissedTaskView.getSizeAdjustment(recentsView.showAsFullscreen()) - val taskEnd = taskStart + taskSize - - val isDismissedTaskBeyondEndOfScreen = - if (recentsView.isRtl) taskEnd > screenEnd else taskStart < screenStart - if ( - dismissedTaskView.isLargeTile && - isDismissedTaskBeyondEndOfScreen && - recentsView.mUtils.getLargeTileCount() == 1 - ) { - return with(recentsView) { - pagedOrientationHandler.getPrimaryScroll(this) - - getScrollForPage(indexOfChild(mUtils.getFirstNonDesktopTaskView())) - } - .toFloat() - } - // If current page is beyond last TaskView's index, use last TaskView to calculate offset. val lastTaskViewIndex = recentsView.indexOfChild(recentsView.mUtils.getLastTaskView()) val currentPage = recentsView.currentPage.coerceAtMost(lastTaskViewIndex) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 53b1301f8f..9f916cb685 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1825,11 +1825,13 @@ public abstract class RecentsView< return; } TaskView taskView = getTaskViewAt(mNextPage); - boolean shouldSnapToLargeTask = taskView != null && taskView.isLargeTile() - && !mUtils.isAnySmallTaskFullyVisible(); + boolean shouldSnapToLargeTask = taskView != null && taskView.isLargeTile(); + boolean shouldSnapToSmallTask = enableGridOnlyOverview() && taskView != null + && taskView == mUtils.getFirstSmallTaskView(); boolean shouldSnapToClearAll = mNextPage == indexOfChild(mClearAllButton); - // Snap to large tile when grid tasks aren't fully visible or the clear all button. - if (!shouldSnapToLargeTask && !shouldSnapToClearAll) { + boolean shouldSnap = + shouldSnapToLargeTask || shouldSnapToClearAll || shouldSnapToSmallTask; + if (!shouldSnap) { return; } }