aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHeadset.java
Commit message (Collapse)AuthorAgeFilesLines
* Move all profile services bind to BluetoothManagerServiceEtienne Ruffieux2022-11-291-168/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | 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/+5
| | | | | | | | | | | 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)
* Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux2022-06-221-25/+25
| | | | | | | | Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644
* Merge changes I2861d51d,Ifcc6971f am: 2b53c20373 am: 417226527d am: 3df425a07cTreehugger Robot2022-03-231-36/+36
|\ | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2037666 Change-Id: Id714f5d4b7ce64472d60abed1cee05451cbc189e
| * BluetoothHeadset APIs now no longer returnRahul Sabnis2022-03-221-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | BluetoothStatusCodes#ERROR_BLUETOOTH_NOT_ENABLED. There should never be a case where the profile service is bound, but Bluetooth is off. Tag: #feature Bug: 202310885 Test: Manual Change-Id: I2861d51d90342e050fd62dceaa99886b46491225
| * Update BluetoothHeadset#connectAudio andRahul Sabnis2022-03-221-7/+13
| | | | | | | | | | | | | | | | | | | | BluetoothHeadset#disconnectAudio to support additional error codes for GTS Bug: 211914959 Test: Manual Merged-In: Ifcc6971f4cef6d966cf14fdbfd1f97b34170c0ba Change-Id: Ifcc6971f4cef6d966cf14fdbfd1f97b34170c0ba
* | Merge "BluetoothHeadset#getAudioState now throws a NullPointerException if ↵Rahul Sabnis2022-03-181-4/+3
|\| | | | | | | | | | | | | | | the device param is null." am: d2ef8d7c4f am: 802f6def78 am: 43c5b15e41 Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2030694 Change-Id: I71761f63d211838f09f30c043431d63083f3a3f8
| * Merge "BluetoothHeadset#getAudioState now throws a NullPointerException if ↵Rahul Sabnis2022-03-181-4/+3
| |\ | | | | | | | | | the device param is null."
| | * BluetoothHeadset#getAudioState now throws a NullPointerException if theRahul Sabnis2022-03-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | device param is null. Tag: #feature Bug: 222265808 Test: Manual Change-Id: Ifd4eab1c377c8d465d6b6b3f345873210bd44cb8
* | | Merge "[API Review] add new permissions to sco and inband ringing" am: ↵Rahul Sabnis2022-03-091-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | e75cf65ba9 am: 66ecd20db6 am: a25adab19b Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1999719 Change-Id: I5e6aa4ba53a6eb9f970940e6fedd3fffa64affde
| * | Merge "[API Review] add new permissions to sco and inband ringing"Rahul Sabnis2022-03-081-0/+2
| |\ \ | | |/ | |/|
| | * [API Review] add new permissions to sco and inband ringingEtienne Ruffieux2022-02-251-1/+6
| | | | | | | | | | | | | | | | | | | | | Bug: 200730908 Tag: #feature Test: manual Change-Id: I0a0915925b16cb53c3bf77fe47871ede6e752cdb
| * | Make BluetoothHeadset APIs used by Telecom into System APIs and updateRahul Sabnis2022-02-241-66/+100
| |/ | | | | | | | | | | | | | | | | | | service code to match. Tag: #feature Bug: 195156304 Test: Manual Merged-In: I8af246091ae49c8f9cf34c1f4a894b3a66a28cf8 Change-Id: I8af246091ae49c8f9cf34c1f4a894b3a66a28cf8
* | Merge "get and set audio route allowed APIs should have different IntDef ↵Treehugger Robot2022-02-231-3/+14
|\| | | | | | | | | | | | | | | since they return different sets of values" am: fcc1bce477 am: 5e0e88fa6f am: 47d67f1c36 Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1991710 Change-Id: I4d444ef8b31827a883b4f219223c064f6184a520
| * Merge "get and set audio route allowed APIs should have different IntDef ↵Treehugger Robot2022-02-231-3/+14
| |\ | | | | | | | | | since they return different sets of values"
| | * get and set audio route allowed APIs should have different IntDef sinceMd Shahriar Hossain Sajib2022-02-181-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | they return different sets of values Bug: 219947178 Tag: #security Test: atest BluetoothInstrumentationTest Change-Id: Ife2d91e455fb31fef79744ce81398d20294b135a
| * | API Changes needed for apex to buildWilliam Escande2022-02-141-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | internal cherry-pick Bug: 216476895 Test: Compile Tag: #refactor Change-Id: I09108622038b174104457ca18ac6ec7949978f66 Merged-In: I09108622038b174104457ca18ac6ec7949978f66 CTS-Coverage-Bug: 217352944
| * [framework] Migration of hidden APIs to System APIsMd Shahriar Hossain Sajib2022-01-271-30/+72
| | | | | | | | | | | | | | | | Bug: 199827901 Tag: #compatibility Test: IOP, BCST, GTS Merged-In: Ib0a205bc575e4cc3cf97eac539cd303acd878134 Change-Id: Ib0a205bc575e4cc3cf97eac539cd303acd878134
* | API Changes needed for apex to buildWilliam Escande2022-02-011-1/+2
| | | | | | | | | | | | | | | | | | Bug: 216476895 Test: Compile Tag: #refactor Ignore-AOSP-First: AOSP will be updated later Change-Id: I09108622038b174104457ca18ac6ec7949978f66 CTS-Coverage-Bug: 217352944
* | [framework] Migration of hidden APIs to System APIsMd Shahriar Hossain Sajib2022-01-261-30/+69
| | | | | | | | | | | | | | Bug: 199827901 Tag: #compatibility Test: IOP, BCST, GTS Change-Id: Ib0a205bc575e4cc3cf97eac539cd303acd878134
* | Migrating Bluetooth resources to Bluetooth module am: 46f0869e44 am: ↵Etienne Ruffieux2022-01-251-21/+0
|\| | | | | | | | | | | | | | | 41f1eda6e5 am: 2b17efdfab am: cd8180a341 Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1931007 Change-Id: I57b927ec983e8906fcda0f9cc7a4407906e55d1c
| * Migrating Bluetooth resources to Bluetooth moduleEtienne Ruffieux2022-01-251-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for the Bluetooth module to build as an apex all non-public resources must be located in the same package. Made getMaxConnectedAudioDevices system API in order for development Settings to access it. Removed isInbandRingingSupported as only usage was by bt service (config is now directly in service). Removed isBluetoothVoiceDialingEnabled as there were no usages, and no overlays. All configs used only by the Bluetooth app are moved to the Bluetooth module. Tag: #feature Bug: 211570675 Test: build Test: make RunSettingsRoboTests Change-Id: Ieed30c31fc44b5b477d43ae120ef11f96ab115ca
| * Remove allowBlocking from all BluetoothProfilesWilliam Escande2021-12-161-235/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | Since Bluetooth is becoming a mainline module, it can no longer call the allowBlocking hidden api. Instead, all interface are moved to be oneway and use a synchronous data to handle the return value. Bug: 200200870 Test: Build + start Bt and play something on speaker Tag: #refactor Merged-In: I776a6322faadca1504bce24f2b6b041e756b6448 Change-Id: I776a6322faadca1504bce24f2b6b041e756b6448
* | Update BluetoothHeadset#connectAudio andRahul Sabnis2022-01-241-8/+14
| | | | | | | | | | | | | | | | | | | | BluetoothHeadset#disconnectAudio to support additional error codes for GTS Bug: 211914959 Test: atest BluetoothHostTest Ignore-AOSP-First: Depends on change only present in internal Change-Id: Ifcc6971f4cef6d966cf14fdbfd1f97b34170c0ba
* | Make BluetoothHeadset APIs used by Telecom into System APIsRahul Sabnis2022-01-121-66/+104
| | | | | | | | | | | | | | | | Tag: #feature Bug: 195156304 Test: Manual CTS-Coverage-Bug: 211914959 Change-Id: I13d6f553f5b9d6ca7c2ae9a42450875b16cd1490
* | Remove allowBlocking from all BluetoothProfilesWilliam Escande2021-12-161-218/+304
| | | | | | | | | | | | | | | | | | | | | | | | Since Bluetooth is becoming a mainline module, it can no longer call the allowBlocking hidden api. Instead, all interface are moved to be oneway and use a synchronous data to handle the return value. Bug: 200200870 Test: Build + start Bt and play something on speaker Tag: #refactor Change-Id: I776a6322faadca1504bce24f2b6b041e756b6448
* | Merge "Copy attributable to Bluetooth" am: b4950bde08 am: 5393f1f597 am: ↵Treehugger Robot2021-12-141-1/+0
|\| | | | | | | | | | | | | | | 0e012ce997 am: bf32b65e70 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1922462 Change-Id: I510639073615474d1774991645da87c6f71277dd
| * 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 "Revert "Complete hard removal of BluetoothHeadset#setPri..."Rahul Sabnis2021-12-141-43/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Revert "Hard remove BluetoothHeadset#setPriority System ..." Revert "Revert "Added removal of BluetoothHeadset#setPriority to..." Revert submission 16433519-hfp-setpriority-hardremove Tag: #feature Bug: 209335798 Test: Manual Reason for revert: CTS issue fixed Reverted Changes: I9de1b07f2:Revert "Complete hard removal of BluetoothHeadset#... If5d408e8b:Revert "Added removal of BluetoothHeadset#setPrior... I3c717fad0:Revert "Hard remove BluetoothHeadset#setPriority S... Change-Id: Id86ba6bd922cd862560a635cc9b8bd79ca0f9d28
* | Revert "Complete hard removal of BluetoothHeadset#setPriority system API that"Rahul Sabnis2021-12-091-0/+43
| | | | | | | | | | | | | | | | | | | | This reverts commit 7d8bba4d531c96586f0ef3fb1f325d4fc663ccd8. Bug: 209335798 Test: Manual Reason for revert: Failing signature test that will be updated by paulduffin@ Change-Id: I9de1b07f2d0f4d01d9e3b57a6ddf8a4232db29b6
* | Complete hard removal of BluetoothHeadset#setPriority system API thatRahul Sabnis2021-12-021-43/+0
|/ | | | | | | | | was deprecated in 11 and soft removed in 12 Tag: #feature Bug: 207702651 Test: Manual Change-Id: I4dd938e0b6c6394e105deeeaee75f6a5d52f2dbf
* Changing BluetoothHeadset APIs from @hide to @SystemApiRoopa Sattiraju2021-09-091-6/+6
| | | | | | | | | | | | | | | For isInbandringing API - it is used in the call journey and would change the behavior(undeterministic) of the call if not used. Stop/StartScoUsingVirtualVoiceCall is used in the BluetoothShim layer specifically for testing and mocking in the Android Apps. Seems reasonable to keep this as a SystemAPI given that it has no params and unlikely to be changed. Bug: 195160939 Tag: #feature Test: Manual Change-Id: I02b2e7e5e0be3b462f7c25b655e669e2c7fe47eb
* Merge "More Binder call AttributionSource assignment." into sc-devJeff Sharkey2021-06-041-4/+7
|\
| * More Binder call AttributionSource assignment.Jeff Sharkey2021-06-031-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | CloseGuard for more Bluetooth components.Jeff Sharkey2021-06-031-0/+12
|/ | | | | | | | | | 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/+10
| | | | | | | | | | | | 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
* Long-tail of AttributionSource plumbing.Jeff Sharkey2021-04-241-26/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | Wires up AttributionSource across the remaining long-tail of Bluetooth AIDL interfaces, ensuring that developers can accurately make calls chained back to a specific Context. Moves "for data delivery" permission checks to happen in a single location on each interface to ensure they're performed consistently with the new AttributionSource arguments. Note that "for data delivery" isn't the best name; it's designed to represent that the requested action was performed and should result in the relevant appop being noted for the caller. This change has the positive side effect of ensuring that all interfaces are consistently enforcing the BLUETOOTH_CONNECT permission, even in the case where BLUETOOTH_PRIVILEGED is also required; this is what ensures that revoking the "Nearby devices" permission takes effect for all callers. Additionally, standardizing on enforcing permissions closer to the AIDL entry point reduces the need for @RequiresPermission annotations to be carried around inside the Bluetooth stack. Bug: 183626112 Test: atest BluetoothInstrumentationTests Change-Id: I8023dda654e325b8bfa2f0cdb994ad63a2b429d4
* More AttributionSource plumbing.Jeff Sharkey2021-04-231-5/+10
| | | | | | | | | | | | | | | | 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
* Annotations for Bluetooth broadcast intents.Jeff Sharkey2021-04-211-0/+1
| | | | | | | | | | | | | | | | 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: I53ac7a4fe1dea57316048c3cac4fa237b6ba3d38
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-0/+16
| | | | | | | | | | | | | | | | | | 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-43/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove BluetoothHeadset#setPriority which was deprecated in Android 11Rahul Sabnis2021-03-241-0/+1
| | | | | | | Tag: #feature Bug: 183551808 Test: Manual Change-Id: I88745589ec66d3060d24b530fe49fea8926726c6
* docs: fix typo HDP->HFP in BluetoothHeadsetJakub Pawlowski2021-01-291-1/+1
| | | | | | | Bug: 158742305 Test: m ds-docs-java Exempt-From-Owner-Approval: Docs-only change Change-Id: Iec48eba9a29e1cb7c2565e773ae876db662552ef
* docs: Use correct profile for intentKevin Hufnagle2021-01-291-1/+1
| | | | | | | | | | | The ACTION_AUDIO_STATE_CHANGED intent action uses the HDP profile, not the A2DP profile. Bug: 158742305 Test: m ds-docs-java Exempt-From-Owner-Approval: Docs-only change Change-Id: I4358aac8c8aa9fc8b36e517e568e5a9db538555e (cherry picked from commit 10d0a560d962be20a9ce50db0bc87e0a204c9ff7)
* Merge "Derestrict some non-SDK APIs."Mathew Inwood2021-01-131-3/+3
|\
| * Derestrict some non-SDK APIs.Mathew Inwood2021-01-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | Per request from a partner, these APIs will not be restricted as they are in use. This is conceptually a partial revert of change 049f0f5f419. NoNonSdkCheck: b/170729553 Bug: 171933273 Test: Treehugger Change-Id: Ibb525e9a9e2fc90248b74f45f3cdcb0be7487c3a
* | Introduce public APIs to check whether a remote bluetooth headsetRahul Sabnis2021-01-061-0/+42
|/ | | | | | | | | | supports voice recognition as well as echo cancellation and/or noise reduction via the AT+BRSF bitmask Tag: #feature Bug: 172960943 Test: Manual Change-Id: I40579d9b6d493d2b32fb260983eeb7c79cc0d525
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-11-041-6/+7
| | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
* Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth ↵Rahul Sabnis2020-03-211-9/+31
| | | | | | | | | | | SystemApis and for hidden connect/disconnect APIs. Hide some APIs that were previously marked as @UnsupportedAppUsage and re-add annotation as changing the permissions for these SystemApis would break the unsupported app contract that was previously there. Therefore, we're choosing to hide them until we have a good story on how to deal with them next release. Bug: 148689314 Test: Manual Merged-In: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a