From b147f6f4b7d7327d4a1287be30f01fc06b9eaf9b Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 25 Mar 2025 12:44:35 +0000 Subject: [PATCH] Snap to Large tile or first grid task when they are the next page. Fix: 398232493 Fix: 399622012 Test: Manual Flag: com.android.launcher3.enable_expressive_dismiss_task_motion Change-Id: I10cbd303b3e36059a41cb4ff7fdb4b4af7f93f23 --- .../quickstep/views/RecentsDismissUtils.kt | 25 ------------------- .../android/quickstep/views/RecentsView.java | 10 +++++--- 2 files changed, 6 insertions(+), 29 deletions(-) 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 3e4b953b5b..07d4044d26 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; } }