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

Commit 9305df84 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Łukasz Rymanowski
Browse files

leaudio: Add service APIs needed by other profiles e.g. incoming HAP

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: atest BluetoothInstrumentationTests

Change-Id: Id80d510fc00fe132e7aaf2f4a9106937de92bd62
parent 3219c845
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -448,6 +448,35 @@ public class LeAudioService extends ProfileService {
        return mLeAudioNativeInterface.groupRemoveNode(groupId, device);
    }

    /**
     * Checks if given group exists.
     * @param group_id group Id to verify
     * @return true given group exists, otherwise false
     */
    public boolean isValidDeviceGroup(int group_id) {
        return (group_id != LE_AUDIO_GROUP_ID_INVALID) ?
                mDeviceGroupIdMap.containsValue(group_id) :
                false;
    }

    /**
     * Get all the devices within a given group.
     * @param group_id group Id to verify
     * @return all devices within a given group or empty list
     */
    public List<BluetoothDevice> getGroupDevices(int group_id) {
        List<BluetoothDevice> result = new ArrayList<>();

        if (group_id != LE_AUDIO_GROUP_ID_INVALID) {
            for (BluetoothDevice storedDevice : mDeviceGroupIdMap.keySet()) {
                if (getGroupId(storedDevice) == group_id) {
                    result.add(storedDevice);
                }
            }
        }
        return result;
    }

    /**
     * Get supported group audio direction from available context.
     *