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

Commit a551a82d authored by Nicholas Ambur's avatar Nicholas Ambur Committed by Android (Google) Code Review
Browse files

Merge "add model arch to SoundTrigger Properties"

parents fde81ba6 cb494637
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -665,5 +665,5 @@ ef10e15cdbe8ba63925302a95962d5679bbda6a4351400cc23e1589ca0e9f94b android.hardwar
b27ab0cd40b0b078cdcd024bfe1061c4c4c065f3519eeb9347fa359a3268a5ae android.hardware.radio.config@1.3::IRadioConfig
742360c775313438b0f82256eac62fb5bbc76a6ae6f388573f3aa142fb2c1eea android.hardware.radio.config@1.3::IRadioConfigIndication
7683fed9d253956071f18b152e6be657719536f98d9b534433d5e411bcde5061 android.hardware.radio.config@1.3::IRadioConfigResponse
c411dc16855fcb786cd5e08fe2889acbd72fd54217bd27fe0373813de230ce5f android.hardware.soundtrigger@2.3::types
5abad7b54d3400fab633cb7a36ffc1747e037bf805d3d9e3517cb6aabf26b002 android.hardware.soundtrigger@2.3::ISoundTriggerHw
b46d358537168c478762c3d34d5fe1555a3fcd89cd1f43621350ada395e6f795 android.hardware.soundtrigger@2.3::types
15924fbf38b3c282299a37e48c72405c97e322f844f815081db6acbca22d4165 android.hardware.soundtrigger@2.3::ISoundTriggerHw
+12 −0
Original line number Diff line number Diff line
@@ -25,6 +25,18 @@ import @2.2::ISoundTriggerHw;
 */
interface ISoundTriggerHw extends @2.2::ISoundTriggerHw {

    /**
     * Retrieve extended implementation properties.
     * The returned properties includes what is returned from the
     * getProperties along with expanded implementation details.
     *
     * @return retval Operation completion status: 0 in case of success,
     *                -ENODEV in case of initialization error.
     * @return properties A Properties structure containing implementation
     *                    description and capabilities.
     */
    getProperties_2_3() generates (int32_t retval, Properties properties);

    /**
     * Set a model specific parameter with the given value. This parameter
     * will keep its value for the duration the model is loaded regardless of starting and stopping
+35 −2
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ Return<void> SoundTriggerHw::getProperties(ISoundTriggerHw::getProperties_cb _hi
    ALOGV("getProperties() mHwDevice %p", mHwDevice);
    int ret;
    struct sound_trigger_properties halProperties;
    ISoundTriggerHw::Properties properties;
    V2_0::ISoundTriggerHw::Properties properties;

    if (mHwDevice == NULL) {
        ret = -ENODEV;
@@ -333,7 +333,7 @@ void SoundTriggerHw::convertUuidToHal(sound_trigger_uuid_t* halUuid, const Uuid*
}

void SoundTriggerHw::convertPropertiesFromHal(
        ISoundTriggerHw::Properties* properties,
        V2_0::ISoundTriggerHw::Properties* properties,
        const struct sound_trigger_properties* halProperties) {
    properties->implementor = halProperties->implementor;
    properties->description = halProperties->description;
@@ -350,6 +350,16 @@ void SoundTriggerHw::convertPropertiesFromHal(
    properties->powerConsumptionMw = halProperties->power_consumption_mw;
}

void SoundTriggerHw::convertPropertiesFromHal(
        V2_3::Properties* properties, const struct sound_trigger_properties_header* header) {
    if (header->version >= SOUND_TRIGGER_DEVICE_API_VERSION_1_3) {
        const struct sound_trigger_properties_extended_1_3* halProperties =
                (const struct sound_trigger_properties_extended_1_3*)header;
        convertPropertiesFromHal(&properties->base, &halProperties->base);
        properties->supportedModelArch = halProperties->supported_model_arch;
    }
}

void SoundTriggerHw::convertTriggerPhraseToHal(struct sound_trigger_phrase* halTriggerPhrase,
                                               const ISoundTriggerHw::Phrase* triggerPhrase) {
    halTriggerPhrase->id = triggerPhrase->id;
@@ -708,6 +718,29 @@ Return<int32_t> SoundTriggerHw::getModelState(int32_t modelHandle) {

// Begin V2_3 implementation

Return<void> SoundTriggerHw::getProperties_2_3(ISoundTriggerHw::getProperties_2_3_cb _hidl_cb) {
    ALOGV("getProperties_2_3() mHwDevice %p", mHwDevice);
    int ret = 0;
    V2_3::Properties properties;
    const struct sound_trigger_properties_header* header;

    if (mHwDevice == NULL) {
        ret = -ENODEV;
        goto exit;
    }

    header = mHwDevice->get_properties_extended(mHwDevice);

    convertPropertiesFromHal(&properties, header);

    ALOGV("getProperties_2_3 implementor %s supportedModelArch %s",
          properties.base.implementor.c_str(), properties.supportedModelArch.c_str());

exit:
    _hidl_cb(ret, properties);
    return Void();
}

Return<int32_t> SoundTriggerHw::setParameter(V2_0::SoundModelHandle modelHandle,
                                             ModelParameter modelParam, int32_t value) {
    sp<SoundModelClient> client;
+3 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ struct SoundTriggerHw : public ISoundTriggerHw {
    Return<int32_t> getModelState(int32_t modelHandle) override;

    // Methods from V2_3::ISoundTriggerHw follow.
    Return<void> getProperties_2_3(getProperties_2_3_cb _hidl_cb) override;
    Return<int32_t> setParameter(V2_0::SoundModelHandle modelHandle, ModelParameter modelParam,
                                 int32_t value) override;
    Return<void> getParameter(V2_0::SoundModelHandle modelHandle, ModelParameter modelParam,
@@ -156,6 +157,8 @@ struct SoundTriggerHw : public ISoundTriggerHw {
    void convertUuidToHal(sound_trigger_uuid_t* halUuid, const Uuid* uuid);
    void convertPropertiesFromHal(V2_0::ISoundTriggerHw::Properties* properties,
                                  const struct sound_trigger_properties* halProperties);
    void convertPropertiesFromHal(V2_3::Properties* properties,
                                  const struct sound_trigger_properties_header* header);
    static sound_trigger_model_parameter_t convertModelParameterToHal(ModelParameter param);
    void convertTriggerPhraseToHal(struct sound_trigger_phrase* halTriggerPhrase,
                                   const V2_0::ISoundTriggerHw::Phrase* triggerPhrase);
+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,21 @@
package android.hardware.soundtrigger@2.3;

import android.hidl.safe_union@1.0::Monostate;
import @2.0::ISoundTriggerHw.Properties;

/**
 * Extended implementation properties providing verbose implementation
 * details.
 */
struct Properties {
    @2.0::ISoundTriggerHw.Properties base;

    /**
     * String naming the architecture used for running the supported models.
     * (eg. DSP architecture)
     */
    string supportedModelArch;
};

/**
 * Model specific parameters to be used with parameter set and get APIs
Loading