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

Commit 591f1efe authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11486370 from 8a54f7c9 to 24Q2-release

Change-Id: I2e81a95795313c16f5c1f94158d60cb989496a59
parents 82f82ee5 8a54f7c9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "codec2_hidl_hal_master_test"

#include <android-base/logging.h>
#include <android-base/properties.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -82,6 +83,20 @@ TEST_P(Codec2MasterHalTest, ListComponents) {
    }
}

TEST_P(Codec2MasterHalTest, MustUseAidlBeyond202404) {
    static int sBoardFirstApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0);
    static int sBoardApiLevel = android::base::GetIntProperty("ro.board.api_level", 0);
    if (sBoardFirstApiLevel < 202404 && sBoardApiLevel < 202404) {
        GTEST_SKIP() << "board first level less than 202404:"
                     << " ro.board.first_api_level = " << sBoardFirstApiLevel
                     << " ro.board.api_level = " << sBoardApiLevel;
    }
    ALOGV("HidlCodecAllowed Test");

    EXPECT_NE(mClient->getAidlBase(), nullptr) << "android.hardware.media.c2 MUST use AIDL "
                                               << "for chipsets launching at 202404 or above";
}

}  // anonymous namespace

INSTANTIATE_TEST_SUITE_P(PerInstance, Codec2MasterHalTest,
+10 −10
Original line number Diff line number Diff line
@@ -284,15 +284,15 @@ RetCode BundleContext::limitLevel() {

        // roundoff
        int maxLevelRound = (int)(totalEnergyEstimation + 0.99);
        if (maxLevelRound + mVolume > 0) {
            gainCorrection = maxLevelRound + mVolume;
        if (maxLevelRound + mVolumedB > 0) {
            gainCorrection = maxLevelRound + mVolumedB;
        }

        params.VC_EffectLevel = mVolume - gainCorrection;
        params.VC_EffectLevel = mVolumedB - gainCorrection;
        if (params.VC_EffectLevel < -96) {
            params.VC_EffectLevel = -96;
        }
        LOG(INFO) << "\tVol: " << mVolume << ", GainCorrection: " << gainCorrection
        LOG(INFO) << "\tVol: " << mVolumedB << ", GainCorrection: " << gainCorrection
                  << ", Actual vol: " << params.VC_EffectLevel;

        /* Activate the initial settings */
@@ -576,25 +576,25 @@ RetCode BundleContext::setBassBoostStrength(int strength) {

RetCode BundleContext::setVolumeLevel(float level) {
    if (mMuteEnabled) {
        mLevelSaved = level;
        mLevelSaveddB = level;
    } else {
        mVolume = level;
        mVolumedB = level;
    }
    LOG(INFO) << __func__ << " success with level " << level;
    return limitLevel();
}

float BundleContext::getVolumeLevel() const {
    return (mMuteEnabled ? mLevelSaved : mVolume);
    return (mMuteEnabled ? mLevelSaveddB : mVolumedB);
}

RetCode BundleContext::setVolumeMute(bool mute) {
    mMuteEnabled = mute;
    if (mMuteEnabled) {
        mLevelSaved = mVolume;
        mVolume = -96;
        mLevelSaveddB = mVolumedB;
        mVolumedB = -96;
    } else {
        mVolume = mLevelSaved;
        mVolumedB = mLevelSaveddB;
    }
    return limitLevel();
}
+2 −2
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ class BundleContext final : public EffectContext {
    bool mVirtualizerTempDisabled = false;
    ::aidl::android::media::audio::common::AudioDeviceDescription mForceDevice;
    // Volume
    float mLevelSaved = 0; /* for when mute is set, level must be saved */
    float mVolume = 0;
    float mLevelSaveddB = 0; /* for when mute is set, level must be saved */
    float mVolumedB = 0;
    bool mMuteEnabled = false; /* Must store as mute = -96dB level */

    RetCode initControlParameter(LVM_ControlParams_t& params) const;
+1 −2
Original line number Diff line number Diff line
@@ -129,8 +129,7 @@ static const Descriptor kVirtualizerDesc = {
                   .implementor = "NXP Software Ltd."},
        .capability = kVirtualizerCap};

static const std::vector<Range::VolumeRange> kVolumeRanges = {
        MAKE_RANGE(Volume, levelDb, -9600, 0)};
static const std::vector<Range::VolumeRange> kVolumeRanges = {MAKE_RANGE(Volume, levelDb, -96, 0)};
static const Capability kVolumeCap = {.range = kVolumeRanges};
static const std::string kVolumeEffectName = "Volume";
static const Descriptor kVolumeDesc = {
+1 −0
Original line number Diff line number Diff line
@@ -2546,6 +2546,7 @@ AudioHwDevice* AudioFlinger::loadHwModule_ll(const char *name)
        bool mm;
        if (OK == dev->getMasterMute(&mm)) {
            mMasterMute = mm;
            ALOGI_IF(mMasterMute, "%s: applying mute from HAL %s", __func__, name);
        }
    }

Loading