summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHidDevice.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
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-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-07Tighten up Binder.clearCallingIdentity() usage.Jeff Sharkey
This is a third CL in a chain that adjusts existing malformed code to follow AndroidFrameworkBinderIdentity best-practices. Specifically, if a thread clears an identity they need to restore it to avoid obscure security vulnerabilities. In addition, the relevant "try" block must start immediately after the identity is cleared to ensure that its restored if/when any exceptions are thrown. Bug: 155703208 Test: make Exempt-From-Owner-Approval: trivial refactoring Change-Id: I74cb958b68d55a647547aae21baff6ddc364859b
2020-01-30Add BLUETOOTH_PRIVILEGED permission to SystemApiRahul Sabnis
BluetoothHidDevice#setConnectionPolicy Bug: 148597061 Test: Manual Change-Id: I03875cb71483d3d6e18795324a7fbea6681fb9b0
2020-01-09Add setConnectionPolicy to HidDevice and Pan. Clean up documentation forRahul Sabnis
the method in Pbap. Bug: 147444905 Test: Manual Change-Id: I308b29d8ce96f9e410a66d59379a731ae12e0478
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
2018-04-03Bluetooth: Add hidden API to get current user of HID Device (1/3)Hansong Zhang
Bug: 69136526 Test: test with apps using HID Device profile Change-Id: If0e49840257c877c975c2da176a08e613668cbc3 (cherry picked from commit 347ef4099e0d2b1334efd22e6ca7d5cc5464b4eb)
2018-03-28Bluetooth HIDD: Remove unplug()Hansong Zhang
Remove the hidden unplug() API because it is not used and it can cause the remote device to be unpaired. System apps should use unbond() and user apps should not use reflection to invoke it. Bug: 67866553 Test: SL4A Change-Id: I1bdc06dbb5460c9fd52230b78cbf9434a4349d24 (cherry picked from commit 5d7b3bc09d72e7b24dfffd2d9908dbb154fb0894)
2018-03-22HIDD: Address API Review concernsIvan Podogov
* Replace bare field usage with getter methods; * Remove Builder; * Move BluetoothHidDeviceCallback to inner class; * Remove toArray() and equals(); * Throw IllegalArgumentException where applicable; * Add an Executor parameter before Callback; Bug: 72168436, 72168126 Test: make update-api, make, make sl4a.Common Change-Id: I13095458bf3ded7a376e8d20fd13df12ef426693 (cherry picked from commit f2f5dc355fa9a962ded0d29368535796aa4116d8)
2018-02-03Pass in the user defined by Context.Jeff Sharkey
The majority of Manager-style classes already use Context.getUserId() when making calls into the OS, so clean up the remaining callers to unify behind this strategy. This gives @SystemApi developers a nice clean interface to interact across user boundaries, instead of manually adding "AsUser" or "ForUser" method variants, which would quickly become unsustainable. Test: builds, boots Bug: 72863821 Exempt-From-Owner-Approval: trivial changes Change-Id: Ib772ec4438e57a2ad4950821b9432f9842998451
2017-12-19BluetoothHidDevice: rename onIntrData to onInterruptData (1/5)Hansong Zhang
Bug: 63384609 Test: make Change-Id: I3b55f7383d2a84162d681ebf3740ddc9e8a55bbb
2017-12-14Publish Bluetooth HID Device Profile Service APIHansong Zhang
Enable the BluetoothHidDevice API in framework. Bug: 63384609 Test: SL4A HID test; test with apps using BluetoothHidDevice Change-Id: I52ca4674f11179f865bdff22e0289dfe893c40f5
2017-12-08Merge "Bluetooth HID Device: format code, fix docstring, hide unplug()" am: ↵Hansong Zhang
a90d21c640 am: d27669b22f am: f32c163a7d Change-Id: I31ca6fb738fc840fc27e834e9c90dda7bb7d3a12
2017-12-07Merge "Bluetooth HID Device: format code, fix docstring, hide unplug()"Treehugger Robot
2017-12-06Bluetooth HID Device: format code, fix docstring, hide unplug()Hansong Zhang
* Reformat code with google-java-format * Add the note that When an application is registered, the HID Host service will be disabled until it is unregistered * Fix the links in docstring * Add @hide to unplug(); this is not a public API Bug: 63384609 Test: make Change-Id: I5dfcaab58b02c19e5745461c16602064a0ad8b83
2017-12-06DO NOT MERGE: Merge Oreo MR1 into masterXin Li
Exempt-From-Owner-Approval: Changes already landed internally Change-Id: I727a014df2fb05a4b13cb67b1fcb760a8b387523
2017-12-04Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)Hansong Zhang
Bug: 69981563 Test: HID Device SL4A Test Change-Id: Ifb7002bb4f3f6f29b01a3d337ab68b674d6947c9
2017-11-30Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)Hansong Zhang
Bug: 69981563 Test: HID Device SL4A Test Change-Id: Ifb7002bb4f3f6f29b01a3d337ab68b674d6947c9
2017-11-16Merge "Bluetooth HID Device API docs and helper" am: a89f6150dc am: a9b2b0496cHansong Zhang
am: 2364431ec8 Change-Id: Ic655da25a4722a49a982dad68621cf4e669af8fe
2017-11-16Merge "Bluetooth HID Device API docs and helper"Hansong Zhang
am: a89f6150dc Change-Id: I4b91cd3e528f480ea216e9ffb0414910d4762d3b
2017-11-15Bluetooth HID Device API docs and helperHansong Zhang
* Add a builder for BluetoothHidDeviceAppQosSettings * Add documentation for BluetoothHidDeviceAppSdpSettings and BluetoothHidDeviceAppQosSettings * Fix the behavior of and BluetoothHidDeviceAppSdpSettings.equals() and BluetoothHidDeviceAppQosSettings.equals() Bug: 63384609 Test: test with HID device apps Change-Id: I933f4ec3034e1f704ddd614e48b76d27fda8b6ff
2017-11-14Merge commit '98e12851336b7db16e583f9afac63ecc97465980' fromXin Li
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master. Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7 Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-10-27Merge "Enable HID Device Profile Service (2/2)" am: 7e3fbd59d1 am: 21bb474cc3Hansong Zhang
am: b43ac11226 Change-Id: I2731033de8e962fbe0161c715d5689a309772ec3
2017-10-27Merge "Enable HID Device Profile Service (2/2)" am: 7e3fbd59d1Hansong Zhang
am: 21bb474cc3 Change-Id: I84377e882c77b16862b1e049c54e36dc94c78883
2017-10-27Enable HID Device Profile Service (2/2)Hansong Zhang
Add Profile Proxy for HID Device Profile. * Add a helper method doUnbind() to deal with unbinding to Bluetooth HID Service. * Fix docstrings. Bug: 63384609 Test: SL4A Bluetooth HID test Change-Id: I168c21c3b010baac9889c556635b914c0ba3f267
2017-10-23Merge "Change Bluetooth HID Profile Name (1/6)" am: 0618fa5507Hansong Zhang
am: 3497cf3e65 Change-Id: I2c5da84f5b57496e2a0ef45fb17085670f7465a9
2017-10-23Change Bluetooth HID Profile Name (1/6)Hansong Zhang
Make the Bluetooth HID profile name consistent with the Bluetooth HID service name. BluetoothInputHost → BluetoothHidDevice BluetoothInputDevice → BluetoothHidHost IBluetoothInputHost → IBluetoothHidDevice IBluetoothInputDevice → IBluetoothHidHost BluetoothProfile.INPUT_HOST → BluetoothProfile.HID_DEVICE BluetoothProfile.INPUT_DEVICE → BluetoothProfile.HID_HOST (Cherry-picked from commit c26c76c63d933f8057f795d05624f91b811c8c71) Merged-In: Iadb890a54dd3d6868b87514472bbac6bb0c6179f Bug: 68055651 Test: make Change-Id: Iadb890a54dd3d6868b87514472bbac6bb0c6179f
2017-10-23Change Bluetooth HID Profile Name (1/11)Hansong Zhang
Make the Bluetooth HID profile name consistent with the Bluetooth HID service name. BluetoothInputHost → BluetoothHidDevice BluetoothInputDevice → BluetoothHidHost IBluetoothInputHost → IBluetoothHidDevice IBluetoothInputDevice → IBluetoothHidHost BluetoothProfile.INPUT_HOST → BluetoothProfile.HID_DEVICE BluetoothProfile.INPUT_DEVICE → BluetoothProfile.HID_HOST Bug: 68055651 Test: make Change-Id: Iadb890a54dd3d6868b87514472bbac6bb0c6179f
2016-12-29Rename the Bluetooth profile classes for HID Device role.Ivan Podogov
We already have BluetoothInputDevice class, so adding something called BluetoothHidDevice seems confusing. On the other hand, the new class is designed to connect to HID Host devices, so naming it BluetoothInputHost makes sense and goes in line with the existing BluetoothInputDevice. The same goes for the new constant HID_DEVICE that is just as confusing to have together with the INPUT_DEVICE one. This CL also renames the "connection state changed" broadcast (for the same reasons), declares it as an SDK constant, and also adds some javadoc to it. Note that BluetoothHidDeviceApp* classes remained unchanged, as those correspond to the app that implements the Device (and connects to the Host). Test: make Change-Id: I5075ca5b97db3c1dd403c2e9660eecc7380cffe2
2016-12-29Bluetooth: Add support for HID Device RoleHemant Gupta
This patch adds the HID Device Role support in Bluetooth framework. Also AIDL and callback related files for HID Device role are added to provide interface for third party applications to communicate with HID Device Service. Change-Id: Id03a362b7bcfa2e76056fa0197eaac12ce49b5a2