Commit Graph

1336 Commits

Author SHA1 Message Date
Sal Savage
4afdab44ab Update BluetoothProfileConnector to invoke service disconnections with correct profile ID
Bug: b/133517229
Test: Build + Manual on automotive hardware
Change-Id: Id8dbeaf844a65020f610505f81eea20b96ec002a
2019-05-28 16:56:23 +00:00
Sal Savage
5d145c06ea Add timestamp and read status extra constants to MAP Client
Bug: b/132455654
Test: build and run on automotive hardware. Use kitchen sink to send
and receive messages.

Change-Id: Ic0f04640f1894d6cf336ba7e641df9cf148a2bbd
Merged-In: Ic0f04640f1894d6cf336ba7e641df9cf148a2bbd
2019-05-21 08:16:47 -07:00
Ugo Yu
d011546a85 Fix binder leakage when turning off Bluetooth
* 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
2019-05-02 17:25:52 +08:00
Treehugger Robot
964f6265ad Merge "Add more documentation for LE CoC" 2019-04-22 02:05:22 +00:00
Treehugger Robot
ce5fdc042a Merge "Add nullability annotations to android.bluetooth.le.ScanFilter.Builder setServiceSolicitationUuid" 2019-04-20 02:20:04 +00:00
Stanley Tng
bcbc130235 Add more documentation for LE CoC
Added more information into Android SDK for LE Connection-oriented
Channels (CoC) so that it matches the corresponding RFComm
documentation.

Bug: 70683224
Test: Compile
Change-Id: I40abde70a7ca6bcd194ee75bd8367c0ed9e97d05
2019-04-19 15:50:42 -07:00
Zach Johnson
df588a2292 Add nullability annotations to android.bluetooth.le.ScanFilter.Builder setServiceSolicitationUuid
Test: compilation
Fixes: 126698824
Change-Id: I4873b46a37df3e103ddc62001cc9f0bc01aea4dc
2019-04-19 15:30:22 -07:00
Treehugger Robot
e5cf74326d Merge "Refine Bluetooth Metadata API" 2019-04-15 20:37:28 +00:00
Jakub Pawlowski
64307cc0b2 Bluetooth: Make ScanRecord.getServiceSolicitationUuids NonNull
Test: compilation
Bug: 115639878
Merged-In: I5f895d65a7036275ab0faa0afd2ee1eebc416476
Change-Id: I5f895d65a7036275ab0faa0afd2ee1eebc416476
2019-04-12 09:27:10 +02:00
Jack He
875ff327e0 BluetoothHealth: hide auto-created default constructors
Fixes: 123926561
Test: make
Change-Id: I388472c82eaca245285b5ecf2959c415508d7e69
2019-04-01 13:19:54 -07:00
Ugo Yu
50e3c08d4c Refine Bluetooth Metadata API
- Modify MetadataListener to as an interface and rename
  it to OnMetadataChangedListener
- Fix typo UNTHETHERED -> UNTETHERED
- Add NonNull annotation for metadata API parameters
- Re-design metadata unregister API
- Change metadata type to byte array

Bug: 124448651
Bug: 126701203
Bug: 126699213
Test: build pass

Change-Id: I79460071c7693f648e92cf849738c24f8bc269d9
Merged-In: I79460071c7693f648e92cf849738c24f8bc269d9
2019-04-01 23:16:17 +08:00
Ugo Yu
1d2e68cf4b Refine Bluetooth silence mode API
- Remove silence state extra data from ACTION_SILENCE_MODE_CHANGED
  intent
- Rename getSilenceMode -> isInSilenceMode
- Throw IllegalStateException if Bluetooth is not enabled

Bug: 124448652
Test: runtest bluetooth

Change-Id: I6a8d8d848249faaac34e87408dcf750073b03584
2019-03-22 14:30:59 +08:00
Stanley Tng
7f3b781bfa Cleanup annontations for Hearing Aids Profile API
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-16 00:22:34 +00:00
Deqiang Chen
2a1bdd2429 Merge "Avoid IllegalArgumentException when bluetooth is disabled" 2019-03-14 22:23:18 +00:00
Stanley Tng
97341da063 Add @NonNull annotations to LE CoC APIs
Added NonNull annotations to the 4 LE Connection-oriented channel API in
BluetoothDevice and BluetoothAdapter.

Bug: 126701988
Bug: 126701989
Test: Compile only
Change-Id: I2d4dc8fbd06e30c782123e01f8481d249e40ee02
2019-03-13 02:27:38 +00:00
Deqiang Chen
da9f738c0c Avoid IllegalArgumentException when bluetooth is disabled
When the corresponding profile service is not available on device,
bluetoothA2dp, bluetoothHidHost and bluetoothPbap will report
IllegalArgumentException when bluetooth is disabled. This change avoid
that exception.

Bug: 127359897
Test: local test and observe there is no IllegalArgumentException when
bluetooth is disabled

Change-Id: I457e5225b8710dd5d02c405ef558892e99d1736f
(cherry picked from commit ee8371007b82ff8c6d26e8ac90c6e3d3cf6bf2a8)
2019-03-12 14:53:45 -07:00
Treehugger Robot
27a6501a19 Merge "Change BluetoothCodecStatus.sameCapabilities() to public" 2019-03-08 10:38:47 +00:00
Stanley Tng
9d37667fdc Add @NonNull annotations to Hearing Aids Profile APIs
Bug: 126699327
Bug: 119617521
Test: Ran with CTS tests for Hearing Aids Profile, android.bluetooth.cts.HearingAidProfileTest
Change-Id: If83052a68c867d839e263f490592b80bef513a01
2019-03-06 17:17:40 +00:00
Ugo Yu
87f8ec4965 Change BluetoothCodecStatus.sameCapabilities() to public
- Public this API to help A2DP state machine check selectable
  codec capabilities status.

Bug: 124254557
Bug: 125551347
Test: runtest bluetooth

Change-Id: If44887f756d2e8348e8f76dfb67b77b993ffd8db
2019-02-27 19:49:13 +08:00
Nan Zhang
944f18371b Fix the incorrect javadoc links
A lot of unresolved link errors showing up after go/ag/5172152.

Test: m -j docs with -lerror enabled
Bug: b/116163454
Change-Id: I74d1f75e0f00015410a63e13103c28a9c84b4fe0
2019-02-15 14:39:24 -08:00
Xin Li
0e71b4f19b DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into
stage-aosp-master

Bug: 124234733
Change-Id: Ic4f67fde0835da0b1c363906cccef0d244e38393
2019-02-14 09:48:06 -08:00
Treehugger Robot
d17b284bdb Merge "Introduce system APIs for Bluetooth silence mode." 2019-01-24 18:08:05 +00:00
Treehugger Robot
9d3ce3e55e Merge "Change MetadataListener to a abstract static class" 2019-01-24 07:07:49 +00:00
Ugo Yu
d9a0a7fd55 Change MetadataListener to a abstract static class
Bug: 121051445
Test: build pass
Change-Id: I8148d13d2eb0899d54817197ae0be236e2914e47
2019-01-24 09:48:20 +08:00
Treehugger Robot
a53fc20213 Merge "Add Android APIs for Hearing Aids Profile" 2019-01-24 01:37:05 +00:00
Treehugger Robot
7982e6f346 Merge "Add 2 new ways to check for Support for Hearing Aids Profile" 2019-01-24 01:34:24 +00:00
Ugo Yu
bfbe0ee89d Introduce system APIs for Bluetooth silence mode.
Policies of silence mode:
1) If an active device (for A2DP or HFP) enters silence mode,
   the active device for that profile will be set to null.
2) If a device exits silence mode while the A2DP or HFP active
   device is null, the device will be set as the active device
   for that profile.
3) If a device is disconnected, it exits silence mode.
4) If a device is set as the active device for A2DP or HFP,
   while silence mode is enabled, then the device will exit
   silence mode.
5) If a device is in silence mode, AVRCP position change event
   and HFP AG indicators will be disabled.
6) If a device is not connected with A2DP or HFP, it cannot
   enter silence mode.

Bug: 112323989
Test: Manual, runtest bluetooth
Change-Id: If7f340de38c350f17c37f00a3a2e871876baa20d
2019-01-24 08:40:51 +08:00
Stanley Tng
1f5ea66a39 Add Android APIs for Hearing Aids Profile
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
2019-01-22 16:50:12 -08:00
Stanley Tng
61dbd81f6a Add 2 new ways to check for Support for Hearing Aids Profile
The getProfileProxy will return false if Hearing Aids Profile is not
supported. Also the getSupportedProfiles will return the correct support
for Hearing Aids even when Bluetooth is disabled.

Test: Manual testing with configuration enabled and disabled.
Bug: 119617521
Change-Id: I146bd3bc36d4c474f7bca18a05b679fb8e70ca63
2019-01-22 16:46:06 -08:00
Ugo Yu
4a33b88761 Skeleton implementation of Bluetooth metadata APIs
Bug: 121051445
Test: Build pass
Change-Id: I5e80210205b37294b1eb8356502ebf242e627ce4
2019-01-23 07:01:47 +08:00
Jack He
6b73b32c7a Deprecate BluetoothHealth APIs
* Mark all BluetoothHealth related APIs as deprecated
* Make BluetoothAdapter#getProfileProxy(context, BluetoothProfile.HEALTH)
  always return false
* Remove all logic behind BluetoothHealth APIs and add deprecation error log
* Health Device Profile (HDP) and MCAP protocol has been largely
  replaced by BLE. New applications should use Bluetooth Low Energy
  instead of legacy Bluetooth Health Device Profile

Bug: 111562841
Test: make, unit test, use Bluetooth
Change-Id: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
Merged-In: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
(cherry picked from commit 2be70a11a2)
2019-01-09 18:09:21 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Zach Johnson
57e6e90204 Pass package name as part of startDiscovery
Test: manual
Bug: 118347252
Change-Id: Icbc2e7e756b16ffd181924b586a0292c2bf32ec5
2018-12-12 20:33:09 -08:00
Jakub Pawlowski
b5dee1bafd Bluetooth: Check descriptors size in BluetoothHidDeviceAppSdpSettings
Bug: 119819889
Test: compilation
Change-Id: If51d0e2af74d99758f79a603d40cc2f5c84e4dde
(cherry picked from commit 63519217e8)
2018-12-05 05:14:10 +00:00
Treehugger Robot
c4ce66dd2f Merge "BluetoothManager: Set DBG to false" 2018-12-01 04:44:09 +00:00
Jakub Pawlowski
4c2aa61202 Bluetooth: Fix NPE when accesing Manufacturer Data of invalid ScanRecord
Bug: 118805852
Test: compilation
Change-Id: I537bec61cd3e7df700cc972683458f977ff370b8
2018-11-29 07:20:53 +00:00
Treehugger Robot
6c4c8aeb70 Merge "HFP: Send caller ID in +CLIP command (1/4)" 2018-11-21 20:21:19 +00:00
Treehugger Robot
215a48cff4 Merge "BluetoothDevice.ACTION_UUID requires BLUETOOTH_ADMIN" 2018-11-21 01:58:32 +00:00
Stanley Tng
420a0eb576 Enable the Debug Logs for Hearing Aids Profile
Bug: 119617521
Test: Compile
Change-Id: I40de1fcb3ca9e0ee66b4650a161f3735722df7ed
2018-11-15 10:22:07 -08:00
Myles Watson
3ee31a7ac6 BluetoothManager: Set DBG to false
Fixes: 71491860
Test: Pair and connect with a phone
Change-Id: I3ead8154765267105c74cd800f571933bbe82e07
2018-11-15 13:58:42 +00:00
Hansong Zhang
ff1c21c94c BluetoothDevice.ACTION_UUID requires BLUETOOTH_ADMIN
Fix the doc - intent BluetoothDevice.ACTION_UUID requries
android.Manifest.permission#BLUETOOTH_ADMIN instead of #BLUETOOTH to
receive. This is already enforced by Bluetooth service.

Bug: 113160320
Test: manual
Change-Id: I977d58e6d534f512da80bd6b13bebb515765626f
2018-11-12 14:33:59 -08:00
Benson Li
1d4f64ac7c HFP: Send caller ID in +CLIP command (1/4)
* Modify BluetoothHeadset so that phoneStateChanged method can
  provide caller display name

Bug: 111378831
Test: runtest bluetooth, runtest -x BluetoothPhoneServiceTest.java
Change-Id: Ibc3611a50ec9f103fd235dde606ecbd10657e014
2018-11-09 20:11:04 +00:00
TreeHugger Robot
022cf30d17 Merge "Be the current user to get A2DP proxy" into pi-dev 2018-10-30 22:22:14 +00:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a4)
2018-10-22 17:28:24 -07:00
Ajay Panicker
6c96b70195 Synchronize on a static final object to lock mDeviceBusy
Synchronizing on a field doesn't lock the object in a predictable way.

Bug: 63389270
Test: Compile
Change-Id: Idd3111bc94d32bc4bb320a5c25da37fe68276337
2018-10-17 18:20:51 +00:00
Jack He
097a89513e Remove BluetoothDevice.ACTION_DISAPPEARED
This intent was never sent by the Bluetooth stack

Fixes: 112115770
Test: make
Change-Id: Iaf71aeafa21f44ec9b59c1b766c936ab7dde39f1
2018-10-11 21:06:29 +00:00
kopriva
219f7dcb66 docs: fixing errors found with lint checker
through /bluetooth directory

amending through /content directory

Test: make ds-docs

Bug: 117494359

Change-Id: I751e15d60f0b9cc441998b27560050bf62994fef
Exempt-From-Owner-Approval: Docs-only change
2018-10-09 16:01:04 -07:00
Andrew Solovay
a44f2c075b docs: Replacing {#link with {@link
Several java files had the typo {#link (for cross-references to other
Javadocs) instead of the proper {@link format. This was confusing the
new doc publish tool (Mivi) since that's the format used for {# Django
comments #}.

Fixed a couple of links that had other errors (which prevented building
once the {# -> {@ was done) and other typos.

Replaced throughout the frameworks/base project; I'll need a separate CL
for the AndroidX fixes.

Staged to:

go/dac-stage/reference/android/app/Instrumentation.html
go/dac-stage/reference/android/bluetooth/BluetoothAdapter.html
go/dac-stage/reference/android/bluetooth/BluetoothDevice.html
go/dac-stage/reference/android/bluetooth/BluetoothServerSocket.html
go/dac-stage/reference/android/inputmethodservice/InputMethodService.html
go/dac-stage/reference/android/view/KeyCharacterMap.html
go/dac-stage/reference/android/view/KeyEvent.html
go/dac-stage/reference/android/media/AudioManager.html
go/dac-stage/reference/android/net/wifi/WifiConfiguration.html

(Other files were not in the public Javadocs.)

Bug: 111925950
Test: make ds-docs
Exempt-From-Owner-Approval: Docs-only change
Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Merged-In: Ia06e1fffd814671289a1caebd5962aedc18a28d7
2018-10-04 18:20:51 +00:00
Vasu Nori
694752d5b9 Add hidden API to return "Uploading" bit value from SDP record's MapSupportedFeatures.
Bug: 111614861
Test: tested w/ KitchenSink App
Change-Id: I43895183d7b315f57257e1d2045f17dedcb0cfcd
2018-09-25 21:39:31 +00:00
Treehugger Robot
0677766615 Merge "Unhide the LE CoC APIs" 2018-09-18 18:31:26 +00:00