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

Commit e6df10a7 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audio policy: fix default call audio route with LE audio" into tm-dev

parents 91bd1193 34b09d01
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -87,10 +87,17 @@ public:

    status_t listAudioVolumeGroups(AudioVolumeGroupVector &groups) const override;

    /**
     * Get the list of currently connected removable device types ordered from most recently
     * connected to least recently connected.
     * @param group the device group to consider: wired, a2dp... If none, consider all groups.
     * @param excludedDevices list of device types to ignore
     * @return a potentially empty ordered list of connected removable devices.
     */
    std::vector<audio_devices_t> getLastRemovableMediaDevices(
            device_out_group_t group = GROUP_NONE) const
    {
        return mLastRemovableMediaDevices.getLastRemovableMediaDevices(group);
            device_out_group_t group = GROUP_NONE,
            std::vector<audio_devices_t> excludedDevices = {}) const {
        return mLastRemovableMediaDevices.getLastRemovableMediaDevices(group, excludedDevices);
    }

    void dump(String8 *dst) const override;
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ class LastRemovableMediaDevices
public:
    void setRemovableMediaDevices(sp<DeviceDescriptor> desc, audio_policy_dev_state_t state);
    std::vector<audio_devices_t> getLastRemovableMediaDevices(
            device_out_group_t group = GROUP_NONE) const;
            device_out_group_t group = GROUP_NONE,
            std::vector<audio_devices_t> excludedDevices = {}) const;
    sp<DeviceDescriptor> getLastRemovableMediaDevice(
            const DeviceVector& excludedDevices, device_out_group_t group = GROUP_NONE) const;

+6 −3
Original line number Diff line number Diff line
@@ -44,12 +44,15 @@ void LastRemovableMediaDevices::setRemovableMediaDevices(sp<DeviceDescriptor> de
}

std::vector<audio_devices_t> LastRemovableMediaDevices::getLastRemovableMediaDevices(
        device_out_group_t group) const
        device_out_group_t group, std::vector<audio_devices_t> excludedDevices) const
{
    std::vector<audio_devices_t> ret;
    for (auto iter = mMediaDevices.begin(); iter != mMediaDevices.end(); ++iter) {
        if ((group == GROUP_NONE) || (group == getDeviceOutGroup((iter->desc)->type()))) {
            ret.push_back((iter->desc)->type());
        audio_devices_t type = (iter->desc)->type();
        if ((group == GROUP_NONE || group == getDeviceOutGroup(type))
                && std::find(excludedDevices.begin(), excludedDevices.end(), type) ==
                                       excludedDevices.end()) {
            ret.push_back(type);
        }
    }
    return ret;
+1 −1
Original line number Diff line number Diff line
@@ -270,7 +270,7 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
        devices = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_HEARING_AID);
        if (!devices.isEmpty()) break;
        devices = availableOutputDevices.getFirstDevicesFromTypes(
                                          getLastRemovableMediaDevices());
                        getLastRemovableMediaDevices(GROUP_NONE, {AUDIO_DEVICE_OUT_BLE_HEADSET}));
        if (!devices.isEmpty()) break;
        devices = availableOutputDevices.getFirstDevicesFromTypes({
                AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, AUDIO_DEVICE_OUT_EARPIECE});