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

Commit 26a52bd3 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Automerger Merge Worker
Browse files

Merge "gatt: Block application operations on LeAudio services" am: 095a6e1d

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/1846281

Change-Id: I31640352f0405177412f6aba31c869f40c82a1ea
parents b520a015 095a6e1d
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -137,6 +137,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
    };

    /**
     * Example raw beacons captured from a Blue Charm BC011
     */
@@ -1589,8 +1598,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);
@@ -3700,6 +3708,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) {