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

Commit 095a6e1d authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge "gatt: Block application operations on LeAudio services"

parents 7aa04c1b 34533006
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -129,6 +129,15 @@ public class GattService extends ProfileService {
    private static final UUID FIDO_SERVICE_UUID =
            UUID.fromString("0000FFFD-0000-1000-8000-00805F9B34FB"); // U2F

    private static final UUID[] LE_AUDIO_SERVICE_UUIDS = {
            UUID.fromString("00001844-0000-1000-8000-00805F9B34FB"), // VCS
            UUID.fromString("00001845-0000-1000-8000-00805F9B34FB"), // VOCS
            UUID.fromString("00001843-0000-1000-8000-00805F9B34FB"), // AICS
            UUID.fromString("00001850-0000-1000-8000-00805F9B34FB"), // PACS
            UUID.fromString("0000184E-0000-1000-8000-00805F9B34FB"), // ASCS
            UUID.fromString("0000184F-0000-1000-8000-00805F9B34FB"), // BASS
    };

    /**
     * Keep the arguments passed in for the PendingIntent.
     */
@@ -1458,8 +1467,7 @@ public class GattService extends ProfileService {

                    currSrvc = new BluetoothGattService(el.uuid, el.id, el.type);
                    dbOut.add(currSrvc);
                    isRestrictedSrvc =
                            isFidoSrvcUuid(el.uuid) || isAndroidTvRemoteSrvcUuid(el.uuid);
                    isRestrictedSrvc = isRestrictedSrvcUuid(el.uuid);
                    isHidSrvc = isHidSrvcUuid(el.uuid);
                    if (isRestrictedSrvc) {
                        restrictedIds.add(el.id);
@@ -3293,6 +3301,16 @@ public class GattService extends ProfileService {
        return FIDO_SERVICE_UUID.equals(uuid);
    }

    private boolean isLeAudioSrvcUuid(final UUID uuid) {
        return LE_AUDIO_SERVICE_UUIDS.equals(uuid);
    }

    private boolean isRestrictedSrvcUuid(final UUID uuid) {
        return isLeAudioSrvcUuid(uuid) ||
               isAndroidTvRemoteSrvcUuid(uuid) ||
               isLeAudioSrvcUuid(uuid);
    }

    private int getDeviceType(BluetoothDevice device) {
        int type = gattClientGetDeviceTypeNative(device.getAddress());
        if (DBG) {