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

Commit 979ca36a authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

GATT: put include declarations before characteristics in service

BT spec Version 5.0 | Vol 3, Part G 3.1:
"All include definitions shall immediately follow the service
declaration and precede any characteristic definitions."

Bug: 78107486
Change-Id: Ifb61864d30fed450a73cd71c60b4e85666ae1458
parent 361cdba0
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -2888,6 +2888,17 @@ public class GattService extends ProfileService {
            db.add(GattDbElement.createSecondaryService(service.getUuid()));
        }

        for (BluetoothGattService includedService : service.getIncludedServices()) {
            int inclSrvcHandle = includedService.getInstanceId();

            if (mHandleMap.checkServiceExists(includedService.getUuid(), inclSrvcHandle)) {
                db.add(GattDbElement.createIncludedService(inclSrvcHandle));
            } else {
                Log.e(TAG,
                        "included service with UUID " + includedService.getUuid() + " not found!");
            }
        }

        for (BluetoothGattCharacteristic characteristic : service.getCharacteristics()) {
            int permission =
                    ((characteristic.getKeySize() - 7) << 12) + characteristic.getPermissions();
@@ -2901,17 +2912,6 @@ public class GattService extends ProfileService {
            }
        }

        for (BluetoothGattService includedService : service.getIncludedServices()) {
            int inclSrvcHandle = includedService.getInstanceId();

            if (mHandleMap.checkServiceExists(includedService.getUuid(), inclSrvcHandle)) {
                db.add(GattDbElement.createIncludedService(inclSrvcHandle));
            } else {
                Log.e(TAG,
                        "included service with UUID " + includedService.getUuid() + " not found!");
            }
        }

        gattServerAddServiceNative(serverIf, db);
    }