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

Commit 53e458f3 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

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

parents c9b32487 9305df84
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.
     *