summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/BluetoothLeScanner.java
AgeCommit message (Collapse)Author
2022-07-26Merge TP1A.220624.020Deyao Ren
Change-Id: I357db3da652d8ce93bb26a00d0f123fae1b7c64c
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-03-07Merge TP1A.220209.001Deyao Ren
Change-Id: Id0e2895d3220831d2c617a243047e8229af8acc9
2022-02-04Merge TP1A.220120.003Haamed Gheibi
Change-Id: I202f5093bbd13b381ea11f969fee6154ba91fa11
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
2021-12-16Merge "Add scan result logs."Treehugger Robot
2021-12-14Copy attributable to BluetoothWilliam Escande
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
2021-10-15Add scan result logs.Mehmet Murat Sevim
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)
2021-07-14Bluetooth: deprecate TruncatedFilter and ResultStorageDescriptorJakub Pawlowski
It's not used anywhere, and the implementation actually never do anything. Bug: 192615539 Merged-In: Icf8906c972cf18d65a22d30c3a628fd54db59179 Change-Id: Icf8906c972cf18d65a22d30c3a628fd54db59179
2021-07-14Get rid of ResultStorageDescriptor in startScanJakub Pawlowski
It's never used Bug: 192615539 Merged-In: Ia2d65def69b13150a20e8a2077c3fe630f8ec86e Change-Id: Ia2d65def69b13150a20e8a2077c3fe630f8ec86e
2021-06-03More Binder call AttributionSource assignment.Jeff Sharkey
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
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-18Add missing Bluetooth API permission enforcement.Jeff Sharkey
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
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-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
2021-04-01Pass AttributionSource to bluetooth scanning methods.Oli Lan
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
2020-05-13BluetoothLeScanner: clarify the documentation for permission requirements ↵Jakub Pawlowski
for startScan Bug: 145153879 Change-Id: I698952f67cfc97a33b703096cbba65129a91c220
2019-12-13Pipe featureId from app to noteOp in BT codePhilip P. Moltmann
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
2018-08-21Merge "Add note for FLAG_CANCEL_CURRENT when stopping scan" am: ff0bb06f52 ↵Stanley Tng
am: d63c1209ed am: cf825b33a0 Change-Id: I9d7ade22e528dac625debb580b0ebc54022b83a1
2018-08-21Merge "Add note for FLAG_CANCEL_CURRENT when stopping scan"Treehugger Robot
2018-08-20Add note for FLAG_CANCEL_CURRENT when stopping scanStanley Tng
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
2018-07-26Fix unregisterScanner call in BluetoothLeScanner.Claire Treyz
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
2018-01-04BatteryStats: Add WorkChain support for WiFi events.Narayan Kamath
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
2017-09-08Merge "Javadoc update for permission requirements" into oc-mr1-devAmith Yamasani
am: 2ce2f84999 Change-Id: I6703ab1128202f5928d574c55d0f4a9129c95b60
2017-09-07Javadoc update for permission requirementsAmith Yamasani
Bluetooth scanning requires holding these permissions for results to be delivered. Bug: 65013767 Test: N/A Change-Id: I0b5fa9efa7fc8d5cff25319fbd7719cedee6a4aa
2017-09-06Merge "Update documentation for startScan"Vinay Kalia
am: 7d2219d170 Change-Id: I5ea7a5a9b0a69168a1715986e4850276299af78a
2017-09-05Update documentation for startScanVinay Kalia
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
2017-08-29Fix GATT client leakage when scan is throttled (1/2)Jakub Pawlowski
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)
2017-08-29Merge "Fix GATT client leakage when scan is throttled (1/2)"Jakub Pawlowski
am: 3cc1ad87f0 Change-Id: Ieda555f6f8bda35201327c6c6e0c97621b88671e
2017-08-28Fix GATT client leakage when scan is throttled (1/2)Jakub Pawlowski
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
2017-08-24Merge changes from topic "bt-fix-checkstyle-errors"Jack He
am: 94bbd4256d Change-Id: I4e619cb17582a6cc954814654820cd945f66e1cc
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-07-28Fix BLE scan leaksVinay Kalia
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
2017-06-21Clarify startScan API on how to get resultsAmith Yamasani
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
2017-05-04Bluetooth: Move Bluetooth battery stats tracking (1/2)Ajay Panicker
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
2017-04-24Add link to class with constantsAmith Yamasani
Addresses api-council feedback Change-Id: I2dcd526a266a2320b34c714fd91fb4a83d382d9c Fixes: 37536012 Test: make update-api
2017-04-21More auto-doc work.Jeff Sharkey
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
2017-04-14BLE scan API using PendingIntentAmith Yamasani
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
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-05-13Properly handle registration timeout in BLE.Wei Wang
Bug:25384098 Change-Id: I7877f6368c4982fcd91e68810c4da0ab7b5fc6b7
2016-01-18Add WorkSource to BLE scanning APIAdam Lesinski
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
2015-07-16Added a note about location permissionFyodor Kupolov
ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission is required to get results. Bug: 21852542 Change-Id: I3a2746d691f4d7024b0bb7b884d4436c73ce82e6
2015-07-09Do not return devices when caller has no location permissionFyodor Kupolov
During startLeScan, do not return devices if calling process has no location permission/appop Bug: 21852542 Change-Id: Idce8f4704558574e373e8144390f2a2fa1a7e84a
2015-05-15Add bluetooth permission annotationsTor Norbye
Change-Id: I5bc86f8ec6ea5c873f1e14dab0e0c47c5c9df7f7
2015-04-24Merge commit '7968421' into merge2Etan Cohen
2015-04-21Manage onfound/lost resources (1/2)Prerepa Viswanadham
Provide error callback to app if advertisement tracking resources can't be reserved Change-Id: Ie66b2ec7a64b24bbdf3bb22003a4a7eb46623792
2015-04-14am b5e0cfb..557d2f5 from mirror-m-wireless-internal-releaseVinit Deshpande
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