aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothMapClient.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix array-related errorprone warningsCole Faust2022-09-141-1/+5
| | | | | | | | | | | | | The ArrayEquals, ArrayHashCode, ArrayToString, and ArraysAsListPrimitiveArray errorprone findings were demoted from errors to warnings. Fix existing occurrences of them so they can be made errors again. Bug: 242630963 Test: RUN_ERROR_PRONE=true m javac-check Change-Id: Ie9d62731bef7e282d0909697963fce681c356d05 Merged-In: Ie9d62731bef7e282d0909697963fce681c356d05 (cherry picked from commit 760b18105998d241f3b1132227ea07088a5120c4)
* Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux2022-06-221-12/+12
| | | | | | | | Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644
* Update public function documentation for Map ClientAndrew Cheng2022-03-021-11/+3
| | | | | | | | | | | This change inherits the documentation from the parent class definitions where it can, so our profile proxy can be more in line with others. Ignore-AOSP-First: Mainline-related going into internal first Tag: #refactor Bug: 221881179 Test: atest BluetoothInstrumentationTests Change-Id: Ied98b70ea8fb698c576a43c09ba384698bb78233
* New @SystemApi's in BluetoothMapClientAndrew Cheng2022-01-221-15/+83
| | | | | | | | | | | | | | | | New System APIs include: - ACTION_CONNECTION_STATE_CHANGED - getConnectedDevices - getConnectionPolicy - getConnectionState - getDevicesMatchingConnectionState - setConnectionPolicy Tag: #feature Bug: 206830632 Test: atest BluetoothInstrumentationTests Test: atest BluetoothHostTest Change-Id: Ic175121a2093cd8605100632e2d136956a6bf6b7
* Remove allowBlocking from all BluetoothProfilesWilliam Escande2021-12-161-101/+150
| | | | | | | | | | | | | 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
* 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-2/+3
| | | | | | | | | | | | | | | 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-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+12
| | | | | | | | | | | | | | | | 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/+19
| | | | | | | | | | | | | | | | 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/+17
| | | | | | | | | | | | | | | | | | 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-8/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add BluetoothMapClient to system APIJoseph Pirozzo2021-02-191-15/+86
| | | | | | | | | | Add BluetoothMapClient.sendMessage to system API for use by mainline modules. Bug: 157948464 Test: atest BluetoothInstrumentationTests Tag: #feature Change-Id: Idee4cb2cefeaf03f0351ea576f919a294219d391
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-11-041-1/+2
| | | | | | | | | | | 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
* Merge "Bluetooth: MCE: Add new API to set message read status or deleted status"Treehugger Robot2020-07-141-0/+69
|\
| * Bluetooth: MCE: Add new API to set message read status or deleted statusFei Zheng2020-06-261-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 146314855 Test: 1. Pair with a remote device which address is like 00:01:02:03:04:05 2. On remote device allow MAP connection 3. Make sure there is at least 1 unread message in last week on remote device 4. adb shell am instrument -w -e mce_set_message_status_iterations 1 -e device_address 00:01:02:03:04:05 -e class android.bluetooth.BluetoothStressTest#testMceSetMessageStatus com.android.bluetooth.tests/android.bluetooth.BluetoothTestRunner Change-Id: I7a3e337142bc39a55c1bfd425e0966e1fb1b9a68
* | Remove unnecessarily @System/TestApi annotationsMakoto Onuki2020-06-241-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | We can't expose APIs if the enclosing class is hidden, so these annotations are redundant. We need to remove them so that we can enable the check. Exempt-From-Owner-Approval: Cherry-pick from goog/master Bug: 159121253 Test: treehugger (i.e. this shouldn't trigger "API has changed" error.) Merged-in: Ie1841a670bdf6c6f4b25a1fc5deed8ec2d18cda2 Change-Id: I36e3562b72e64b51e4febd1d42a3bc8e4dc60988
* | Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth ↵Rahul Sabnis2020-03-211-6/+13
| | | | | | | | | | | | | | | | | | | | | | 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
* | Use @ConnectionPolicy annotation more consistently in classes withRahul Sabnis2020-01-221-2/+3
|/ | | | | | | | methods setConnectionPolicy and getConnectionPolicy Bug: 147669289 Test: Manual Change-Id: I2b9b0391a02d01623c1cd253f2da12b2baaea599
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-101-1/+1
| | | | | | | | | 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 Merged-In: I6ab53570aca580fbee1fcc927871caa09780f58f
* Rename priority to connection policy in bluetooth apisRahul Sabnis2019-12-021-10/+54
| | | | | | Bug: 145005327 Test: Manual Change-Id: I43ad57feb7dd70f39005ad7a01bc7dac6fb7b639
* Add timestamp and read status extra constants to MAP ClientSal Savage2019-05-211-0/+4
| | | | | | | | | Bug: b/132455654 Test: build and run on automotive hardware. Use kitchen sink to send and receive messages. Change-Id: Ic0f04640f1894d6cf336ba7e641df9cf148a2bbd Merged-In: Ic0f04640f1894d6cf336ba7e641df9cf148a2bbd
* Fix binder leakage when turning off BluetoothUgo Yu2019-05-021-109/+28
| | | | | | | | | | | | | | | | | | | | | * 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
* Add hidden API to return "Uploading" bit value from SDP record's ↵Vasu Nori2018-09-251-0/+19
| | | | | | | | MapSupportedFeatures. Bug: 111614861 Test: tested w/ KitchenSink App Change-Id: I43895183d7b315f57257e1d2045f17dedcb0cfcd
* Merge "Add @UnsupportedAppUsage annotations"Mathew Inwood2018-08-061-0/+2
|\ | | | | | | | | | | am: b40b37910d Change-Id: Ic3de9e4c6d17687d4a1f64c02026e5c0711e8fd1
| * Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | 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
* Bluetooth: Thread-safe binder invocationJack He2017-09-061-33/+39
| | | | | | | | | | | | | | | | | | | | * Binder object may become null between null check and actual invocation if using a instance private variable assignable by service connection callbacks * The solution to this problem without locking is to assign existing binder variable to a local final variable before the null check * Any further invocation to a disconnected binder object will result in RemoteException that is caught by the try-catch block * Read and write to volatile variable is always atomic and hence thread-safe * Removed unnecessary synchronization in BluetoothAdapter constructor * Private mConnection objects should be final * Simplfied several return statements where booleans can be returned directly * Removed unnecessary catches for NPE since there won't be any Bug: 64724692 Test: make, pair and use devices, no functional change Change-Id: Ifc9d6337c0d451a01484b61243230725d5314f8e
* Fix checkstyle errors (2/2)Jack He2017-08-241-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | * Manual style corrections with IDE assistance * Variable name refactors are done through IDE * Corrected general style errors such as: - "final private var" -> "private final var" - "&&", "+", "||" should not be at the end of line - Non-static private variable should be like "mVar" - Private static variable should be like "sVar" - Code file should always end with newline - Inherited methods should be annotated with @Override and no @hide tags - Public methods should always have a JavaDoc entry - "int[] array" is preferred over "int array[]" - private methods should be accessed without "this." when there is no name collisions. - "boolean ? true : false" -> boolean - "boolean ? false : true" -> !boolean - "boolean == true" OR "boolean != false" -> boolean - "boolean != true" OR "boolean == false" -> !boolean Bug: 63596319 Test: make checkbuild, no functional changes Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
* Fix checkstyle errors (1/2)Jack He2017-08-241-5/+5
| | | | | | | | * Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
* Adding handle extra in unread-message broadcastSrinivas Visvanathan2017-03-071-1/+4
| | | | | | | | - Handle will be useful for messaging apps. Bug: 33280056 Test: Manually Change-Id: Id4b1bf2d90d9eaea1504cc270a922a1d6f1c468b
* Defining extras for New Unread-Message BroadcastSrinivas Visvanathan2017-03-031-0/+6
| | | | | | | | - Defining extras for sender fields in the Broadcast intent. Bug: 33280056 Test: Manually Change-Id: Ie77bee498141c079f6f2ec811e527230c95e8831
* MAP MCEJoseph Pirozzo2016-11-011-1/+1
| | | | | | | | Fix @LINK to @link in javadoc. Bug: 30467210 Change-Id: Icac176947bee971c3f5d11fd4166cf8ceb0a437e (cherry picked from commit 584bb127754b2826e8a540e23acb2a6c398e6432)
* MAP MCEJoseph Pirozzo2016-11-011-0/+415
Add MAP client code into packages/apps/Bluetooth. Changes here are to define the MAP MCE interface and enable its selection when running on a device that is also running a PBAP client (Car Kitt). Bug: 30467210 Change-Id: Ifa2cdea7d67f63a2b5f3d971df8ec6d321dc5fee (cherry picked from commit fae5ff2578fe1e51a4677e6d344d4f5ff4618ed1)