Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ab21e52 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

Remove android.os.vibrator.haptic_feedback_vibration_oem_customization_enabled

Bug: 409607344
Test: atest HapticFeedbackCustomizationTest
Flag: EXEMPT flag removal
Change-Id: Ibe5612f451ad9e71dd2655adb3ccf4fc906cb264
parent 3e00ef13
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
package: "android.os.vibrator"
container: "system"

flag {
    namespace: "haptics"
    name: "haptic_feedback_vibration_oem_customization_enabled"
    description: "Enables OEMs/devices to customize vibrations for haptic feedback"
    # Make read only. This is because the flag is used only once, and this could happen before
    # the read-write flag values propagate to the device.
    is_fixed_read_only: true
    bug: "291128479"
}

flag {
    namespace: "haptics"
    name: "adaptive_haptics_enabled"
+0 −8
Original line number Diff line number Diff line
@@ -119,14 +119,6 @@ final class HapticFeedbackCustomization {
    private final SparseArray<VibrationEffect> mHapticCustomizationsForSourceTouchScreen;

    HapticFeedbackCustomization(Resources res, VibratorInfo vibratorInfo) {
        if (!Flags.hapticFeedbackVibrationOemCustomizationEnabled()) {
            Slog.d(TAG, "Haptic feedback customization feature is not enabled.");
            mHapticCustomizations = new SparseArray<>();
            mHapticCustomizationsForSourceRotary = new SparseArray<>();
            mHapticCustomizationsForSourceTouchScreen = new SparseArray<>();
            return;
        }

        // Load base customizations.
        SparseArray<VibrationEffect> hapticCustomizations;
        hapticCustomizations = loadCustomizedFeedbackVibrationFromFile(res, vibratorInfo);
+0 −19
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.os.VibrationEffect.Composition.PRIMITIVE_TICK;
import static android.os.VibrationEffect.EFFECT_CLICK;
import static android.os.VibrationEffect.EFFECT_TICK;
import static android.os.vibrator.Flags.FLAG_HAPTIC_FEEDBACK_INPUT_SOURCE_CUSTOMIZATION_ENABLED;
import static android.os.vibrator.Flags.FLAG_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED;
import static android.os.vibrator.Flags.FLAG_LOAD_HAPTIC_FEEDBACK_VIBRATION_CUSTOMIZATION_FROM_RESOURCES;

import static com.android.internal.R.xml.haptic_feedback_customization;
@@ -105,24 +104,6 @@ public class HapticFeedbackCustomizationTest {
    public void setUp() {
        clearFileAndResourceSetup();
        when(mVibratorInfoMock.areVibrationFeaturesSupported(any())).thenReturn(true);
        mSetFlagsRule.enableFlags(FLAG_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED);
    }

    @Test
    public void testParseCustomizations_featureFlagDisabled_customizationNotLoaded(
            @TestParameter CustomizationSource customizationSource) throws Exception {
        mSetFlagsRule.disableFlags(FLAG_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED);
        // Valid customization XML.
        String xml = "<haptic-feedback-constants>"
                + "<constant id=\"10\">"
                + COMPOSITION_VIBRATION_XML
                + "</constant>"
                + "</haptic-feedback-constants>";
        HapticFeedbackCustomization customization = createCustomizationForSource(xml,
                customizationSource);

        assertThat(getEffectForSource(/* effectId= */ 10, customizationSource, customization))
                .isNull();
    }

    @Test