aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothProfileConnector.java
Commit message (Collapse)AuthorAgeFilesLines
* Move all profile services bind to BluetoothManagerServiceEtienne Ruffieux2022-11-291-23/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | We are currently binding the profile services in framework/ BluetoothProfileConnector, except for BluetoothHeadset and BluetoothLeCallControl that are bound in BMS. The issue with binding the profiles in framework/ is that calling apps don't always have the required permission (BLUETOOTH_PRIVILEGED) to check if the service is enabled or not (BluetoothAdapter#getSupportedProfiles), so we are trying to bind the service even if the profile is disabled. This change will unify the profiles service binding by moving the bind process in BluetoothProfileConnector in BluetoothManagerService and making BluetoothHeadset and BluetoothLeCallControl use BluetoothProfileConnector. Bug: 241827236 Bug: 236399693 Test: atest CtsBluetoothTestCases Test: atest BluetoothInstrumentationTests Tag: #feature Ignore-AOSP-First: Cherry-pick Change-Id: I925b4415c023ff9e43a8ff947ae7ca5456babe64 Merged-In: I925b4415c023ff9e43a8ff947ae7ca5456babe64
* Make mServiceListener as null before calling onServiceDisconnectedHyundo Moon2022-10-161-1/+2
| | | | | | | | | | | | This way, we can prevent an infinite loop made by apps calling BluetoothAdapter.getProfileProxy() in the onServiceDisconnected. Tag: #refactor Bug: 249213217 Test: atest CtsBluetoothTestCases Change-Id: I7342befd9a8fc69c778d20140558afb148a4232e (cherry picked from commit e07b56b412fc4fb78a8721d8240722a175ef905a) Merged-In: I7342befd9a8fc69c778d20140558afb148a4232e
* Make onServiceDisconnected be calledSungsoo Lim2022-09-131-1/+4
| | | | | | | | | | | FYI, ServiceConnection.onServiceDisconnected is not called when Context.unbindService is called. Bug: 233690300 Tag: #refactor Test: atest CtsBluetoothTestCases DeviceHealthChecks Change-Id: I51ad4e0ecf6b81bce32ccc7e8b4b9550e3695e9c (cherry picked from commit f314930e3dd229f6e5f64036ea8bc8887536d0ba)
* Merge "re-use CURRENT_OR_SELF not CURRENT" am: 46b50d227b am: cf7c2303d9 am: ↵Treehugger Robot2022-01-281-1/+4
|\ | | | | | | | | | | | | | | 6ca88d122b am: 8a9ac79f7b Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1961321 Change-Id: Idccafd6827735afc635235a9cdf2a05708bbc8d5
| * re-use CURRENT_OR_SELF not CURRENTWilliam Escande2022-01-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | 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
| * Pbap use profileConnector, resolveSystemService api fixWilliam Escande2021-12-141-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | Pbap use profileConnector, resolveSystemService api fixWilliam Escande2021-12-141-2/+30
|/ | | | | | | | | | | | | | | * 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
* replace CURRENT_OR_SELF with non hidden APIWilliam Escande2021-11-301-1/+1
| | | | | | | | | | 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
* CloseGuard for more Bluetooth components.Jeff Sharkey2021-06-031-0/+11
| | | | | | | | | | 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
* Preserve legacy permission check behavior.Jeff Sharkey2021-04-281-0/+12
| | | | | | | | | | | | 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
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-1/+1
| | | | | | | | | | | | | | | | | | 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-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "BluetoothProfileConnecter now calls the ServiceListener'..."Hungyen Weng2020-05-041-15/+9
| | | | | | | | | | | | | | 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
* BluetoothProfileConnecter now calls the ServiceListener'sRahul Sabnis2020-05-011-9/+15
| | | | | | | | onServiceDisconnected method after unbinding the service Bug: 155120232 Test: atest BluetoothHostTest#testMapClose Change-Id: I324b4ea6654261eb67d5ec184f6b3456ba3d1aa4
* Update BluetoothProfileConnector to invoke service disconnections with ↵Sal Savage2019-05-281-5/+5
| | | | | | | | correct profile ID Bug: b/133517229 Test: Build + Manual on automotive hardware Change-Id: Id8dbeaf844a65020f610505f81eea20b96ec002a
* Fix binder leakage when turning off BluetoothUgo Yu2019-05-021-0/+166
* 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