summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java13
-rw-r--r--services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java15
2 files changed, 8 insertions, 20 deletions
diff --git a/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java b/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java
index 006a5bb1d1d0..a235ba154579 100644
--- a/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java
+++ b/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java
@@ -148,8 +148,8 @@ public final class HapticFeedbackVibrationProvider {
case HapticFeedbackConstants.SCROLL_TICK:
case HapticFeedbackConstants.SCROLL_ITEM_FOCUS:
case HapticFeedbackConstants.SCROLL_LIMIT:
- attrs = hapticFeedbackInputSourceCustomizationEnabled() ? TOUCH_VIBRATION_ATTRIBUTES
- : HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES;
+ // TODO(b/372820923): use touch attributes by default.
+ attrs = HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES;
break;
case HapticFeedbackConstants.KEYBOARD_TAP:
case HapticFeedbackConstants.KEYBOARD_RELEASE:
@@ -176,14 +176,15 @@ public final class HapticFeedbackVibrationProvider {
int inputSource,
@HapticFeedbackConstants.Flags int flags,
@HapticFeedbackConstants.PrivateFlags int privFlags) {
- if (hapticFeedbackInputSourceCustomizationEnabled()
- && inputSource == InputDevice.SOURCE_ROTARY_ENCODER) {
+ if (hapticFeedbackInputSourceCustomizationEnabled()) {
switch (effectId) {
case HapticFeedbackConstants.SCROLL_TICK,
HapticFeedbackConstants.SCROLL_ITEM_FOCUS,
HapticFeedbackConstants.SCROLL_LIMIT -> {
- return getVibrationAttributesWithFlags(HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES,
- effectId, flags);
+ VibrationAttributes attrs = inputSource == InputDevice.SOURCE_ROTARY_ENCODER
+ ? HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES
+ : TOUCH_VIBRATION_ATTRIBUTES;
+ return getVibrationAttributesWithFlags(attrs, effectId, flags);
}
}
}
diff --git a/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java b/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java
index f7127df0ee33..3b2f532dddd7 100644
--- a/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java
+++ b/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java
@@ -453,20 +453,7 @@ public class HapticFeedbackVibrationProviderTest {
}
@Test
- public void testVibrationAttribute_scrollFeedback_inputCustomizedFlag_useTouchUsage() {
- mSetFlagsRule.enableFlags(FLAG_HAPTIC_FEEDBACK_INPUT_SOURCE_CUSTOMIZATION_ENABLED);
- HapticFeedbackVibrationProvider provider = createProviderWithoutCustomizations();
-
- for (int effectId : SCROLL_FEEDBACK_CONSTANTS) {
- VibrationAttributes attrs = provider.getVibrationAttributes(effectId, /* flags */
- 0, /* privFlags */ 0);
- assertWithMessage("Expected USAGE_TOUCH for scroll effect " + effectId
- + ", if no input customization").that(attrs.getUsage()).isEqualTo(USAGE_TOUCH);
- }
- }
-
- @Test
- public void testVibrationAttribute_scrollFeedback_noInputCustomizedFlag_useHardwareFeedback() {
+ public void testVibrationAttribute_scrollFeedback_useHardwareFeedback() {
HapticFeedbackVibrationProvider provider = createProviderWithoutCustomizations();
for (int effectId : SCROLL_FEEDBACK_CONSTANTS) {