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

Commit a12de218 authored by Francois Gaffie's avatar Francois Gaffie Committed by Eric Laurent
Browse files

AudioPolicy: EngineConfigurable: PFW 64 bits inclusive criterion



This CL allows to overcome limitation of encoding Audio devices
as an inclusive criterion (aka bitfield) by migrating from 32 to 64bits.

This CL adapts also all the automatic script that parses header file
to build criteria / criterion types.

Bug: 189469490
Test: make

Signed-off-by: default avatarFrancois Gaffie <francois.gaffie@renault.com>
Change-Id: Ib79a7c8be304a0cd5ed31f33b506f26eea1462d0
parent 06c65bdd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ struct ProductStrategy {

using ProductStrategies = std::vector<ProductStrategy>;

using ValuePair = std::pair<uint32_t, std::string>;
using ValuePair = std::tuple<uint64_t, uint32_t, std::string>;
using ValuePairs = std::vector<ValuePair>;

struct CriterionType
+12 −2
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ struct ValueTraits : public BaseSerializerTraits<ValuePair, ValuePairs> {
    struct Attributes {
        static constexpr const char *literal = "literal";
        static constexpr const char *numerical = "numerical";
        static constexpr const char *androidType = "android_type";
    };

    static android::status_t deserialize(_xmlDoc *doc, const _xmlNode *root,
@@ -349,7 +350,16 @@ status_t ValueTraits::deserialize(_xmlDoc */*doc*/, const _xmlNode *child, Colle
        ALOGE("%s: No attribute %s found", __FUNCTION__, Attributes::literal);
        return BAD_VALUE;
    }
    uint32_t numerical = 0;
    uint32_t androidType = 0;
    std::string androidTypeliteral = getXmlAttribute(child, Attributes::androidType);
    if (!androidTypeliteral.empty()) {
        ALOGV("%s: androidType %s", __FUNCTION__, androidTypeliteral.c_str());
        if (!convertTo(androidTypeliteral, androidType)) {
            ALOGE("%s: : Invalid typeset value(%s)", __FUNCTION__, androidTypeliteral.c_str());
            return BAD_VALUE;
        }
    }
    uint64_t numerical = 0;
    std::string numericalTag = getXmlAttribute(child, Attributes::numerical);
    if (numericalTag.empty()) {
        ALOGE("%s: No attribute %s found", __FUNCTION__, Attributes::literal);
@@ -359,7 +369,7 @@ status_t ValueTraits::deserialize(_xmlDoc */*doc*/, const _xmlNode *child, Colle
        ALOGE("%s: : Invalid value(%s)", __FUNCTION__, numericalTag.c_str());
        return BAD_VALUE;
    }
    values.push_back({numerical, literal});
    values.push_back({numerical,  androidType, literal});
    return NO_ERROR;
}

+4 −4
Original line number Diff line number Diff line
@@ -77,12 +77,12 @@ public:
     * Set the input device to be used by an input source.
     *
     * @param[in] inputSource: name of the input source for which the device to use has to be set
     * @param[in] devices; mask of devices to be used for the given input source.
     * @param[in] devices: mask of devices to be used for the given input source.
     *
     * @return true if the devices were set correclty for this input source, false otherwise.
     */
    virtual bool setDeviceForInputSource(const audio_source_t &inputSource,
                                         audio_devices_t device) = 0;
                                         uint64_t device) = 0;

    virtual void setDeviceAddressForProductStrategy(product_strategy_t strategy,
                                                    const std::string &address) = 0;
@@ -91,12 +91,12 @@ public:
     * Set the device to be used by a product strategy.
     *
     * @param[in] strategy: name of the product strategy for which the device to use has to be set
     * @param[in] devices; mask of devices to be used for the given strategy.
     * @param[in] devices: mask of devices to be used for the given strategy.
     *
     * @return true if the devices were set correclty for this strategy, false otherwise.
     */
    virtual bool setDeviceTypesForProductStrategy(product_strategy_t strategy,
                                                  audio_devices_t devices) = 0;
                                                  uint64_t devices) = 0;

    virtual product_strategy_t getProductStrategyByName(const std::string &address) = 0;

+4 −4
Original line number Diff line number Diff line
@@ -10,8 +10,8 @@
     <!--#################### GLOBAL COMPONENTS END ####################-->

    <!-- Automatically filled from audio-base.h file -->
    <ComponentType Name="OutputDevicesMask" Description="32th bit is not allowed as dedicated for input devices detection">
        <BitParameterBlock Name="mask" Size="32">
    <ComponentType Name="OutputDevicesMask" Description="64bit representation of devices">
        <BitParameterBlock Name="mask" Size="64">
        </BitParameterBlock>
    </ComponentType>

@@ -19,8 +19,8 @@
    profile. It must match with the Input device enum parameter.
    -->
    <!-- Automatically filled from audio-base.h file -->
    <ComponentType Name="InputDevicesMask">
        <BitParameterBlock Name="mask" Size="32">
    <ComponentType Name="InputDevicesMask" Description="64bit representation of devices">
        <BitParameterBlock Name="mask" Size="64">
        </BitParameterBlock>
    </ComponentType>

+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ InputSource::InputSource(const string &mappingValue,

bool InputSource::sendToHW(string & /*error*/)
{
    audio_devices_t applicableInputDevice;
    uint64_t applicableInputDevice;
    blackboardRead(&applicableInputDevice, sizeof(applicableInputDevice));
    return mPolicyPluginInterface->setDeviceForInputSource(mId, applicableInputDevice);
}
Loading