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

Commit 9b95dd2f authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Revert "audiopolicy: HW Bridge Sink matching rule""

parents 624e6b8f 60a83ca8
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -65,9 +65,6 @@ public:

    bool supportsFormat(audio_format_t format);

    void setDynamic() { mIsDynamic = true; }
    bool isDynamic() const { return mIsDynamic; }

    // PolicyAudioPortConfig
    virtual sp<PolicyAudioPort> getPolicyAudioPort() const {
        return static_cast<PolicyAudioPort*>(const_cast<DeviceDescriptor*>(this));
@@ -108,8 +105,6 @@ private:
    std::string mTagName; // Unique human readable identifier for a device port found in conf file.
    FormatVector        mEncodedFormats;
    audio_format_t      mCurrentEncodedFormat;
    bool                mIsDynamic = false;
    const std::string   mDeclaredAddress; // Original device address
};

class DeviceVector : public SortedVector<sp<DeviceDescriptor> >
+1 −10
Original line number Diff line number Diff line
@@ -131,17 +131,8 @@ class HwModuleCollection : public Vector<sp<HwModule> >
public:
    sp<HwModule> getModuleFromName(const char *name) const;

    /**
     * @brief getModuleForDeviceType try to get a device from type / format on all modules
     * @param device type to consider
     * @param encodedFormat to consider
     * @param[out] tagName if not null, if a matching device is found, will return the tagName
     * of original device from XML file so that audio routes matchin rules work.
     * @return valid module if considered device found, nullptr otherwise.
     */
    sp<HwModule> getModuleForDeviceType(audio_devices_t device,
                                        audio_format_t encodedFormat,
                                        std::string *tagName = nullptr) const;
                                        audio_format_t encodedFormat) const;

    sp<HwModule> getModuleForDevice(const sp<DeviceDescriptor> &device,
                                    audio_format_t encodedFormat) const;
+0 −19
Original line number Diff line number Diff line
@@ -111,19 +111,6 @@ public:
               (!areOutputDevices || devicesSupportEncodedFormats(deviceTypes));
    }

    /**
     * @brief getTag
     * @param deviceTypes to be considered
     * @return tagName of first matching device for the considered types, empty string otherwise.
     */
    std::string getTag(const DeviceTypeSet& deviceTypes) const
    {
        if (supportsDeviceTypes(deviceTypes)) {
            return mSupportedDevices.getDevicesFromTypes(deviceTypes).itemAt(0)->getTagName();
        }
        return {};
    }

    /**
     * @brief supportsDevice
     * @param device to be checked against
@@ -163,12 +150,6 @@ public:
    }
    void removeSupportedDevice(const sp<DeviceDescriptor> &device)
    {
        ssize_t ret = mSupportedDevices.indexOf(device);
        if (ret >= 0 && !mSupportedDevices.itemAt(ret)->isDynamic()) {
            // devices equality checks only type, address, name and format
            // Prevents from removing non dynamically added devices
            return;
        }
        mSupportedDevices.remove(device);
    }
    void setSupportedDevices(const DeviceVector &devices)
+0 −5
Original line number Diff line number Diff line
@@ -42,11 +42,6 @@ public:

    virtual const std::string getTagName() const = 0;

    bool equals(const sp<PolicyAudioPort> &right) const
    {
        return getTagName() == right->getTagName();
    }

    virtual sp<AudioPort> asAudioPort() const = 0;

    virtual void setFlags(uint32_t flags)
+2 −2
Original line number Diff line number Diff line
@@ -39,12 +39,12 @@ void AudioRoute::dump(String8 *dst, int spaces) const
bool AudioRoute::supportsPatch(const sp<PolicyAudioPort> &srcPort,
                               const sp<PolicyAudioPort> &dstPort) const
{
    if (mSink == 0 || dstPort == 0 || !dstPort->equals(mSink)) {
    if (mSink == 0 || dstPort == 0 || dstPort != mSink) {
        return false;
    }
    ALOGV("%s: sinks %s matching", __FUNCTION__, mSink->getTagName().c_str());
    for (const auto &sourcePort : mSources) {
        if (sourcePort->equals(srcPort)) {
        if (sourcePort == srcPort) {
            ALOGV("%s: sources %s matching", __FUNCTION__, sourcePort->getTagName().c_str());
            return true;
        }
Loading