Proper fix for gesture nav flicker using runOnPageScrollsInitialized()

I root caused the two areas causing the flicker:
A. If page scrolls aren't initialized when we get onActivityInit(), the first scroll even after linkRecentsViewScroll() will jump based on min scroll (due to Clear all button). Fix is to defer linking until page scrolls are initialized.
B. If page scrolls aren't initialized when the gesture starts, RecentsView can jump to the min scroll when calling showCurrentTask(), since that calls setCurrentPage(getRunningTaskIndex()) which might be out of bounds. Fix is to defer that setCurrentPage() until page scrolls are initialized.

Test: open a random app that hasn't been opened in a while, touch down
on nav handle and see if RecentsView scrolls partially or fully
offscreen; repeat 20 times to be sure
Fixes: 233112195

Change-Id: I000960775f8735920d97c87942065a430c9dce0c
This commit is contained in:
Tony Wickham
2022-06-14 15:51:09 -07:00
parent b751033f30
commit bed0d636fe
3 changed files with 3 additions and 5 deletions

View File

@@ -1187,9 +1187,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
public int getScrollForPage(int index) {
// TODO(b/233112195): Use !pageScrollsInitialized() instead of mPageScrolls == null, once we
// root cause where we should be using runOnPageScrollsInitialized().
if (mPageScrolls == null || index >= mPageScrolls.length || index < 0) {
if (!pageScrollsInitialized() || index >= mPageScrolls.length || index < 0) {
return 0;
} else {
return mPageScrolls[index];