Loading core/java/android/os/vibrator/flags.aconfig +0 −11 Original line number Diff line number Diff line Loading @@ -34,17 +34,6 @@ flag { } } flag { namespace: "haptics" name: "haptic_feedback_input_source_customization_enabled" description: "Enabled the extended haptic feedback customization by input source." bug: "331819348" is_fixed_read_only: true metadata { purpose: PURPOSE_FEATURE } } flag { namespace: "haptics" name: "haptics_scale_v2_enabled" Loading core/java/android/view/HapticScrollFeedbackProvider.java +7 −20 Original line number Diff line number Diff line Loading @@ -103,12 +103,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (Math.abs(mTotalScrollPixels) >= mTickIntervalPixels) { mTotalScrollPixels %= mTickIntervalPixels; if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_TICK, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_TICK); } } } Loading @@ -122,13 +118,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (!mCanPlayLimitFeedback) { return; } if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_LIMIT, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_LIMIT); } mCanPlayLimitFeedback = false; } Loading @@ -138,13 +129,9 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (!mHapticScrollFeedbackEnabled) { return; } if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_ITEM_FOCUS, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_ITEM_FOCUS); } mCanPlayLimitFeedback = true; } Loading core/tests/coretests/src/android/view/HapticScrollFeedbackProviderTest.java +45 −58 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/vibrator/HapticFeedbackCustomization.java +6 −11 Original line number Diff line number Diff line Loading @@ -136,17 +136,12 @@ final class HapticFeedbackCustomization { mHapticCustomizations = hapticCustomizations; // Load customizations specified by input sources. if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mHapticCustomizationsForSourceRotary = loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo, R.xml.haptic_feedback_customization_source_rotary_encoder); mHapticCustomizationsForSourceTouchScreen = loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo, R.xml.haptic_feedback_customization_source_touchscreen); } else { mHapticCustomizationsForSourceRotary = new SparseArray<>(); mHapticCustomizationsForSourceTouchScreen = new SparseArray<>(); } // Load customizations specified for usages. if (android.os.vibrator.Flags.hapticFeedbackWithCustomUsage()) { Loading services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java +10 −16 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.server.vibrator; import static android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.Resources; Loading Loading @@ -169,17 +167,14 @@ public final class HapticFeedbackVibrationProvider { } /** * Similar to {@link #getVibrationAttributes(int, int, int)} but also handles * input source customization. * Similar to {@link #getVibrationAttributes} but also handles input source customization. * * @param inputSource the {@link InputDevice.Source} that customizes the * {@link VibrationAttributes}. * @param inputSource one of {@code InputDevice.SOURCE_*} to customize the attributes. */ public VibrationAttributes getVibrationAttributesForInputDevice(int effectId, int inputSource, @HapticFeedbackConstants.Flags int flags, @HapticFeedbackConstants.PrivateFlags int privFlags) { if (hapticFeedbackInputSourceCustomizationEnabled()) { switch (effectId) { case HapticFeedbackConstants.SCROLL_TICK, HapticFeedbackConstants.SCROLL_ITEM_FOCUS, Loading @@ -190,7 +185,6 @@ public final class HapticFeedbackVibrationProvider { return getVibrationAttributesWithFlags(attrs, effectId, flags); } } } return getVibrationAttributes( effectId, VibrationAttributes.USAGE_UNKNOWN, flags, privFlags); } Loading Loading
core/java/android/os/vibrator/flags.aconfig +0 −11 Original line number Diff line number Diff line Loading @@ -34,17 +34,6 @@ flag { } } flag { namespace: "haptics" name: "haptic_feedback_input_source_customization_enabled" description: "Enabled the extended haptic feedback customization by input source." bug: "331819348" is_fixed_read_only: true metadata { purpose: PURPOSE_FEATURE } } flag { namespace: "haptics" name: "haptics_scale_v2_enabled" Loading
core/java/android/view/HapticScrollFeedbackProvider.java +7 −20 Original line number Diff line number Diff line Loading @@ -103,12 +103,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (Math.abs(mTotalScrollPixels) >= mTickIntervalPixels) { mTotalScrollPixels %= mTickIntervalPixels; if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_TICK, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_TICK); } } } Loading @@ -122,13 +118,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (!mCanPlayLimitFeedback) { return; } if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_LIMIT, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_LIMIT); } mCanPlayLimitFeedback = false; } Loading @@ -138,13 +129,9 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider { if (!mHapticScrollFeedbackEnabled) { return; } if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mView.performHapticFeedbackForInputDevice( HapticFeedbackConstants.SCROLL_ITEM_FOCUS, inputDeviceId, source, /* flags= */ 0); } else { mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_ITEM_FOCUS); } mCanPlayLimitFeedback = true; } Loading
core/tests/coretests/src/android/view/HapticScrollFeedbackProviderTest.java +45 −58 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/vibrator/HapticFeedbackCustomization.java +6 −11 Original line number Diff line number Diff line Loading @@ -136,17 +136,12 @@ final class HapticFeedbackCustomization { mHapticCustomizations = hapticCustomizations; // Load customizations specified by input sources. if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) { mHapticCustomizationsForSourceRotary = loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo, R.xml.haptic_feedback_customization_source_rotary_encoder); mHapticCustomizationsForSourceTouchScreen = loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo, R.xml.haptic_feedback_customization_source_touchscreen); } else { mHapticCustomizationsForSourceRotary = new SparseArray<>(); mHapticCustomizationsForSourceTouchScreen = new SparseArray<>(); } // Load customizations specified for usages. if (android.os.vibrator.Flags.hapticFeedbackWithCustomUsage()) { Loading
services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java +10 −16 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.server.vibrator; import static android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.Resources; Loading Loading @@ -169,17 +167,14 @@ public final class HapticFeedbackVibrationProvider { } /** * Similar to {@link #getVibrationAttributes(int, int, int)} but also handles * input source customization. * Similar to {@link #getVibrationAttributes} but also handles input source customization. * * @param inputSource the {@link InputDevice.Source} that customizes the * {@link VibrationAttributes}. * @param inputSource one of {@code InputDevice.SOURCE_*} to customize the attributes. */ public VibrationAttributes getVibrationAttributesForInputDevice(int effectId, int inputSource, @HapticFeedbackConstants.Flags int flags, @HapticFeedbackConstants.PrivateFlags int privFlags) { if (hapticFeedbackInputSourceCustomizationEnabled()) { switch (effectId) { case HapticFeedbackConstants.SCROLL_TICK, HapticFeedbackConstants.SCROLL_ITEM_FOCUS, Loading @@ -190,7 +185,6 @@ public final class HapticFeedbackVibrationProvider { return getVibrationAttributesWithFlags(attrs, effectId, flags); } } } return getVibrationAttributes( effectId, VibrationAttributes.USAGE_UNKNOWN, flags, privFlags); } Loading