summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothManager.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
2021-12-16Merge "Moved AttributionSource related APIs in AttributionSource"Etienne Ruffieux
2021-12-15Moved AttributionSource related APIs in AttributionSourceEtienne Ruffieux
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
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-25Revert "Removed BluetoothDevice#prepareToEnterProcess"Etienne Ruffieux
This reverts commit 39639385f90678e97aa6848ae3b43de6bfb3b49e. Reason for revert: Introducing regression for gms core Test: None Change-Id: I644b10c1869c12e1622300de43bfbdb57fb583d8
2021-10-15Removed BluetoothDevice#prepareToEnterProcessEtienne Ruffieux
Tag: #feature Bug: 200202780 Test: manual Change-Id: I8d4be1da1bcb5b819c324f1a3a89c7dc317c31d6
2021-09-22Use AttributionSource BuilderWilliam Escande
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
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-23More AttributionSource plumbing.Jeff Sharkey
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
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-22Refinement of AttributionSource handling.Jeff Sharkey
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
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-01-11gatt: Allow to set eatt supportƁukasz Rymanowski
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
2020-03-12Rename featureId -> attributionTagPhilip P. Moltmann
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
2019-12-14Pipe featureId from app to noteOp in BT codePhilip P. Moltmann
Test: atest CtsAppOpsTestCases (Now with canary test for this code) Bug: 136595429 Change-Id: I90bb6b017da4f03038fce76760a860390b727f00
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-12-18bluetooth: fix crash on accessing null adapterbohu
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
2018-12-12Pass package name as part of startDiscoveryZach Johnson
Test: manual Bug: 118347252 Change-Id: Icbc2e7e756b16ffd181924b586a0292c2bf32ec5
2018-11-15BluetoothManager: Set DBG to falseMyles Watson
Fixes: 71491860 Test: Pair and connect with a phone Change-Id: I3ead8154765267105c74cd800f571933bbe82e07
2018-02-16Add RequiresFeature annotation.Jeff Sharkey
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
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-06-23Merge "Bluetooth: minor documentation fix to de-confuse" am: 5a56873612Marie Janssen
am: 3205ff1331 Change-Id: I0cd44ad8d22da154d0bf666b9075a3fcbc655439
2017-06-22Bluetooth: minor documentation fix to de-confuseMarie Janssen
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
2017-06-05Annotate @SystemApi with required permissions.Jeff Sharkey
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
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
2016-09-28Remove unused mContext from BluetoothGatt[Server].Jeremy Klein
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
2016-08-17Docs: Fixed the Bluetooth guide linkHemal Patel
Fixed the link that points to the Bluetooth guide. Bug: 29268546 Change-Id: I51c48cebf45c78481f8853a93ff7bcd8483d69ba
2016-04-01Get name and address without enabling BluetoothAjay Panicker
Bug: 27665077 Change-Id: I2a06c1a65f22b2f9095a859f5bdd39d4626da165
2015-05-15Add bluetooth permission annotationsTor Norbye
Change-Id: I5bc86f8ec6ea5c873f1e14dab0e0c47c5c9df7f7
2014-05-06Add transport param to Connect APIsGanesh Ganapathi Batta
Support for passing preferred transport for GATT connections as part of Connect APIs Change-Id: I93938dce519b8fa12de41d7e8690dc9355ce2dc5
2013-04-17Remove BluetoothAdapterCallback. Simplify leScan ApiMatthew Xie
App does not need to explicitly register/unregister callback bug 8599881 Change-Id: I18cfef14d7ddb344722945e657dcb959823b412b
2013-03-28Unhide Bluetooth Low Energy public APIsMatthew Xie
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