Loading core/java/android/bluetooth/le/BluetoothLeAdvertiser.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -119,7 +119,7 @@ public final class BluetoothLeAdvertiser { } } boolean isConnectable = settings.isConnectable(); boolean isConnectable = settings.isConnectable(); if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES || if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES || totalBytes(scanResponse, isConnectable) > MAX_ADVERTISING_DATA_BYTES) { totalBytes(scanResponse, false) > MAX_ADVERTISING_DATA_BYTES) { postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE); postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE); return; return; } } Loading Loading @@ -171,11 +171,11 @@ public final class BluetoothLeAdvertiser { mLeAdvertisers.clear(); mLeAdvertisers.clear(); } } // Compute the size of the advertise data. // Compute the size of advertisement data or scan resp private int totalBytes(AdvertiseData data, boolean isConnectable) { private int totalBytes(AdvertiseData data, boolean isFlagsIncluded) { if (data == null) return 0; if (data == null) return 0; // Flags field is omitted if the advertising is not connectable. // Flags field is omitted if the advertising is not connectable. int size = isConnectable ? FLAGS_FIELD_BYTES : 0; int size = (isFlagsIncluded) ? FLAGS_FIELD_BYTES : 0; if (data.getServiceUuids() != null) { if (data.getServiceUuids() != null) { int num16BitUuids = 0; int num16BitUuids = 0; int num32BitUuids = 0; int num32BitUuids = 0; Loading Loading
core/java/android/bluetooth/le/BluetoothLeAdvertiser.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -119,7 +119,7 @@ public final class BluetoothLeAdvertiser { } } boolean isConnectable = settings.isConnectable(); boolean isConnectable = settings.isConnectable(); if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES || if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES || totalBytes(scanResponse, isConnectable) > MAX_ADVERTISING_DATA_BYTES) { totalBytes(scanResponse, false) > MAX_ADVERTISING_DATA_BYTES) { postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE); postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE); return; return; } } Loading Loading @@ -171,11 +171,11 @@ public final class BluetoothLeAdvertiser { mLeAdvertisers.clear(); mLeAdvertisers.clear(); } } // Compute the size of the advertise data. // Compute the size of advertisement data or scan resp private int totalBytes(AdvertiseData data, boolean isConnectable) { private int totalBytes(AdvertiseData data, boolean isFlagsIncluded) { if (data == null) return 0; if (data == null) return 0; // Flags field is omitted if the advertising is not connectable. // Flags field is omitted if the advertising is not connectable. int size = isConnectable ? FLAGS_FIELD_BYTES : 0; int size = (isFlagsIncluded) ? FLAGS_FIELD_BYTES : 0; if (data.getServiceUuids() != null) { if (data.getServiceUuids() != null) { int num16BitUuids = 0; int num16BitUuids = 0; int num32BitUuids = 0; int num32BitUuids = 0; Loading