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

Commit d9f7fbd9 authored by jiabin's avatar jiabin Committed by Android Build Cherrypicker Worker
Browse files

Use test policy engine configuration file.

The test device may have configurable engine configuration file.
However, the test only load default engine. In that case, the test
should not use the configurable engine configuration file. Or it will
fail the test.

Bug: 360937480
Test: atest audiopolicy_tests
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:274fed9f87c4d50eb9ea575a29bad24118f1156f)
Merged-In: Id3a553b2c4a2ea50e22fcff0f4163b7741c6713b
Change-Id: Id3a553b2c4a2ea50e22fcff0f4163b7741c6713b
parent a601eccb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -24,9 +24,11 @@ class AudioPolicyTestManager : public AudioPolicyManager {
    explicit AudioPolicyTestManager(AudioPolicyClientInterface *clientInterface)
            : AudioPolicyTestManager(AudioPolicyConfig::createDefault(), clientInterface) {}
    AudioPolicyTestManager(const sp<const AudioPolicyConfig>& config,
            AudioPolicyClientInterface *clientInterface)
            AudioPolicyClientInterface *clientInterface,
            std::string engineConfig = "")
            : AudioPolicyManager(config,
                    loadApmEngineLibraryAndCreateEngine(config->getEngineLibraryNameSuffix()),
                    loadApmEngineLibraryAndCreateEngine(config->getEngineLibraryNameSuffix(),
                                                        engineConfig),
                    clientInterface) {}
    using AudioPolicyManager::getConfig;
    using AudioPolicyManager::initialize;
+6 −1
Original line number Diff line number Diff line
@@ -223,12 +223,17 @@ class AudioPolicyManagerTest : public testing::Test {
    std::unique_ptr<AudioPolicyTestManager> mManager;

    constexpr static const uint32_t k48000SamplingRate = 48000;

    static const std::string sTestEngineConfig;
};

const std::string AudioPolicyManagerTest::sTestEngineConfig =
        base::GetExecutableDirectory() + "/engine/test_audio_policy_engine_configuration.xml";

void AudioPolicyManagerTest::SetUp() {
    mClient.reset(getClient());
    ASSERT_NO_FATAL_FAILURE(SetUpManagerConfig());  // Subclasses may want to customize the config.
    mManager.reset(new AudioPolicyTestManager(mConfig, mClient.get()));
    mManager.reset(new AudioPolicyTestManager(mConfig, mClient.get(), sTestEngineConfig));
    ASSERT_EQ(NO_ERROR, mManager->initialize());
    ASSERT_EQ(NO_ERROR, mManager->initCheck());
}
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ package {
filegroup {
    name: "audiopolicytest_configuration_files",
    srcs: [
        "engine/test_audio_policy_engine_configuration.xml",
        "engine/test_audio_policy_engine_default_stream_volumes.xml",
        "engine/test_audio_policy_engine_product_strategies.xml",
        "engine/test_audio_policy_engine_stream_volumes.xml",
        "test_audio_policy_configuration.xml",
        "test_audio_policy_configuration_bluetooth.xml",
        "test_audio_policy_primary_only_configuration.xml",
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (C) 2024 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
     -->

<configuration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">

    <xi:include href="test_audio_policy_engine_product_strategies.xml"/>
    <xi:include href="test_audio_policy_engine_stream_volumes.xml"/>
    <xi:include href="test_audio_policy_engine_default_stream_volumes.xml"/>

</configuration>
+136 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2024 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- Default Volume Tables included by Audio Policy Configuration file -->
<!-- Full Default Volume table for all device category -->
<volumes>
    <reference name="FULL_SCALE_VOLUME_CURVE">
    <!-- Full Scale reference Volume Curve -->
        <point>0,0</point>
        <point>100,0</point>
    </reference>
    <reference name="SILENT_VOLUME_CURVE">
        <point>0,-9600</point>
        <point>100,-9600</point>
    </reference>
    <reference name="DEFAULT_SYSTEM_VOLUME_CURVE">
    <!-- Default System reference Volume Curve -->
        <point>1,-2400</point>
        <point>33,-1800</point>
        <point>66,-1200</point>
        <point>100,-600</point>
    </reference>
    <reference name="DEFAULT_MEDIA_VOLUME_CURVE">
    <!-- Default Media reference Volume Curve -->
        <point>1,-5800</point>
        <point>20,-4000</point>
        <point>60,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE">
    <!--Default Volume Curve -->
        <point>1,-4950</point>
        <point>33,-3350</point>
        <point>66,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_DEVICE_CATEGORY_SPEAKER_VOLUME_CURVE">
    <!-- Default is Speaker Media Volume Curve -->
        <point>1,-5800</point>
        <point>20,-4000</point>
        <point>60,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_DEVICE_CATEGORY_SPEAKER_SYSTEM_VOLUME_CURVE">
    <!-- Default is Speaker System Volume Curve -->
        <point>1,-4680</point>
        <point>42,-2070</point>
        <point>85,-540</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE">
    <!--Default Volume Curve -->
        <point>1,-4950</point>
        <point>33,-3350</point>
        <point>66,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE">
    <!-- Default is Ext Media System Volume Curve -->
        <point>1,-5800</point>
        <point>20,-4000</point>
        <point>60,-2100</point>
        <point>100,-1000</point>
    </reference>
    <reference name="DEFAULT_HEARING_AID_VOLUME_CURVE">
    <!-- Default Hearing Aid Volume Curve -->
        <point>1,-12700</point>
        <point>20,-8000</point>
        <point>60,-4000</point>
        <point>100,0</point>
    </reference>
    <!-- **************************************************************** -->
    <!-- Non-mutable default volume curves:                               -->
    <!--     * first point is always for index 0                          -->
    <!--     * attenuation is small enough that stream can still be heard -->
    <reference name="DEFAULT_NON_MUTABLE_VOLUME_CURVE">
    <!-- Default non-mutable reference Volume Curve -->
    <!--        based on DEFAULT_MEDIA_VOLUME_CURVE -->
        <point>0,-5800</point>
        <point>20,-4000</point>
        <point>60,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_NON_MUTABLE_HEADSET_VOLUME_CURVE">
    <!--Default non-mutable Volume Curve for headset -->
    <!--    based on DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE -->
        <point>0,-4950</point>
        <point>33,-3350</point>
        <point>66,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_NON_MUTABLE_SPEAKER_VOLUME_CURVE">
    <!-- Default non-mutable Speaker Volume Curve -->
    <!--    based on DEFAULT_DEVICE_CATEGORY_SPEAKER_VOLUME_CURVE -->
        <point>0,-5800</point>
        <point>20,-4000</point>
        <point>60,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_NON_MUTABLE_EARPIECE_VOLUME_CURVE">
    <!--Default non-mutable Volume Curve -->
    <!--    based on DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE -->
        <point>0,-4950</point>
        <point>33,-3350</point>
        <point>66,-1700</point>
        <point>100,0</point>
    </reference>
    <reference name="DEFAULT_NON_MUTABLE_EXT_VOLUME_CURVE">
    <!-- Default non-mutable Ext Media System Volume Curve -->
    <!--     based on DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE -->
        <point>0,-5800</point>
        <point>20,-4000</point>
        <point>60,-2100</point>
        <point>100,-1000</point>
    </reference>
    <reference name="DEFAULT_NON_MUTABLE_HEARING_AID_VOLUME_CURVE">
    <!-- Default non-mutable Hearing Aid Volume Curve -->
    <!--     based on DEFAULT_HEARING_AID_VOLUME_CURVE -->
        <point>0,-12700</point>
        <point>20,-8000</point>
        <point>60,-4000</point>
        <point>100,0</point>
    </reference>
</volumes>
Loading