Allow snapping to focused task in overview grid
Fix: 208644826
Test: manual
Change-Id: Ia6fb2ae44209042f6d40bf8db5d1f43b3b6a27ee
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index d855d5b..3117450 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1264,7 +1264,7 @@
@Override
protected void onNotSnappingToPageInFreeScroll() {
int finalPos = mScroller.getFinalX();
- if (!showAsGrid() && finalPos > mMinScroll && finalPos < mMaxScroll) {
+ if (finalPos > mMinScroll && finalPos < mMaxScroll) {
int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
@@ -1278,6 +1278,16 @@
? mMaxScroll
: getScrollForPage(mNextPage);
+ if (showAsGrid()) {
+ TaskView taskView = getTaskViewAt(mNextPage);
+ // Only snap to fully visible focused task.
+ if (taskView == null
+ || !taskView.isFocusedTask()
+ || !isTaskViewFullyVisible(taskView)) {
+ return;
+ }
+ }
+
mScroller.setFinalX(pageSnapped);
// Ensure the scroll/snap doesn't happen too fast;
int extraScrollDuration = OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION