summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothProfileConnector.java
AgeCommit message (Collapse)Author
2022-01-28Merge "re-use CURRENT_OR_SELF not CURRENT" am: 46b50d227b am: cf7c2303d9 am: ↵Treehugger Robot
6ca88d122b am: 8a9ac79f7b Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1961321 Change-Id: Idccafd6827735afc635235a9cdf2a05708bbc8d5
2022-01-26re-use CURRENT_OR_SELF not CURRENTWilliam Escande
CURRENT_OR_SELF is hidden so this is a workaround to have the same thing CURRENT_OR_SELF is needed to pass the bluetooth cts test Test: atest CtsBluetoothTestCases Tag: #refactor Bug: 200200870 Change-Id: I089ffc75da934a023a3fea5088f9e133abeab5c0
2021-12-14Pbap use profileConnector, resolveSystemService api fixWilliam Escande
* All profiles use the BluetoothProfileConnector but not Pbap. I reproduced the changes that were made in aosp/932813 for all other profiles. This allow pbap to no longer call resolveSystemService. * `Intent.resolveSystemService` is an hidden API and can no longer be called from Bluetooth as we aim to become mainline. It's code is simple enough to be copied. Tag: #refactor Bug: 200200870 Test: atest BluetoothInstrumentationTests Merged-In: I838b910c633b3ca943fec01f3ccca466ff65f892 Change-Id: I838b910c633b3ca943fec01f3ccca466ff65f892
2021-12-14Pbap use profileConnector, resolveSystemService api fixWilliam Escande
* All profiles use the BluetoothProfileConnector but not Pbap. I reproduced the changes that were made in aosp/932813 for all other profiles. This allow pbap to no longer call resolveSystemService. * `Intent.resolveSystemService` is an hidden API and can no longer be called from Bluetooth as we aim to become mainline. It's code is simple enough to be copied. Tag: #refactor Bug: 200200870 Test: atest BluetoothInstrumentationTests Change-Id: I838b910c633b3ca943fec01f3ccca466ff65f892
2021-11-30replace CURRENT_OR_SELF with non hidden APIWilliam Escande
This API is called by a mainline module (Bluetooth), and needs to be change to an available API. Bug: 200200870 Tag: #refactor Test: Build + start bt + switch user and restart bt Change-Id: I37bb0d16e61d666d0aa51d5efe48fa9b39f9c1c3
2021-06-03CloseGuard for more Bluetooth components.Jeff Sharkey
We've seen evidence of IBluetoothProfileServiceConnection and IBluetoothStateChangeCallback references being leaked, so attempt to unregister them when an object is finalized without closing. Bug: 189091551 Test: manual Change-Id: I23792d48d94578acd7fc7a5164a95171801ee721
2021-04-28Preserve legacy permission check behavior.Jeff Sharkey
As part of the new "Nearby devices" permission work, the registerStateChangeCallback() API has been relaxed to no longer require permissions. However, we've discovered that some apps were depending on that SecurityException being thrown, so this change restores throwing behavior for those legacy apps. Bug: 186176507 Test: atest BluetoothInstrumentationTests Change-Id: Ife536dee246b300ffb3dd78aef0b059a230f3835
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
2020-05-04Revert "BluetoothProfileConnecter now calls the ServiceListener'..."Hungyen Weng
Revert submission 11348591-btmap-close-gts Reason for revert: Droidcop reverted the change due to test failure, Test failed. https://android-build.googleplex.com/builds/tests/view?invocationId=I05500004181087103&testResultId=TR42507671126333727 Reverted Changes: I324b4ea66:BluetoothProfileConnecter now calls the ServiceLis... I1427f1a86:Add GTS test for BluetoothMap#close Bug: 155587865 Change-Id: I9a2645c7bbaec9fdf0c6f5972b08ba70cfe78741
2020-05-01BluetoothProfileConnecter now calls the ServiceListener'sRahul Sabnis
onServiceDisconnected method after unbinding the service Bug: 155120232 Test: atest BluetoothHostTest#testMapClose Change-Id: I324b4ea6654261eb67d5ec184f6b3456ba3d1aa4
2019-05-28Update BluetoothProfileConnector to invoke service disconnections with ↵Sal Savage
correct profile ID Bug: b/133517229 Test: Build + Manual on automotive hardware Change-Id: Id8dbeaf844a65020f610505f81eea20b96ec002a
2019-05-02Fix binder leakage when turning off BluetoothUgo Yu
* In current design, Bluetooth AdapterState stops all BR/EDR profiles' service and triggers onServiceDisconnected callback to all binder clients before BluetoothManagerService invokes onBluetoothStateChange(false), which means unbind service would never be called in framework. * Do unbind service when onServiceDisconnected is invoked. * Move profile binder logic to BluetoothProfileConnector except: - BluetoothHeadset: its binder logic is in BluetoothManagerService - BluetoothPbap: it has an individual ServiceListener Bug: 129037442 Bug: 129437895 Test: Bluetooth ON/OFF stress test. adb shell dumpsys activity services | egrep "com.android.bluetooth" to check whether AppBindRecord for com.android.bluetooth grows Merged-In: Id0d85866d386962b94d2d966f0a864b1da165d13 Change-Id: Id0d85866d386962b94d2d966f0a864b1da165d13