summaryrefslogtreecommitdiff
path: root/framework/java/android
diff options
context:
space:
mode:
authorTom Turney <tturney@google.com>2014-11-12 16:26:41 -0800
committerTom Turney <tturney@google.com>2014-11-15 02:25:05 +0000
commit0f5abcc53cc66624550ba29c2bb5f9d1751a1bcc (patch)
tree0ad91b302dfe6aeb46bc3f8faf30a963909c2b8e /framework/java/android
parent5e003c3b0af5a885cb33b200adf2508ac12ed9dd (diff)
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. Bug:18359570 Change-Id: Ia3cc48dca50cc3c51095ee92a489f143f6d350b1
Diffstat (limited to 'framework/java/android')
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index a019d5cff2..e76c23b97a 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/framework/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;