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

Commit 4bd85691 authored by Ahmad Khalil's avatar Ahmad Khalil
Browse files

Update envelope effects dependencies

To support envelope effects, the device will now need to support both frequency control and PWLE V2 effects.

Bug: 347034419
Flag: android.os.vibrator.normalized_pwle_effects
Test: atest VibratorInfoTest
Change-Id: I226d2f43ab09baea470cf95d9ecbc6c3ea05105f
parent dcc2db21
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -291,9 +291,7 @@ public class VibratorInfo implements Parcelable {
     * @return True if the hardware can control the frequency of the vibrations, otherwise false.
     */
    public boolean hasFrequencyControl() {
        // We currently can only control frequency of the vibration using the compose PWLE method.
        return hasCapability(
                IVibrator.CAP_FREQUENCY_CONTROL | IVibrator.CAP_COMPOSE_PWLE_EFFECTS);
        return hasCapability(IVibrator.CAP_FREQUENCY_CONTROL);
    }

    /**
@@ -456,7 +454,8 @@ public class VibratorInfo implements Parcelable {
     * @return True if the hardware supports creating envelope effects, false otherwise.
     */
    public boolean areEnvelopeEffectsSupported() {
        return hasCapability(IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2);
        return hasCapability(
                IVibrator.CAP_FREQUENCY_CONTROL | IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2);
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -61,8 +61,7 @@ public class VibratorInfoTest {
        VibratorInfo noCapabilities = new VibratorInfo.Builder(TEST_VIBRATOR_ID).build();
        assertFalse(noCapabilities.hasFrequencyControl());
        VibratorInfo composeAndFrequencyControl = new VibratorInfo.Builder(TEST_VIBRATOR_ID)
                .setCapabilities(
                        IVibrator.CAP_FREQUENCY_CONTROL | IVibrator.CAP_COMPOSE_PWLE_EFFECTS)
                .setCapabilities(IVibrator.CAP_FREQUENCY_CONTROL)
                .build();
        assertTrue(composeAndFrequencyControl.hasFrequencyControl());
    }
@@ -143,7 +142,8 @@ public class VibratorInfoTest {
        VibratorInfo noCapabilities = new VibratorInfo.Builder(TEST_VIBRATOR_ID).build();
        assertFalse(noCapabilities.areEnvelopeEffectsSupported());
        VibratorInfo envelopeEffectCapability = new VibratorInfo.Builder(TEST_VIBRATOR_ID)
                .setCapabilities(IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2)
                .setCapabilities(
                        IVibrator.CAP_FREQUENCY_CONTROL | IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2)
                .build();
        assertTrue(envelopeEffectCapability.areEnvelopeEffectsSupported());
    }