aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/BluetoothLeScanner.java
Commit message (Collapse)AuthorAgeFilesLines
* Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux2022-06-221-7/+7
| | | | | | | | Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644
* Remove allowBlocking from BluetoothManagerServiceWilliam Escande2022-01-281-14/+34
| | | | | | | | | | | | | | | 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
* Merge "Add scan result logs."Treehugger Robot2021-12-161-1/+12
|\
| * Add scan result logs.Mehmet Murat Sevim2021-10-151-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some GMSCore modules are missing some scan result despite the peer device is discovered by the Android BT stack. These logs will help debug such problems. Bug: 154942993 Bug: 199827901 Test: IOP and BCST Tag: #stability Change-Id: I6bd98df09ea2beb695aa9b4ac63bde307e77b182 (cherry picked from commit f204effb5cc6f1cc8e5e3f75ef343db3bd339b67)
* | Copy attributable to BluetoothWilliam Escande2021-12-141-1/+1
|/ | | | | | | | | | Attributable is called by bluetooth and it's hidden. By copying into bluetooth we are now allowed to call it Bug: 210467788 Test: build Tag: #refactor Change-Id: I73ea07c9439988ab5477c82799f718c6d81513be
* Bluetooth: deprecate TruncatedFilter and ResultStorageDescriptorJakub Pawlowski2021-07-141-0/+3
| | | | | | | | | It's not used anywhere, and the implementation actually never do anything. Bug: 192615539 Merged-In: Icf8906c972cf18d65a22d30c3a628fd54db59179 Change-Id: Icf8906c972cf18d65a22d30c3a628fd54db59179
* Get rid of ResultStorageDescriptor in startScanJakub Pawlowski2021-07-141-15/+8
| | | | | | | | It's never used Bug: 192615539 Merged-In: Ia2d65def69b13150a20e8a2077c3fe630f8ec86e Change-Id: Ia2d65def69b13150a20e8a2077c3fe630f8ec86e
* More Binder call AttributionSource assignment.Jeff Sharkey2021-06-031-0/+4
| | | | | | | | | | | | | | | Since developers can use a BluetoothDevice object can make remote calls, it needs to have an accurate AttributionSource. Previous CLs had updated many places where these BluetoothDevice instances were passed across Binder interfaces, but this change updates several remaining locations which had been missed. Introduces new "Attributable" marker interface to offer consistent tooling when applying AttributionSource updates. Bug: 187097694 Test: atest BluetoothInstrumentationTests Change-Id: Icad3b9726591f0fbad58a493cefa5a0af7648280
* Pass attribution source to BT APIs.Oli Lan2021-04-221-14/+16
| | | | | | | | | | | 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
* Add missing Bluetooth API permission enforcement.Jeff Sharkey2021-04-181-0/+3
| | | | | | | | | | | | | | | | Recent work has been using Error Prone rules and annotations to reflect the current state of permission enforcement across the Bluetooth stack, and we're now in a position were we can add new permission enforcement that had been missing. 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. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I37a9e03ecdca6f7a6eb9d7f094e2f95a97036612
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-8/+4
| | | | | | | | | | | | | | | | | | 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
* Update Bluetooth API annotations.Jeff Sharkey2021-04-141-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Pass AttributionSource to bluetooth scanning methods.Oli Lan2021-04-011-10/+7
| | | | | | | | | | | | This passes the AttributionSource to AdapterService and GattService methods that perform scanning or discovery. Bug: 183203469 Test: atest GattServiceTest Test: atest AdapterServiceTest Test: atest CtsPermissionTestCases:android.permission.cts.NearbyDevicesPermissionTest Change-Id: Id68558624fbae69eac3a8613b9536eb6e0df75bf
* BluetoothLeScanner: clarify the documentation for permission requirements ↵Jakub Pawlowski2020-05-131-6/+9
| | | | | | | for startScan Bug: 145153879 Change-Id: I698952f67cfc97a33b703096cbba65129a91c220
* Pipe featureId from app to noteOp in BT codePhilip P. Moltmann2019-12-131-7/+13
| | | | | | | | | | | | | | | FeatureIds are not yet available, hence in BTManager we assume always a "null" featureId. The effect of this change is that for apps that opt into using featureIds, they will have one BluetoothAdapter per feature, not one per process as before. In my testing this caused no problem. Most apps won't use featureIds, hence for most apps there is no change in behavior. Test: used bluetooth Bug: 136595429 Change-Id: Ic40326ea331c60f764f213bb2673cb4c49a81604
* Merge "Add note for FLAG_CANCEL_CURRENT when stopping scan" am: ff0bb06f52 ↵Stanley Tng2018-08-211-1/+3
|\ | | | | | | | | | | | | | | am: d63c1209ed am: cf825b33a0 Change-Id: I9d7ade22e528dac625debb580b0ebc54022b83a1
| * Merge "Add note for FLAG_CANCEL_CURRENT when stopping scan"Treehugger Robot2018-08-211-1/+3
| |\
| | * Add note for FLAG_CANCEL_CURRENT when stopping scanStanley Tng2018-08-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a note in the Android API documentation for stopScan to make sure that the flag FLAG_CANCEL_CURRENT is not used when creating the PendingIntent parameter. Bug: 77658091 Test: Just compile since not logic is changed Change-Id: I55f33ae68679310ba4899708a2072a40fea0b3b4
* | | Fix unregisterScanner call in BluetoothLeScanner.Claire Treyz2018-07-261-2/+2
|/ / | | | | | | | | | | | | | | | | LE scanners were originally part of the GATT client, but were seperated out and have their own registration API, so the BluetoothLeScanner call to unregisterClient should be updated to call unregisterScanner. Bug:75984723 Change-Id: I4c0543beb6d7b706cf75e78fcfb58480a6efd1d8
* / BatteryStats: Add WorkChain support for WiFi events.Narayan Kamath2018-01-041-1/+1
|/ | | | | | | | | | The changes are straightforward, the only change outside of BatteryStats is to use the new WorkSource.isEmpty API to account for WorkChains in a given WorkSource. Bug: 62390666 Test: BatteryStatsBackgroundStatsTest, BatteryStatsNoteTest, WifiLockManagerTest Change-Id: I1dff43b6f2a09877e3af4442bfe8a8fd80b1ba74
* Merge "Javadoc update for permission requirements" into oc-mr1-devAmith Yamasani2017-09-081-0/+5
|\ | | | | | | | | | | am: 2ce2f84999 Change-Id: I6703ab1128202f5928d574c55d0f4a9129c95b60
| * Javadoc update for permission requirementsAmith Yamasani2017-09-071-0/+5
| | | | | | | | | | | | | | | | | | Bluetooth scanning requires holding these permissions for results to be delivered. Bug: 65013767 Test: N/A Change-Id: I0b5fa9efa7fc8d5cff25319fbd7719cedee6a4aa
| * Fix GATT client leakage when scan is throttled (1/2)Jakub Pawlowski2017-08-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Currently, scan throttling happens after client is registered, but before the scan is started. This might lead to scan client being leaked. This patch fixed that by moving check before client registration. Bug: 64887233 Test: manual Change-Id: I22ae624a0c51110cb69679f796926e3b2b36d0ac Merged-In: I22ae624a0c51110cb69679f796926e3b2b36d0ac (cherry picked from commit 01ea3736138c612f04ccee60adf68a5b0e2d5b7d)
* | Merge "Update documentation for startScan"Vinay Kalia2017-09-061-1/+6
|\ \ | | | | | | | | | | | | | | | am: 7d2219d170 Change-Id: I5ea7a5a9b0a69168a1715986e4850276299af78a
| * | Update documentation for startScanVinay Kalia2017-09-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With change c4a1e1, unfiltered BLE scans are stopped on screen off and resumed when screen is turned back on. This is done to save power. This change updates the documentation accordingly. BUG: 62264269 Test: Documentation update. Change-Id: I2d8e9f9f122f978c4d4f59d4139cb51cd4e4a123
* | | Merge "Fix GATT client leakage when scan is throttled (1/2)"Jakub Pawlowski2017-08-291-1/+9
|\| | | | | | | | | | | | | | | | | am: 3cc1ad87f0 Change-Id: Ieda555f6f8bda35201327c6c6e0c97621b88671e
| * | Fix GATT client leakage when scan is throttled (1/2)Jakub Pawlowski2017-08-281-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, scan throttling happens after client is registered, but before the scan is started. This might lead to scan client being leaked. This patch fixed that by moving check before client registration. Bug: 64887233 Test: manual Change-Id: I22ae624a0c51110cb69679f796926e3b2b36d0ac
* | | Merge changes from topic "bt-fix-checkstyle-errors"Jack He2017-08-241-24/+26
|\| | | |/ |/| | | | | | | am: 94bbd4256d Change-Id: I4e619cb17582a6cc954814654820cd945f66e1cc
| * Fix checkstyle errors (2/2)Jack He2017-08-241-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * Fix checkstyle errors (1/2)Jack He2017-08-241-16/+19
| | | | | | | | | | | | | | | | * Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
* | Fix BLE scan leaksVinay Kalia2017-07-281-1/+2
|/ | | | | | | | | | | | | | | If an app starts multiple scans with same callback then there is a collision in mLeScanClients hash map which results in leaking first scan. This change fixes it by not allowing the second scan with same callback. BUG: 62389939 BUG: 38198694 Test: Tested applications which started multiple scans with same callback. Change-Id: I569069a40b6f8b4b8bb070731225e732c6b23ec8
* Clarify startScan API on how to get resultsAmith Yamasani2017-06-211-0/+5
| | | | | | | | | Make it clear in BluetoothLeScanner on how to get results when starting a scan for a PendingIntent. Bug: 38365430 Test: make offline-sdk-docs Change-Id: I0bf88d751c89a8a478db985713357e153ac08595
* Bluetooth: Move Bluetooth battery stats tracking (1/2)Ajay Panicker2017-05-041-2/+2
| | | | | | | | | | Move Bluetooth battery stats tracking to AppScanStats for a more unified tracking system. Bug: 37720787 Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testBleScans Perform BLE scan and check battery stats Change-Id: Ie6c682374e6e258c291d3a11eede649c7747ef40
* Add link to class with constantsAmith Yamasani2017-04-241-1/+1
| | | | | | | | Addresses api-council feedback Change-Id: I2dcd526a266a2320b34c714fd91fb4a83d382d9c Fixes: 37536012 Test: make update-api
* More auto-doc work.Jeff Sharkey2017-04-211-6/+0
| | | | | | | | | | | | | | Add support for AnyThread, CallSuper, and UiThread. Another related CL started documenting @RequiresPermission, so remove duplicated information in existing APIs. Suppress auto-doc on a handful of classes that are already well-documented. Test: make -j32 offline-sdk-docs Bug: 37526420 Change-Id: I791437dccec0f11d5349a23b982ba098cb551af8
* BLE scan API using PendingIntentAmith Yamasani2017-04-141-25/+99
| | | | | | | | | | | This allows apps to listen for beacons, etc., without having to run a foreground service and register a callback. They can instead register a PendingIntent which will be fired when scan results are available or when an error occurs. Bug: 37254611 Test: WIP Change-Id: I1793eee67ff0211370ed6fc38be4d95a4c5853f5
* Separate LE scanner from GATT client (1/4)Jakub Pawlowski2016-10-271-30/+29
| | | | | | | | | | | 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
* Properly handle registration timeout in BLE.Wei Wang2016-05-131-11/+14
| | | | | Bug:25384098 Change-Id: I7877f6368c4982fcd91e68810c4da0ab7b5fc6b7
* Add WorkSource to BLE scanning APIAdam Lesinski2016-01-181-11/+53
| | | | | | | | This will allow apps that do work on behalf of others to correctly blame those apps for the power implications of BLE scanning. Bug:22718669 Change-Id: Ib64af0b6a5d37721a6067ac4e5c39c01f921b56b
* Added a note about location permissionFyodor Kupolov2015-07-161-0/+8
| | | | | | | | ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission is required to get results. Bug: 21852542 Change-Id: I3a2746d691f4d7024b0bb7b884d4436c73ce82e6
* Do not return devices when caller has no location permissionFyodor Kupolov2015-07-091-1/+2
| | | | | | | | During startLeScan, do not return devices if calling process has no location permission/appop Bug: 21852542 Change-Id: Idce8f4704558574e373e8144390f2a2fa1a7e84a
* Add bluetooth permission annotationsTor Norbye2015-05-151-0/+5
| | | | Change-Id: I5bc86f8ec6ea5c873f1e14dab0e0c47c5c9df7f7
* Merge commit '7968421' into merge2Etan Cohen2015-04-241-0/+12
|\
| * Manage onfound/lost resources (1/2)Prerepa Viswanadham2015-04-211-0/+12
| | | | | | | | | | | | | | Provide error callback to app if advertisement tracking resources can't be reserved Change-Id: Ie66b2ec7a64b24bbdf3bb22003a4a7eb46623792
* | am b5e0cfb..557d2f5 from mirror-m-wireless-internal-releaseVinit Deshpande2015-04-141-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 557d2f5 Merge "Add ConnectivityManager.reportNetworkConnectivity() API" into m-wireless-dev 9653e27 Fix onLost/onFound logic in isSettingsAndFilterComboAllowed bfd17b7 Add ConnectivityManager.reportNetworkConnectivity() API c0a7c93 OBEX Over L2CAP + SDP search API for BT profiles 31a94f4 Add ConnectivityManager.getActiveNetwork(). Rework NetID allocation in ConnectivityService so registerNetworkAgent() can return the allocated NetID. bf18bed Merge "Non-functional code cleanup of ConnectivityService." into m-wireless-dev db8784e Merge "Cleanup of Video Call pause functionality." into m-wireless-dev e75b9e3 Non-functional code cleanup of ConnectivityService. 98d25c5 Onfound onlost feature. 0326f58 Merge "API for config app." into m-wireless-dev e9b056f API for config app. d5351e7 RTT framework interface update 582b868 Unhide Network.openConnection(URL, Proxy). 0d719ca Fix typos in ConnectivityManager documentation. Change-Id: Ib4c88f6d7ad1b24227b032555c62a5804194384b
| * Fix onLost/onFound logic in isSettingsAndFilterComboAllowedtturney2015-04-131-2/+2
| | | | | | | | | | | | bug: b/20185066 Change-Id: If9e3fecd12ee86aa12fa63688babeff694bee62e
* | Merge "Merge commit '98d25c5' into merge_work"Prerepa Viswanadham2015-04-121-0/+39
|\|
| * Onfound onlost feature.Prerepa Viswanadham2015-04-071-0/+39
| | | | | | | | | | Change-Id: I5475cb21183abab8cf04af486ff7692396801b92 Signed-off-by: Prerepa Viswanadham <dham@google.com>
* | Fix a typo in BluetoothLeScanner documentationScott Kennedy2015-04-101-1/+1
|/ | | | Change-Id: Id19dae9a583c0ef621789604277e3f6c6aead80c
* Remove spammy log information for BLE scan.Wei Wang2014-10-181-2/+3
| | | | Bug:17574681 Change-Id: Ic5761ad7262200f38f2b67659c37f8a3f01d80d5