aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux2022-06-221-1/+1
| | | | | | | | Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644
* Remove allowBlocking from BluetoothManagerServiceWilliam Escande2022-01-281-2/+10
| | | | | | | | | | | | | | | 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 "Moved AttributionSource related APIs in AttributionSource"Etienne Ruffieux2021-12-161-32/+2
|\
| * Moved AttributionSource related APIs in AttributionSourceEtienne Ruffieux2021-12-151-32/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Modified myAttributionSource() to check for global AS for process in ActivityThread and fallback to building new AS with PackageManager#getPackageForUid(myUid()) if null. Tag: #feature Bug: 210467846 Bug: 210468546 Test: build Change-Id: I7aa75395469bf0bb806100420faaf98c52057355 CTS-Coverage-Bug: 210906055
* | Copy attributable to BluetoothWilliam Escande2021-12-141-1/+0
|/ | | | | | | | | | 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
* Revert "Removed BluetoothDevice#prepareToEnterProcess"Etienne Ruffieux2021-10-251-8/+5
| | | | | | | | | This reverts commit 39639385f90678e97aa6848ae3b43de6bfb3b49e. Reason for revert: Introducing regression for gms core Test: None Change-Id: I644b10c1869c12e1622300de43bfbdb57fb583d8
* Removed BluetoothDevice#prepareToEnterProcessEtienne Ruffieux2021-10-151-5/+8
| | | | | | | Tag: #feature Bug: 200202780 Test: manual Change-Id: I8d4be1da1bcb5b819c324f1a3a89c7dc317c31d6
* Use AttributionSource BuilderWilliam Escande2021-09-221-2/+3
| | | | | | | | | | | Attribution source constructor are hidden api Add a Builder option to take a AttributionSource as parameter Test: atest BluetoothInstrumentationTests Bug: 195144968 Tag: #refactor Ignore-AOSP-First: No such thing on aosp Change-Id: I901c8afff6a40bd8484fd8e10baf290aa483c280
* More Binder call AttributionSource assignment.Jeff Sharkey2021-06-031-2/+5
| | | | | | | | | | | | | | | 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
* More AttributionSource plumbing.Jeff Sharkey2021-04-231-24/+35
| | | | | | | | | | | | | | | | To prepare for future work which will plumb AttributionSource values through all remaining AIDLs, we need profiles to interact directly with the specific BluetoothAdapter they were created from. This is how we'll ensure that the relevant AttributionSource can be chained down from the original Context they're obtained from. This change also marks getDefaultAdapter() as deprecated to clearly communicate that BluetoothManager.getAdapter() is the best-practice path to obtaining a correctly scoped BluetoothAdapter instance. Bug: 183626112 Test: atest BluetoothInstrumentationTests Change-Id: I1e15170d7679019bbb6e396279d6e633e3dad4d6
* Pass attribution source to BT APIs.Oli Lan2021-04-221-7/+12
| | | | | | | | | | | 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
* Refinement of AttributionSource handling.Jeff Sharkey2021-04-221-25/+3
| | | | | | | | | | | | | | | Previous CLs had started passing AttributionSource values across Binder calls inside BluetoothDevice instances, but this can cause confuse the permission check logic in the future; we should instead always aim to use the AttributionSource closest to the app making the call, instead of parceling it. This change also improves logging to highlight when we're quietly treating a permission as denied, and when a UID is mismatched. Bug: 186106084 Test: atest BluetoothInstrumentationTests Change-Id: I5d3fdb3c573cb9e77474952d8680caa4c4c464eb
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-0/+7
| | | | | | | | | | | | | | | | | | 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-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* gatt: Allow to set eatt supportƁukasz Rymanowski2021-01-111-1/+40
| | | | | | | | | | | With this patch it is possible to enable eatt_support as a GATT Client or GATT Server. Tag: #feature Bug: 159786353 Test: manually verified against device supporting EATT Sponsor: jpawlowski@ Change-Id: I6835a2bbd1b0ab9d6d64ee2bac5dfc96c0563afd
* Rename featureId -> attributionTagPhilip P. Moltmann2020-03-121-1/+1
| | | | | | | | | | | | | | | | | | In the core functionality this changes everything including aidl's and field names: - Context - ContentProvider - AppOps* - Package parsing For the rest, this is a shallow change to only change to the changed APIs. This keeps the change small-ish Exempt-From-Owner-Approval: Rename Fixes: 148792795 Test: TH Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
* Pipe featureId from app to noteOp in BT codePhilip P. Moltmann2019-12-141-1/+1
| | | | | | Test: atest CtsAppOpsTestCases (Now with canary test for this code) Bug: 136595429 Change-Id: I90bb6b017da4f03038fce76760a860390b727f00
* Pipe featureId from app to noteOp in BT codePhilip P. Moltmann2019-12-131-8/+22
| | | | | | | | | | | | | | | 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
* bluetooth: fix crash on accessing null adapterbohu2018-12-181-1/+3
| | | | | | | | | | | | | | | | By checking bluetooth adaptor before accessing it, because it could be null on devices that do not support bluetooth, such as android emulator. BUG: 121129248 Test: lunch sdk_gphone_x86-userdebug make -j emulator launch chrome and it should not crash Change-Id: Ia75b5ee1efa3a8195056dada079239931eb9d901
* Pass package name as part of startDiscoveryZach Johnson2018-12-121-0/+1
| | | | | | Test: manual Bug: 118347252 Change-Id: Icbc2e7e756b16ffd181924b586a0292c2bf32ec5
* BluetoothManager: Set DBG to falseMyles Watson2018-11-151-2/+1
| | | | | | Fixes: 71491860 Test: Pair and connect with a phone Change-Id: I3ead8154765267105c74cd800f571933bbe82e07
* Add RequiresFeature annotation.Jeff Sharkey2018-02-161-0/+3
| | | | | | | | | | Certain APIs require that a device have a specific feature to operate correctly, so start annotating them. Test: builds, boots Bug: 72284763 Change-Id: Ie2f30284bdfdb6acc4067f434eba3b5433837606 Exempt-From-Owner-Approval: simple annotations
* Fix checkstyle errors (1/2)Jack He2017-08-241-25/+24
| | | | | | | | * Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
* Merge "Bluetooth: minor documentation fix to de-confuse" am: 5a56873612Marie Janssen2017-06-231-4/+1
|\ | | | | | | | | | | am: 3205ff1331 Change-Id: I0cd44ad8d22da154d0bf666b9075a3fcbc655439
| * Bluetooth: minor documentation fix to de-confuseMarie Janssen2017-06-221-4/+1
| | | | | | | | | | | | | | | | | | | | | | It was somewhat unclear which is the preferred method of retrieving a BluetoothAdapter. Make it clear that using BluetoothManager is preferred, and remove references to the old method in BluetoothManager docs since it is only avaialable in API 18 or higher. Test: recompile, check that documentation is updated Fix: 33355430 Change-Id: Ia20b4e45dca03bc2f13c2ab477799b89c5e14f45
* | Annotate @SystemApi with required permissions.Jeff Sharkey2017-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most @SystemApi methods should be protected with system (or higher) permissions, so annotate common methods with @RequiresPermission to make automatic verification easier. Verification is really only relevant when calling into system services (where permissions checking can happen on the other side of a Binder call), so annotate managers with the new @SystemService annotation, which is now automatically documented. This is purely a docs change; no logic changes are being made. Test: make -j32 update-api && make -j32 offline-sdk-docs Bug: 62263906 Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
* | 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
* Remove unused mContext from BluetoothGatt[Server].Jeremy Klein2016-09-281-1/+1
| | | | | | | | | All that this member variable is doing right now is leaking a reference to a context without any benefit. Bug: 31752040 Bug: 31710795 Change-Id: If2241422533318b866340e8dcc9f5fbd9518349c
* Docs: Fixed the Bluetooth guide linkHemal Patel2016-08-171-2/+5
| | | | | | | Fixed the link that points to the Bluetooth guide. Bug: 29268546 Change-Id: I51c48cebf45c78481f8853a93ff7bcd8483d69ba
* Get name and address without enabling BluetoothAjay Panicker2016-04-011-1/+1
| | | | | Bug: 27665077 Change-Id: I2a06c1a65f22b2f9095a859f5bdd39d4626da165
* Add bluetooth permission annotationsTor Norbye2015-05-151-0/+5
| | | | Change-Id: I5bc86f8ec6ea5c873f1e14dab0e0c47c5c9df7f7
* Add transport param to Connect APIsGanesh Ganapathi Batta2014-05-061-1/+21
| | | | | | | Support for passing preferred transport for GATT connections as part of Connect APIs Change-Id: I93938dce519b8fa12de41d7e8690dc9355ce2dc5
* Remove BluetoothAdapterCallback. Simplify leScan ApiMatthew Xie2013-04-171-3/+3
| | | | | | | App does not need to explicitly register/unregister callback bug 8599881 Change-Id: I18cfef14d7ddb344722945e657dcb959823b412b
* Unhide Bluetooth Low Energy public APIsMatthew Xie2013-03-281-0/+219
Updated API headers. Add BluetoothManager to be retrieved by context.getSystemService(Context.BLUETOOTH_SERVICE). LE scan functions are placed in BluetoothAdapter The GATT API are device driven instead of a profile-driver. bug 8450158 Change-Id: I424a4cedaac3ef8120a05996500008dd210d2553