From 0e25d2eba84c9691471fc3899c6f19958e90793c Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 1 Jun 2021 22:07:22 +0000 Subject: [PATCH] Revert "Add haptic feedback to Launcher recent apps scrolling" This reverts commit b1ef5e5c55ee4e86124afb554fc48a1cd8791ea4. Reason for revert: b/182382085#comment4 Change-Id: I001944da64dc05324b14cc9dd3db5921faf8806c Bug: 182382085 --- .../android/quickstep/views/RecentsView.java | 22 -------------- src/com/android/launcher3/PagedView.java | 9 ------ .../launcher3/util/VibratorWrapper.java | 29 ------------------- 3 files changed, 60 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 197fc9c168..376cb31a90 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -76,7 +76,6 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.UserHandle; -import android.os.VibrationEffect; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -133,7 +132,6 @@ import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; import com.android.launcher3.util.Themes; import com.android.launcher3.util.TranslateEdgeEffect; -import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.ViewPool; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.BaseActivityInterface; @@ -344,17 +342,6 @@ public abstract class RecentsView mSizeStrategy; protected RecentsAnimationController mRecentsAnimationController; @@ -973,8 +960,6 @@ public abstract class RecentsView extends ViewGrou if (newPos < mMinScroll && oldPos >= mMinScroll) { mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity()); mScroller.abortAnimation(); - onEdgeAbsorbingScroll(); } else if (newPos > mMaxScroll && oldPos <= mMaxScroll) { mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity()); mScroller.abortAnimation(); - onEdgeAbsorbingScroll(); } } @@ -1334,13 +1332,6 @@ public abstract class PagedView extends ViewGrou protected void onNotSnappingToPageInFreeScroll() { } - /** - * Called when the view edges absorb part of the scroll. Subclasses can override this - * to provide custom behavior during animation. - */ - protected void onEdgeAbsorbingScroll() { - } - protected boolean shouldFlingForVelocity(int velocity) { float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity; return Math.abs(velocity) > threshold; diff --git a/src/com/android/launcher3/util/VibratorWrapper.java b/src/com/android/launcher3/util/VibratorWrapper.java index 14bf6c2035..b0defd445a 100644 --- a/src/com/android/launcher3/util/VibratorWrapper.java +++ b/src/com/android/launcher3/util/VibratorWrapper.java @@ -21,19 +21,15 @@ import static android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; -import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; -import android.media.AudioAttributes; import android.os.Build; import android.os.VibrationEffect; import android.os.Vibrator; import android.provider.Settings; -import com.android.launcher3.Utilities; - /** * Wrapper around {@link Vibrator} to easily perform haptic feedback where necessary. */ @@ -43,11 +39,6 @@ public class VibratorWrapper { public static final MainThreadInitializedObject INSTANCE = new MainThreadInitializedObject<>(VibratorWrapper::new); - public static final AudioAttributes VIBRATION_ATTRS = new AudioAttributes.Builder() - .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) - .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) - .build(); - public static final VibrationEffect EFFECT_CLICK = createPredefined(VibrationEffect.EFFECT_CLICK); @@ -90,24 +81,4 @@ public class VibratorWrapper { UI_HELPER_EXECUTOR.execute(() -> mVibrator.vibrate(vibrationEffect)); } } - - /** - * Vibrates with a single primitive, if supported, or use a fallback effect instead. This only - * vibrates if haptic feedback is available and enabled. - */ - @SuppressLint("NewApi") - public void vibrate(int primitiveId, float primitiveScale, VibrationEffect fallbackEffect) { - if (mHasVibrator && mIsHapticFeedbackEnabled) { - UI_HELPER_EXECUTOR.execute(() -> { - if (Utilities.ATLEAST_R && primitiveId >= 0 - && mVibrator.areAllPrimitivesSupported(primitiveId)) { - mVibrator.vibrate(VibrationEffect.startComposition() - .addPrimitive(primitiveId, primitiveScale) - .compose(), VIBRATION_ATTRS); - } else { - mVibrator.vibrate(fallbackEffect, VIBRATION_ATTRS); - } - }); - } - } }