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

Commit 87a1ee27 authored by Xin Li's avatar Xin Li
Browse files

Merge 24Q4 into AOSP main

Bug: 370570306
Merged-In: Idddd5d3e38e2d14bb1becdffbc0649b2f3bb5dae
Change-Id: Ia59c5355c359e1383bb2af60e261c706d19cd4ef
parents 3bad41c9 fc94fd39
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ union HapticGenerator {
  parcelable HapticScale {
    int id;
    android.hardware.audio.effect.HapticGenerator.VibratorScale scale = android.hardware.audio.effect.HapticGenerator.VibratorScale.MUTE;
    float scaleFactor = (-1.0f) /* -1.000000f */;
    float adaptiveScaleFactor = (-1.0f) /* -1.000000f */;
    const float UNDEFINED_SCALE_FACTOR = (-1.0f) /* -1.000000f */;
  }
  @VintfStability
  parcelable VibratorInformation {
+38 −0
Original line number Diff line number Diff line
@@ -55,14 +55,52 @@ union HapticGenerator {

    @VintfStability
    parcelable HapticScale {
        /**
         * Representation of undefined scale factor, applied by default for backwards compatibility.
         */
        const float UNDEFINED_SCALE_FACTOR = -1.0f;

        /**
         * Audio track ID.
         */
        int id;

        /**
         * Haptic intensity.
         *
         * This represents haptics scale as fixed levels defined by VibrationScale. If the field
         * scaleFactor is defined then this will be ignored in favor of scaleFactor, otherwise this
         * will be used to define the intensity for the haptics.
         */
        VibratorScale scale = VibratorScale.MUTE;

        /**
         * Haptic scale factor.
         *
         * This is a continuous scale representation of VibratorScale, allowing flexible number of
         * scale levels. If this field is defined then it will be used to define the intensity of
         * the haptics, instead of the old VibratorScale field. If this field is undefined then the
         * old VibratorScale field will be used.
         *
         * The value zero represents the same as VibratorScale.MUTE and the value one represents
         * VibratorScale.NONE. Values in (0,1) should scale down, and values > 1 should scale up
         * within hardware bounds. Negative values will be ignored.
         */
        float scaleFactor = -1.0f; // UNDEFINED_SCALE_FACTOR

        /**
         * Haptic adaptive scale factor.
         *
         * This is an additional scale value that should be applied on top of the vibrator scale to
         * adapt to the device current state. This should be applied to linearly scale the haptic
         * data after scale/scaleFactor is applied.
         *
         * The value zero mutes the haptics, even if the scale/scaleFactor are not set to MUTE/zero.
         * The value one will not scale the haptics, and can be used as a constant for no-op.
         * Values in (0,1) should scale down. Values > 1 should scale up within hardware bounds.
         * Negative values will be ignored.
         */
        float adaptiveScaleFactor = -1.0f; // UNDEFINED_SCALE_FACTOR
    }

    /**
+3 −0
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ cc_test {
    name: "VtsHalHapticGeneratorTargetTest",
    defaults: ["VtsHalAudioEffectTargetTestDefaults"],
    srcs: ["VtsHalHapticGeneratorTargetTest.cpp"],
    shared_libs: [
        "libaudioutils",
    ],
}

cc_test {
+11 −0
Original line number Diff line number Diff line
@@ -507,6 +507,17 @@ class EffectHelper {
        mOutputSamples = common.output.frameCount * mOutputFrameSize / sizeof(float);
    }

    void generateInput(std::vector<float>& input, float inputFrequency, float samplingFrequency,
                       size_t inputSize = 0) {
        if (inputSize == 0 || inputSize > input.size()) {
            inputSize = input.size();
        }

        for (size_t i = 0; i < inputSize; i++) {
            input[i] = sin(2 * M_PI * inputFrequency * i / samplingFrequency);
        }
    }

    bool mIsSpatializer;
    Descriptor mDescriptor;
    size_t mInputFrameSize, mOutputFrameSize;
+325 −317

File changed.

Preview size limit exceeded, changes collapsed.

Loading