diff options
author | Prerepa Viswanadham <dham@google.com> | 2015-01-16 10:40:11 -0800 |
---|---|---|
committer | Prerepa Viswanadham <dham@google.com> | 2015-01-23 17:51:43 +0000 |
commit | e179b5686b48ae4e15ac26545ad40aab0c844f9d (patch) | |
tree | add74eff3fa5eb7a63ff10cadbf5e369f6e26b99 /framework/java | |
parent | 0190837e14c10d1d79293c3ed1205d70a01cfc4b (diff) |
Don't compute flags length for scan response
Bug 19041626
Change-Id: I7d8aa12e133477fc60d12b474f57313961021975
Diffstat (limited to 'framework/java')
-rw-r--r-- | framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java index e76c23b97a..67d9de5940 100644 --- a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java +++ b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java @@ -119,7 +119,7 @@ public final class BluetoothLeAdvertiser { } boolean isConnectable = settings.isConnectable(); 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); return; } @@ -171,11 +171,11 @@ public final class BluetoothLeAdvertiser { mLeAdvertisers.clear(); } - // Compute the size of the advertise data. - private int totalBytes(AdvertiseData data, boolean isConnectable) { + // Compute the size of advertisement data or scan resp + private int totalBytes(AdvertiseData data, boolean isFlagsIncluded) { if (data == null) return 0; // 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) { int num16BitUuids = 0; int num32BitUuids = 0; |