diff options
author | Tom Turney <tturney@google.com> | 2014-11-15 03:00:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-15 03:00:07 +0000 |
commit | 2a46722f96480aed028785e955cbb8cb506df0b2 (patch) | |
tree | ad8ffd8f6e4895a6475a11b36ffa8f8f29050451 | |
parent | 1c814b5c61c538c7ef5176b1121e1ea0c65046e6 (diff) | |
parent | 29230ceab9ea7b6913f0a898411b213f199e18c2 (diff) | |
download | frameworks_base-2a46722f96480aed028785e955cbb8cb506df0b2.zip frameworks_base-2a46722f96480aed028785e955cbb8cb506df0b2.tar.gz frameworks_base-2a46722f96480aed028785e955cbb8cb506df0b2.tar.bz2 |
Merge "Feature request: Increasing advertise data size on non-connectable adv. When the advertisement is non-connectable, give back the bytes to the advertiser where the adv flags would have been. This increases the non-connectable advertisement's advertise data from 24 to 27 bytes." into lmp-mr1-dev
-rw-r--r-- | core/java/android/bluetooth/le/BluetoothLeAdvertiser.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java index a019d5c..e76c23b 100644 --- a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java +++ b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java @@ -117,8 +117,9 @@ public final class BluetoothLeAdvertiser { AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED); return; } - if (totalBytes(advertiseData) > MAX_ADVERTISING_DATA_BYTES || - totalBytes(scanResponse) > MAX_ADVERTISING_DATA_BYTES) { + boolean isConnectable = settings.isConnectable(); + if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES || + totalBytes(scanResponse, isConnectable) > MAX_ADVERTISING_DATA_BYTES) { postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE); return; } @@ -171,9 +172,10 @@ public final class BluetoothLeAdvertiser { } // Compute the size of the advertise data. - private int totalBytes(AdvertiseData data) { + private int totalBytes(AdvertiseData data, boolean isConnectable) { if (data == null) return 0; - int size = FLAGS_FIELD_BYTES; // flags field is always set. + // Flags field is omitted if the advertising is not connectable. + int size = isConnectable ? FLAGS_FIELD_BYTES : 0; if (data.getServiceUuids() != null) { int num16BitUuids = 0; int num32BitUuids = 0; |