From 57c77eb4c6eec94e521847455617c82a528c029a Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 13 Sep 2024 14:56:28 -0700 Subject: [PATCH] Allow haptics to play when fastscrolling private space apps. LinearSmoothScrolling only happens when there is a new section to scroll to. Instead of playing haptics when sectionInfo changes, only play haptics during smooth scrolling. bug: 359658099 Test: Manually tested, video wouldn't help since I am testing haptics Flag: NONE bugfix Change-Id: I96c911b4d2d201d0d953a9619a97979759a02427 --- .../android/launcher3/allapps/AllAppsFastScrollHelper.java | 3 +++ .../android/launcher3/views/RecyclerViewFastScroller.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java b/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java index 911612ff19..77a0fe331d 100644 --- a/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java +++ b/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.allapps; +import static android.view.HapticFeedbackConstants.CLOCK_TICK; + import androidx.recyclerview.widget.LinearSmoothScroller; import androidx.recyclerview.widget.RecyclerView.ViewHolder; @@ -71,6 +73,7 @@ public class AllAppsFastScrollHelper { @Override protected int getVerticalSnapPreference() { + mRv.performHapticFeedback(CLOCK_TICK); return SNAP_TO_ANY; } diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java index 63648dd348..6fd18beb1c 100644 --- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java +++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java @@ -355,7 +355,10 @@ public class RecyclerViewFastScroller extends View { if (!sectionName.equals(mPopupSectionName)) { mPopupSectionName = sectionName; mPopupView.setText(sectionName); - performHapticFeedback(CLOCK_TICK); + // AllApps haptics are taken care of by AllAppsFastScrollHelper. + if (mFastScrollerLocation != ALL_APPS_SCROLLER) { + performHapticFeedback(CLOCK_TICK); + } } animatePopupVisibility(!TextUtils.isEmpty(sectionName)); mLastTouchY = boundedY;