Loading services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java +7 −6 Original line number Diff line number Diff line Loading @@ -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: Loading @@ -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); } } } Loading services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java +1 −14 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading
services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java +7 −6 Original line number Diff line number Diff line Loading @@ -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: Loading @@ -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); } } } Loading
services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java +1 −14 Original line number Diff line number Diff line Loading @@ -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) { Loading