summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
AgeCommit message (Collapse)Author
2022-06-30Revert "Revert "Reuse SynchronousResultReceivers instead of creating new.""Neha Jain
This reverts commit dd85e91cea26c7f706af36c852e79d5b4ca1f173. Bug: 217366135 Reason for revert: Need this to fix a crash bug in tm-dev Change-Id: I2a94c278edc0681c5b8af6ea0a0171b71d72c650 (cherry picked from commit dbaf406ccb0ed887d4e93057c9ec0d3457f14457) Merged-In: I2a94c278edc0681c5b8af6ea0a0171b71d72c650
2022-06-29Revert "Reuse SynchronousResultReceivers instead of creating new."Neha Jain
This reverts commit 02dcbe72b3564559eaa9c2e2714824e4aac6f18c. Reason for revert: Causing builds to fail b/237471430 Change-Id: I6165d838abf312085050359377f67a68a5f8b51a (cherry picked from commit f5dd42bbd05e68f7763ccaa9fae5642acc4ceba1) Merged-In: I6165d838abf312085050359377f67a68a5f8b51a
2022-06-29Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux
Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644 (cherry picked from commit 02dcbe72b3564559eaa9c2e2714824e4aac6f18c) Merged-In: If8ae530a284151888a3f89a51d2c58f2a5cd3644
2022-01-28Remove allowBlocking from BluetoothManagerServiceWilliam Escande
Since Bluetooth is becoming a mainline module, it can no longer call the allowBlocking hidden api. Instead, corresponding aidl are moved to be oneway and use a synchronous data to handle the return value. also: aosp/1927380 for similar work on all bluetooth profiles BluetoothGatt will be done next Bug: 211851706 Test: build + start bt Tag: #refactor Ignore-AOSP-First: merge conflict resolution Change-Id: I715cc2d8f2ae42be6d1099cd73095d37fa9e30f4
2022-01-06le advertisement address type settingsAndriy Naborskyy
add api to request public or random address type for advertisements. bug: 155993389 Bug: 199827901 Tag: #feature Test: atest BluetoothInstrumentationTests Test: ACTS, SL4A, IOP and BCST, CTS, GTS Change-Id: I4a2b9918e0f0cc31649e3c1952d9ba34f78d337f
2021-11-18Bluetooth: make it possible to advertise Transport Discovery DataJakub Pawlowski
Bug: 159363165 Tag: #feature Test: called the API in test app, verified advertisement content Change-Id: I92fe0671717bda2de1be3ff022713133ad681ab6
2021-04-22Pass attribution source to BT APIs.Oli Lan
This adds attribution source to BT method calls. This is now required to allow the app ops for the new BT permissions (BLUETOOTH_CONNECT, BLUETOOTH_ADVERTISE, and BLUETOOTH_SCAN) to be noted. Bug: 183626112 Test: atest BluetoothInstrumentationTests Change-Id: I81598553b762e491d6364064a2e1ef41dec89bf9
2021-04-16More Bluetooth API annotation updates.Jeff Sharkey
This change adds a "BluetoothPermissionChecker" that ensures that all Bluetooth permission annotations are consistent. In addition, it verifies that all Bluetooth public APIs have been audited to be permission protected where relevant. We've currently standardized on saying that APIs that return device or Bluetooth state information (without sharing details about any particular remote Bluetooth device) do not need to be permission protected. This change is only annotations and has no behavior changes. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: Ie80b15b058359bf1e9a6ee881b89cb3e5b584ca1
2021-04-15Refine BluetoothLeAdvertiser permissions.Jeff Sharkey
Technically these APIs required both ADVERTISE and CONNECT, since internally it would attempt getting the device name as part of calculating packet lengths. These methods shouldn't require the CONNECT permission, so we add a getNameLengthForAdvertise() method internally to remove this dependency. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I245417bfc26d6d3a4f8be14077c7f1d271b5959e
2021-04-14Update Bluetooth API annotations.Jeff Sharkey
Recent work has introduced a new "Nearby devices" runtime permission which protects all existing Bluetooth APIs; we've done this by defining a <split-permission> to convert the old BLUETOOTH and BLUETOOTH_ADMIN permissions into one of three new permissions: * BLUETOOTH_ADVERTISE: Required to be able to advertise to nearby Bluetooth devices. * BLUETOOTH_CONNECT: Allows applications to connect to paired bluetooth devices. * BLUETOOTH_SCAN: Required to be able to discover and pair nearby Bluetooth devices. At its core, this change begins updating the Bluetooth APIs to have correct @RequiresPermission indicating which permission is actually enforced internally. To ensure alignment across Binder, the newly added "RequiresPermissionChecker" Error Prone checker was used to discover any inconsistencies, ensuring correctness from server-side enforcement up through to the public APIs. In addition, since developers will continue building apps for both modern and legacy platforms, this change introduces new auto-doc annotations which will emit helpful consistent documentation describing the behavior of older devices that are still using the old permission model. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I02aa127e8e07f239561f4f2a3bbdfc6fccb82f7f
2020-10-08Bluetooth: make it possible to advertise service solicitation UUIDJakub Pawlowski
Bug: 159827149 Tag: #feature Test: called the API in test app, verified advertisement content Change-Id: I3ab43e39bb7fd8fef97e141eeb981419aa3ec35a
2018-08-08Fix NPE when starting advertising with null GATTJakub Pawlowski
Bug: 112164168 Change-Id: I82be0e06e990cc116d3ab48de80b5bb170d69892
2017-08-24Fix checkstyle errors (2/2)Jack He
* Manual style corrections with IDE assistance * Variable name refactors are done through IDE * Corrected general style errors such as: - "final private var" -> "private final var" - "&&", "+", "||" should not be at the end of line - Non-static private variable should be like "mVar" - Private static variable should be like "sVar" - Code file should always end with newline - Inherited methods should be annotated with @Override and no @hide tags - Public methods should always have a JavaDoc entry - "int[] array" is preferred over "int array[]" - private methods should be accessed without "this." when there is no name collisions. - "boolean ? true : false" -> boolean - "boolean ? false : true" -> !boolean - "boolean == true" OR "boolean != false" -> boolean - "boolean != true" OR "boolean == false" -> !boolean Bug: 63596319 Test: make checkbuild, no functional changes Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
2017-08-24Fix checkstyle errors (1/2)Jack He
* Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
2017-08-17Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails"Treehugger Robot
2017-08-17Bluetooth: Don't throw exception when stopAdvertisingSet failsJakub Pawlowski
When advertising is stopped while Bluetooth is disabled, we should not throw any exceptions, just log the failure. This was the default behaviour before the AdvertisingSet was introduced. Bug: 63819108 Test: manual Change-Id: I518e071b77b127973aee6f24fa6ced4f28bc9531
2017-08-17Bluetooth: Fix startAdvertisingSet error handlingJakub Pawlowski
Calls to old advertising API (startAdvertising), should never throw exceptions. Instead, it used to post failure callback. This behaviour was accidentally modified when implementing new API. Right now, instead of posting error callback, we throw IllegalArgumentException if we fail to obtain BluetoothGatt object, or the call to startAdvertisingSet fails. This patch brings back the old behaviour to the API. It also makes new API post callback instead of throwing exception in this error case. Bug: 63819108 Test: manual Change-Id: I897b99839f899ca3f3dc609918d665c8c327b777
2017-06-19Remove legacy advertiser from map after it's no longer usedJakub Pawlowski
Test: manual Bug: 62597369 Change-Id: Ief1e1b054f29b59b1ed72514b138d4f209f9847a
2017-04-24Get rid of the IAdvertiserCallabckJakub Pawlowski
Bug: 30622771 Test: none Change-Id: I2c55f96e71cd3be67f88201ab07c91730cd85971
2017-04-19Expose LE advertiser address for easier PTS tests (1/6)Jakub Pawlowski
This patchset adds a hidden method getOwnAddress, that lets app with BLUETOOTH_PRIVILEGED permission to lear their own addreess. This is done exclusively for PTS tests. Bug: 35147497 Test: manual Change-Id: Iaf0f2fe0613de44b8430ac25e691d66a4ad44f8d
2017-04-12Bluetooth 5 PHY simplificationJakub Pawlowski
Having PHY_LE_* constants defined in four different places, with one value being different than others is misleading. Leave just PHY_LE_* definitions in BluetoothDevice, and add PHY_LE*_MASK for the mask used in PHY update API. This patch also removes need to translate PHY value between PHY update request and event, as mask is used for request, and the value is returned in event. Bug: 30622771 Test: manual Change-Id: I897effa1204a024465d55501c83c542566c4d37c
2017-04-11Remove enable from PeriodicAdvertisingPariameters (1/2)Jakub Pawlowski
Instead of setting enable to true, one can just pass null PeriodicAdvertisingParameters and achieve same result when starting the set. Passing the "enable" when updating the parameters make no sense, and might be confusing. Experience with "timeout" field, which was a part of AdvertiseSettings show that merging fields that go into different HCI commands can cause problems during processing, so keep enable as separate field. Test: manual Bug: 30622771 Change-Id: Ida02c59eb8433537179b4d22202fe745f8b4bb3e
2017-04-01Bluetooth 5 advertising duration refactoring (4/4)Jakub Pawlowski
Expose both duration and maximum extended advertising events to limit advertising time. Test: manual Bug: 30622771 Change-Id: I44df300995ef985526b93f8c24389775720b3432
2017-04-01Bluetooth LE Advertising minor improvementsJakub Pawlowski
This patch adds some additional error checking for the advertising set parameters, and some more comments. Test: manual Bug: 30622771 Change-Id: I87bd44f4179ef63694ad3ed656dc2acc52e40f1e
2017-03-31Fix advertise data size estimationJakub Pawlowski
UUID in service data field can be 2, 4, or 16 bytes long. Test: manual Bug: 36553478 Change-Id: Ib5ba2d16065496ca311e8642a15a7ea6bc84d4c1
2017-03-22Bluetooth 5 Enable->Enabled (1/2)Jakub Pawlowski
Test: manual Bug: 30622771 Change-Id: I37b198927076a0267de67e1bd94eaea9e88e53bb
2017-03-21Add setScannable to AdvertisingSetParameters (1/2)Jakub Pawlowski
There must be a proper way to specify if advertisment is scannable, when updating the parameters. Test: manual Bug: 30622771 Change-Id: Ie520609d3fff07ccc2960015c19311d773842852
2017-03-21Add missing txPower parameterJakub Pawlowski
Test: manual Bug: 30622771 Change-Id: Iaf3111d7545f9bb046b5a23b680347a75125ca7e
2017-03-20Bluetooth 5 AdvertisingSet implementation (1/4)Jakub Pawlowski
Test: manual Bug: 30622771 Change-Id: Ia89718c0c2ab2eaa71b158ecdcae989af907769f
2017-03-17Bluetooth 5 move timeout parameter (1/2)Jakub Pawlowski
Timeout is not a parameter, it is a property of enabling the advertising. Move it into more proper place. Test: manual Bug: 30622771 Change-Id: I09ebc6c770bc02938ea16a9738a7e03dc8006fde
2017-03-16Bluetooth 5 AdvertisingSet implementation (1/4)Jakub Pawlowski
This patch wires up fist methods of AdvertisingSet, making it possible to start advertising and stop advertising. It also replaces legacy implemementation with calls to new implementation. Bug: 30622771 Test: sl4a ConcurrentBleAdvertisingTest Change-Id: I80a4b1b2b632d5ef8a80d958615897684cfa0c16
2017-03-08Bluetooth 5 Advertising APIJakub Pawlowski
Test: manual Bug: 30622771 Change-Id: Id6856e6110872ec50ff1af54ddc75c0104a6459c (cherry picked from commit 5324a14cf490656269ef862d7f8f6b139a21c0e6)
2016-11-22Bluetooth: report proper advertiser status on errorJakub Pawlowski
When advertiser is not started because too many advertisers are registered, return proper error code. Bug: 30622771 Test: sl4a ConcurrentBleAdvertisingTest Change-Id: I57384ff30132e9a7ee17dcf191ff89baa7abf1ef
2016-11-11Bluetooth: advertising improvementsJakub Pawlowski
This patch removes isPeripheralModeSupported(), hidden public method which is always returning true. It also modify the BluetoothLeAdvertiser to be able to use advertising instance with instance id equal 0. Bug: 30622771 Bug: 24099160 Change-Id: Id31582621dbe56d5c3a8d4ee5cd296af66a5f026
2016-10-27Separate LE scanner from GATT client (1/4)Jakub Pawlowski
Right now, LE scanning functionality is combined with the GATT client. This is the source of various bugs, like scans suddenly stoppinging when a GATT client is killed. It also increases memory consumption, because we associate many structures with a GATT client, which are not necessary when just scanning. Test: sl4a BleScanApiTest ConcurrentBleScanTest Change-Id: I0c25bd4a58bb430eb0ee4100d5f2bbab194f9621
2016-08-31Separate advertiser from GATT client (1/4)Jakub Pawlowski
Bug: 30622771 Change-Id: I08c0498f8a1ea04423d3e864e9a60c7c78f1dbad
2016-05-13Properly handle registration timeout in BLE.Wei Wang
Bug:25384098 Change-Id: I7877f6368c4982fcd91e68810c4da0ab7b5fc6b7
2015-06-25Preventing leakJerome Poichet
When transitioning from ON to OFF with LE Advertisers, advertiser do not get a chance to unregister themselves as the stopAdvertising checks the state of the stack and throws before unregistering the object. It will then never remove the callback objects causing a leak. b/22092678 | Remote service crash after switching to restricted profile Change-Id: I04817026a524d10d60abdd8b533554a71a0112e2
2015-01-23Don't compute flags length for scan responsePrerepa Viswanadham
Bug 19041626 Change-Id: I7d8aa12e133477fc60d12b474f57313961021975
2014-11-15Feature request: Increasing advertise data size onTom Turney
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
2014-10-09Add support of advertising through standard instance.(1/4)Wei Wang
Use config overlay to check whether peripheral mode is supported. Bug: 17552672 Change-Id: I1081bc84da9fe033426f82ece2ec74c2d663e3aa
2014-09-02Unregister app when advertise failed after registration.Wei Wang
Also moved bluetooth state check to common utils class. Bug:17364837 Change-Id: I25ff7afae723d47f701236d5a68eab8015de9bbb
2014-08-19Fix threading issue for advertising.Wei Wang
Post callback to main thread to execute. In general we should avoid running app's callback method from binder thread as the callback method may block. Also removed callback from advertisers on stop advertising callback. This fixes the issue of not being able to restart adv for limited advertising. Bug: 17045567 Change-Id: I56cd2bdf4b1ad120a0358fa4065ad77be4bff144
2014-08-13Clean up advertise and scan clients upon bluetooth down.Wei Wang
Fixes b/16528460 This allows Advertiser and Scanner to be reused after bluetooth recycle, which follows same behavior for BluetoothAdapter. Also prints manufacturer data array for ScanRecord. Change-Id: I78bca40ac294433782a054bf2a00a775dac02d96
2014-08-01Add a default impelementation of IBluetoothGattCallback(1/2).Wei Wang
Also cleaned up a few TODOs and fixed bug. b/16410260 AdvertiseCallback null onSuccess callback Change-Id: I75a582c03be1e2ef6964c2cbeba42aaaf9f9e17c
2014-08-01Revert "Revert "Service data and manufacturer data can be repeated fields.""Wei Wang
This reverts commit 14c797702543bb5ced989565d90abcfa55c7db46.
2014-08-01Revert "Service data and manufacturer data can be repeated fields."Sungsoo Lim
This reverts commit 26dc9b99b17ca9d8ce3632c48e8b6c1450ee53e9. Change-Id: I1846d0a6491c5b2ba5905411bd98f5d17909b705
2014-07-31Service data and manufacturer data can be repeated fields.Wei Wang
b/16635899 Change-Id: I73f1f4effd3f0e38cd427297eb9d22f3ba285d61
2014-07-29Fix crash in Stopping/Starting BLE advertising afterPrerepa Viswanadham
BluetoothAdapter cycling Bug 16528460 Change-Id: Iad852bc93d307c5ca5f7e42f24248aa02c105e8a
2014-07-23Move AdvertiseData length check to BluetoothAdvertiser.Wei Wang
This will keep AdvertiseData simple and avoid coupling with BluetoothAdapter. Change-Id: I3609652bdea1c6e757bac7d2dada7f8ddf20a5e3