From f6e31b1d219374fdf8e036988075cd0c7ec4daaa Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Wed, 27 Oct 2021 12:04:28 +0100 Subject: [PATCH] Fix overview scroll triggering haptics on swipe up gesture Add an extra check to the PagedView, before triggering the haptic callback, to avoid triggering this when the scroll happens outside an actual scroll action (e.g. some setter methods that update the scroll state). This was triggered on some calls to setCurrentPage, that was snapping the current scrolled page and triggering the View.onScrollChanged method. Fix: 201237536 Test: manual Change-Id: I9b29981dba408493c78873aea42d8615ea7573a0 Merged-In: I9b29981dba408493c78873aea42d8615ea7573a0 (cherry picked from commit bff03e2d0fa1186c0ef58f6cf643fffb5054e53e) --- src/com/android/launcher3/PagedView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 523ac726f9..cefadf7941 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1721,6 +1721,10 @@ public abstract class PagedView extends ViewGrou @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { + if (mScroller.isFinished()) { + // This was not caused by the scroller, skip it. + return; + } int newDestinationPage = getDestinationPage(); if (newDestinationPage >= 0 && newDestinationPage != mCurrentScrollOverPage) { mCurrentScrollOverPage = newDestinationPage;