summaryrefslogtreecommitdiff
path: root/core/java/android/bluetooth/BluetoothHidDevice.java
Commit message (Collapse)AuthorAgeFilesLines
* Migrating frameworks/base BT filesRoopa Sattiraju2022-01-171-848/+0
| | | | | | Bug: 206121418 Test: Compile Change-Id: Idb55371e9d678296fe46e5f4231ec2d12ec8b978
* Remove allowBlocking from all BluetoothProfilesWilliam Escande2021-12-161-118/+146
| | | | | | | | | | | | 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
* 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
* More Binder call AttributionSource assignment.Jeff Sharkey2021-06-031-6/+15
| | | | | | | | | | | | | | | 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
* Long-tail of AttributionSource plumbing.Jeff Sharkey2021-04-241-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-0/+13
| | | | | | | | | | | | | | | | | | 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-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tighten up Binder.clearCallingIdentity() usage.Jeff Sharkey2020-10-071-14/+42
| | | | | | | | | | | | | | | 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
* Add BLUETOOTH_PRIVILEGED permission to SystemApiRahul Sabnis2020-01-301-1/+1
| | | | | | | | BluetoothHidDevice#setConnectionPolicy Bug: 148597061 Test: Manual Change-Id: I03875cb71483d3d6e18795324a7fbea6681fb9b0
* Add setConnectionPolicy to HidDevice and Pan. Clean up documentation forRahul Sabnis2020-01-091-0/+63
| | | | | | | | the method in Pbap. Bug: 147444905 Test: Manual Change-Id: I308b29d8ce96f9e410a66d59379a731ae12e0478
* Fix binder leakage when turning off BluetoothUgo Yu2019-05-021-113/+25
| | | | | | | | | | | | | | | | | | | | | * 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
* Bluetooth: Add hidden API to get current user of HID Device (1/3)Hansong Zhang2018-04-031-0/+22
| | | | | | | Bug: 69136526 Test: test with apps using HID Device profile Change-Id: If0e49840257c877c975c2da176a08e613668cbc3 (cherry picked from commit 347ef4099e0d2b1334efd22e6ca7d5cc5464b4eb)
* Bluetooth HIDD: Remove unplug()Hansong Zhang2018-03-281-23/+0
| | | | | | | | | | | 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 dbc6d14f6ec399e63cee29adbe01fffcb166500f)
* HIDD: Address API Review concernsIvan Podogov2018-03-221-77/+281
| | | | | | | | | | | | | | * 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)
* Pass in the user defined by Context.Jeff Sharkey2018-02-031-1/+1
| | | | | | | | | | | | | | | 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
* BluetoothHidDevice: rename onIntrData to onInterruptData (1/5)Hansong Zhang2017-12-191-3/+3
| | | | | | Bug: 63384609 Test: make Change-Id: I3b55f7383d2a84162d681ebf3740ddc9e8a55bbb
* Publish Bluetooth HID Device Profile Service APIHansong Zhang2017-12-141-2/+0
| | | | | | | | Enable the BluetoothHidDevice API in framework. Bug: 63384609 Test: SL4A HID test; test with apps using BluetoothHidDevice Change-Id: I52ca4674f11179f865bdff22e0289dfe893c40f5
* Merge "Bluetooth HID Device: format code, fix docstring, hide unplug()" am: ↵Hansong Zhang2017-12-081-95/+82
|\ | | | | | | | | | | | | | | 0d3990b235 am: c2205a8d3d am: 3c84b37f80 Change-Id: I31ca6fb738fc840fc27e834e9c90dda7bb7d3a12
| * Merge "Bluetooth HID Device: format code, fix docstring, hide unplug()"Treehugger Robot2017-12-071-95/+82
| |\
| | * Bluetooth HID Device: format code, fix docstring, hide unplug()Hansong Zhang2017-12-061-95/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | DO NOT MERGE: Merge Oreo MR1 into masterXin Li2017-12-061-1/+1
| |\ \ | | |/ | |/| | | | | | | Exempt-From-Owner-Approval: Changes already landed internally Change-Id: I727a014df2fb05a4b13cb67b1fcb760a8b387523
| * | Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)Hansong Zhang2017-12-041-13/+6
| | | | | | | | | | | | | | | | | | Bug: 69981563 Test: HID Device SL4A Test Change-Id: Ifb7002bb4f3f6f29b01a3d337ab68b674d6947c9
* | | Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)Hansong Zhang2017-11-301-13/+6
| | | | | | | | | | | | | | | | | | Bug: 69981563 Test: HID Device SL4A Test Change-Id: Ifb7002bb4f3f6f29b01a3d337ab68b674d6947c9
* | | Merge "Bluetooth HID Device API docs and helper" am: a89f6150dc am: 7c005ea373Hansong Zhang2017-11-161-9/+27
|\ \ \ | | |/ | |/| | | | | | | | | | am: 55839ebbb8 Change-Id: Ic655da25a4722a49a982dad68621cf4e669af8fe
| * | Merge "Bluetooth HID Device API docs and helper"Hansong Zhang2017-11-161-9/+27
| |\| | | | | | | | | | | | | | | | am: a89f6150dc Change-Id: I4b91cd3e528f480ea216e9ffb0414910d4762d3b
| | * Bluetooth HID Device API docs and helperHansong Zhang2017-11-151-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | Merge commit '98e12851336b7db16e583f9afac63ecc97465980' fromXin Li2017-11-141-1/+1
| |\ \ | | |/ | |/| | | | | | | | | | | | | oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master. Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7 Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
* | | Merge "Enable HID Device Profile Service (2/2)" am: 7e3fbd59d1 am: 21bb474cc3Hansong Zhang2017-10-271-33/+38
|\ \ \ | | | | | | | | | | | | | | | | | | | | am: f5286b90ef Change-Id: I2731033de8e962fbe0161c715d5689a309772ec3
| * | | Merge "Enable HID Device Profile Service (2/2)" am: 7e3fbd59d1Hansong Zhang2017-10-271-33/+38
| |\| | | | | | | | | | | | | | | | | | | | | | am: 21bb474cc3 Change-Id: I84377e882c77b16862b1e049c54e36dc94c78883
| | * | Enable HID Device Profile Service (2/2)Hansong Zhang2017-10-271-33/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Merge "Change Bluetooth HID Profile Name (1/6)" am: 8218b219f3Hansong Zhang2017-10-231-0/+569
| |\| | | | |/ | |/| | | | | | | | | | am: c8a370aeba Change-Id: I2c5da84f5b57496e2a0ef45fb17085670f7465a9
| | * Change Bluetooth HID Profile Name (1/6)Hansong Zhang2017-10-231-0/+569
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* / Change Bluetooth HID Profile Name (1/11)Hansong Zhang2017-10-231-0/+569
|/ | | | | | | | | | | | | | | | 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
* Rename the Bluetooth profile classes for HID Device role.Ivan Podogov2016-12-291-500/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* Bluetooth: Add support for HID Device RoleHemant Gupta2016-12-291-0/+500
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