Only return true in getPageScrolls if it actually changes
- This fixes unwanted setCurrentPage in PagedView.onLayout which is based on whether getPageScrolls return true, which cause RecentsView to scroll unnecessarily
Fixes: 186092823
Test: Manual
Change-Id: Ifa5d3b2918cc1876ac15834ce72b88ffc377f114
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index e4fa1aa..a6c934b 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -3141,8 +3141,8 @@
@Override
protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
ComputePageScrollsLogic scrollLogic) {
- boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
- scrollLogic);
+ int[] newPageScrolls = new int[outPageScrolls.length];
+ super.getPageScrolls(newPageScrolls, layoutChildren, scrollLogic);
boolean showAsFullscreen = showAsFullscreen();
boolean showAsGrid = showAsGrid();
@@ -3154,6 +3154,7 @@
mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
}
+ boolean pageScrollChanged = false;
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
@@ -3165,9 +3166,10 @@
showAsGrid);
}
- if (scrollDiff != 0) {
- outPageScrolls[i] += scrollDiff;
+ final int pageScroll = newPageScrolls[i] + (int) scrollDiff;
+ if (outPageScrolls[i] != pageScroll) {
pageScrollChanged = true;
+ outPageScrolls[i] = pageScroll;
}
}
return pageScrollChanged;