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

Commit d8b3de0b authored by Shunkai Yao's avatar Shunkai Yao Committed by Android (Google) Code Review
Browse files

Merge "Preserve previous control parameters with common AIDL parameter setting" into main

parents 9aab1380 61b571ab
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -93,7 +93,18 @@ void BundleContext::deInit() {
RetCode BundleContext::setCommon(const Parameter::Common& common) {
    RetCode ret = EffectContext::setCommon(common);
    RETURN_VALUE_IF(ret != RetCode::SUCCESS, ret, " setCommonFailed");
    return init();
    if (mInstance) {
        LVM_ControlParams_t params;
        RETURN_VALUE_IF(LVM_SUCCESS != LVM_GetControlParameters(mInstance, &params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, "failGetControlParams");
        RETURN_VALUE_IF(RetCode::SUCCESS != applyCommonParameter(params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, " applyCommonParameterFailed");
        RETURN_VALUE_IF(LVM_SUCCESS != LVM_SetControlParameters(mInstance, &params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, "failSetControlParams");
    } else {
        RETURN_VALUE_IF(RetCode::SUCCESS != init(), RetCode::ERROR_EFFECT_LIB_ERROR, " initFailed");
    }
    return RetCode::SUCCESS;
}

RetCode BundleContext::enable() {
@@ -605,7 +616,7 @@ RetCode BundleContext::setForcedDevice(
    return ret;
}

RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
RetCode BundleContext::applyCommonParameter(LVM_ControlParams_t& params) const {
    int outputChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
            mCommon.output.base.channelMask);
    auto outputChannelMaskConv = aidl2legacy_AudioChannelLayout_audio_channel_mask_t(
@@ -627,6 +638,13 @@ RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
        params.SourceFormat = LVM_MULTICHANNEL;
    }

    return RetCode::SUCCESS;
}

RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
    RETURN_VALUE_IF(RetCode::SUCCESS != applyCommonParameter(params),
                    RetCode::ERROR_EFFECT_LIB_ERROR, " applyCommonParameterFailed");

    /* General parameters */
    params.OperatingMode = LVM_MODE_ON;
    params.SpeakerType = LVM_HEADPHONES;
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ class BundleContext final : public EffectContext {
    bool isBandLevelIndexInRange(const std::vector<Equalizer::BandLevel>& bandLevels) const;
    static LVM_EQNB_BandDef_t* getDefaultEqualizerBandDefs();
    static LVM_HeadroomBandDef_t* getDefaultEqualizerHeadroomBanDefs();
    RetCode applyCommonParameter(LVM_ControlParams_t& params) const;
};

}  // namespace aidl::android::hardware::audio::effect