summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHearingAid.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-05-13Copy BluetoothHearingAid API into private for short-term onlyjasonwshsu
* SettingsLib will use APIs getDeviceSideInternal() and getDeviceModeInternal() to improve hearing aids experience and change to formal call in next bluetooth release. Bug: 224323976 Ignore-AOSP-First: AOSP will be updated later Test: add private APIs only Tag: #feature Change-Id: I7ccb399cfe9b4e1fbf37d752dacbdceeb09f5b8d
2022-03-26Correct the typo in BluetoothHearingAid#getHiSyncIdjasonwshsu
Bug: 224323976 Ignore-AOSP-First: AOSP will be updated later Test: atest CtsBluetoothTestCases Tag: #refactor Change-Id: I6d4d9ed07c8858acc0169f2ad6efe50b6cb21ec8
2022-02-01API Changes needed for apex to buildWilliam Escande
Bug: 216476895 Test: Compile Tag: #refactor Ignore-AOSP-First: AOSP will be updated later Change-Id: I09108622038b174104457ca18ac6ec7949978f66 CTS-Coverage-Bug: 217352944
2021-12-16Remove allowBlocking from all BluetoothProfilesWilliam Escande
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
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-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-24Long-tail of AttributionSource plumbing.Jeff Sharkey
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
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-18Add missing Bluetooth API permission enforcement.Jeff Sharkey
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: I37a9e03ecdca6f7a6eb9d7f094e2f95a97036612
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-10-29Add maxTargetSdk restriction to unused APIs.Mathew Inwood
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. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-28Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang
This reverts commit bc9a809f18a3b0ec23cbc39802fb4928c2074ea3. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-27Add maxTargetSdk restriction to unused APIs.Mathew Inwood
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 Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-03-24BluetoothHearingAid System APIs now throw an exception if a nullRahul Sabnis
BluetoothDevice is passed in Bug: 149238489 Test: Manual Change-Id: I594f558bfe1e286bf74dd8dc3db4c8497fd0a025
2020-03-21Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth ↵Rahul Sabnis
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 Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
2020-03-20BluetoothHearingAid#getHiSyncId now consistently uses the term HiSyncIdRahul Sabnis
(removed all references to CustomerId) and added link to explain what the HiSyncId represents Bug: 149238489 Test: Manual Merged-In: I4ff2a8d46f3fc5d06a29829a69a27a0c15e466f8 Change-Id: I4ff2a8d46f3fc5d06a29829a69a27a0c15e466f8
2020-01-02Merge "Remove unused BluetoothHearingAid APIs and usages" am: 05c99fe194 am: ↵Automerger Merge Worker
733e456395 am: 73acadc7e0 Change-Id: Idf953a477b1d8bbbecf0041499a436a9eb828884
2019-12-18Use new UnsupportedAppUsage annotation.Artur Satayev
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I6ab53570aca580fbee1fcc927871caa09780f58f
2019-12-16Remove unused BluetoothHearingAid APIs and usagesRahul Sabnis
Bug: 143244535 Test: Manual Change-Id: I8915ec755794b2c44412386de03c5fc0778d8ec7
2019-12-09Resolve BluetoothHearingAid API usages by SettingsRahul Sabnis
Bug: 143244535 Test: Manual Change-Id: Ide243e05166f03d465a50a7f2bdb82dbfd6815d0
2019-12-02Rename priority to connection policy in bluetooth apisRahul Sabnis
Bug: 145005327 Test: Manual Change-Id: I43ad57feb7dd70f39005ad7a01bc7dac6fb7b639
2019-06-28Restore some greylist entries.Mathew Inwood
In Q, these APIs were either: - removed from the greylist entirely without good reason - Moved to the restricted greylist without any public alternative information added So they are being moved back to the greylist for Q. Test: Treehugger Bug: 136102585 Change-Id: I5ac8b8b9b23c3789d80239cf456072cc7dfa1203
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 Change-Id: Id0d85866d386962b94d2d966f0a864b1da165d13
2019-03-18Merge "Cleanup annontations for Hearing Aids Profile API" am: f6b3f6a8d8 am: ↵Stanley Tng
1194369000 am: f21d8f46b8 Change-Id: I1bc62eb19c3d1bd3fd6d959163aaf9e44ab0d217
2019-03-16Cleanup annontations for Hearing Aids Profile APIStanley Tng
Remove the @UnsupportedAppUsage and add the @IntDef for the Profile Connection States in the Hearing Aids Profile API. Also, the parent class BluetoothProfile has its Profile Connection States annontated. Bug: 128523382 Test: Compile only Change-Id: Ibd02516fa637ddb48d70a8dfacf607f047aec282
2019-03-08Merge "Add @NonNull annotations to Hearing Aids Profile APIs" am: 6fa52c9b25 ↵Stanley Tng
am: b255f51347 am: 9887fb16e7 Change-Id: Ib1388c480e135f56063da0fe26063ef9e31a6807
2019-03-06Add @NonNull annotations to Hearing Aids Profile APIsStanley Tng
Bug: 126699327 Bug: 119617521 Test: Ran with CTS tests for Hearing Aids Profile, android.bluetooth.cts.HearingAidProfileTest Change-Id: If83052a68c867d839e263f490592b80bef513a01
2019-01-23Merge "Add Android APIs for Hearing Aids Profile" am: d5344e741a am: 85a557b57bStanley Tng
am: f5476f55b5 Change-Id: Iac7fe414ddc1fbc04e8bbe3c2e96d3d57d364995
2019-01-22Add Android APIs for Hearing Aids ProfileStanley Tng
Add the new public Android APIs for the ASHA Hearing Aids Profile. Bug: 119617521 Bug: 120222233 Test: Run with the new HearingAidProfileTest CTS test Change-Id: I05fc3d565bd22b5000765122da7714d961dbc15b
2018-11-20Merge "Enable the Debug Logs for Hearing Aids Profile" am: 7271c452a9 am: ↵Stanley Tng
7c4bcb1adc am: 58aa689afb Change-Id: I1a664cf14d7f132abb9919fb3ba11d111fbb1e7b
2018-11-15Enable the Debug Logs for Hearing Aids ProfileStanley Tng
Bug: 119617521 Test: Compile Change-Id: I40de1fcb3ca9e0ee66b4650a161f3735722df7ed
2018-10-15Makes bluetooth profile services bind to current (foreground) user.jovanak
If profile services are created from a singleton process (like SystemUI), they need to be re-bind to a new foreground user when we switch to a secondary user. This is achieved by binding to UserHandle.CURRENT_OR_SELF. If the process doesn't have adequate permissions to bind to current, it will bind to self (which is the same as the previous behavior). Change-Id: Ib1134a1a62887d6f5b2c97301dccd3223ade9ed2 Fixes: 117517812 Test: ran the existing core bluetooth tests; manual testing on a mojave, verifying that the service correctly rebinds from sys ui after user switch.
2018-08-02Add @UnsupportedAppUsage annotationsMathew Inwood
For packages: android.bluetooth.le android.bluetooth This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I88a1311e27c5f9a5f9d1035db76034f86f650efc
2018-08-01Add @UnsupportedAppUsage annotationsMathew Inwood
For packages: android.bluetooth.le android.bluetooth This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ifcf24c0617acd7facc0e03f30a95c3a6b09b205c Merged-In: I88a1311e27c5f9a5f9d1035db76034f86f650efc
2018-03-29Hearing Aid: change get/set active device (3/3)Hansong Zhang
* setActiveDevice() returns false in error case, e.g. when the device is not connected * add getActiveDevices() instead of isActiveDevice(), which returns a list that must have two elements: left and right, or empty list on error Test: manual Bug: 69623109 Change-Id: I48f3388c56434d0c21e09bd8b794e58848cd8794
2018-03-23Hearing Aid Profile: set and get activeDeviceHansong Zhang
Add setActiveDevice() for Hearing Aid Profile in SettingsLib Bug: 69623109 Test: robolectric test and manual test Change-Id: I70eafe030747053876e2ab8a125d5dd01c5e0eb9 Merged-In: I70eafe030747053876e2ab8a125d5dd01c5e0eb9 (cherry picked from commit befadbc4a5450e3140293c37ecd5533581659687)
2018-02-14Hearing Aid profileJakub Pawlowski
This is implementation of Hearing Aid Profile that will in future be connected to Bluetooth Manager - see TODOs in BluetoothHearingAid.java Bug: 69623109 Test: compilation. Manual test with HA. Change-Id: I79643ea1e14e9df7f5771169359c964a60c56618