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

Commit e074bdee authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Create memory safe overload of...

Merge "Create memory safe overload of BluetoothGattServer#notifyCharacteristicChanged" am: 649b99a7

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

Change-Id: I3372649c6e0c1160dd57b79216b897d0f7aeec66
parents da92fe80 649b99a7
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);