From de210f4f64591e73f6820c0458f6cbc50af3b564 Mon Sep 17 00:00:00 2001 From: Jamie Garside Date: Thu, 12 Aug 2021 15:01:33 +0100 Subject: [PATCH] Add haptic feedback constants for rotary-input haptic events. These haptic patterns should be used when the rotary input on a device is being used to scroll views. One provides some texture to the scroll (e.g. light taps every few degrees), one provides a slightly heavier tap when passing an element in, say, a recyclerview, and the last provides a "thud" when getting to the end of a list. All hidden for now; this is mostly to reserve the constants that are being used by Wear. We can then expose these in a Compat library in the future. Test: Only new constants, no new functionality. Change-Id: Ic85c21d4cb79184c2e5aa4a9f12d91a13db14e85 --- .../android/view/HapticFeedbackConstants.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/java/android/view/HapticFeedbackConstants.java b/core/java/android/view/HapticFeedbackConstants.java index 9f63500fc8535..ec613edeedb4c 100644 --- a/core/java/android/view/HapticFeedbackConstants.java +++ b/core/java/android/view/HapticFeedbackConstants.java @@ -121,6 +121,29 @@ public class HapticFeedbackConstants { */ public static final int REJECT = 17; + /** + * A haptic effect to provide texture while a rotary input device is being scrolled. + * + * @hide + */ + public static final int ROTARY_SCROLL_TICK = 18; + + /** + * A haptic effect to signal that a list element has been focused while scrolling using a rotary + * input device. + * + * @hide + */ + public static final int ROTARY_SCROLL_ITEM_FOCUS = 19; + + /** + * A haptic effect to signal reaching the scrolling limits of a list while scrolling using a + * rotary input device. + * + * @hide + */ + public static final int ROTARY_SCROLL_LIMIT = 20; + /** * The phone has booted with safe mode enabled. * This is a private constant. Feel free to renumber as desired.