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

Commit 649b99a7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Create memory safe overload of BluetoothGattServer#notifyCharacteristicChanged"

parents 6180b2b1 c8a71f3b
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -940,13 +940,14 @@ public class GattService extends ProfileService {
        }

        @Override
        public void sendNotification(int serverIf, String address, int handle, boolean confirm,
        public int sendNotification(int serverIf, String address, int handle, boolean confirm,
                byte[] value, AttributionSource attributionSource) {
            GattService service = getService();
            if (service == null) {
                return;
                return BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND;
            }
            service.sendNotification(serverIf, address, handle, confirm, value, attributionSource);
            return service.sendNotification(serverIf, address, handle, confirm, value,
                attributionSource);
        }

        @Override
@@ -3669,11 +3670,11 @@ public class GattService extends ProfileService {
    }

    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    void sendNotification(int serverIf, String address, int handle, boolean confirm, byte[] value,
    int sendNotification(int serverIf, String address, int handle, boolean confirm, byte[] value,
            AttributionSource attributionSource) {
        if (!Utils.checkConnectPermissionForDataDelivery(
                this, attributionSource, "GattService sendNotification")) {
            return;
            return BluetoothStatusCodes.ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION;
        }

        if (VDBG) {
@@ -3682,7 +3683,7 @@ public class GattService extends ProfileService {

        Integer connId = mServerMap.connIdByAddress(serverIf, address);
        if (connId == null || connId == 0) {
            return;
            return BluetoothStatusCodes.ERROR_DEVICE_NOT_CONNECTED;
        }

        if (confirm) {
@@ -3690,6 +3691,8 @@ public class GattService extends ProfileService {
        } else {
            gattServerSendNotificationNative(serverIf, handle, connId, value);
        }

        return BluetoothStatusCodes.SUCCESS;
    }


+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ interface IBluetoothGatt {
    void sendResponse(in int serverIf, in String address, in int requestId,
                            in int status, in int offset, in byte[] value, in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    void sendNotification(in int serverIf, in String address, in int handle,
    int sendNotification(in int serverIf, in String address, in int handle,
                            in boolean confirm, in byte[] value, in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    void disconnectAll(in AttributionSource attributionSource);