OSDN Git Service

android-x86/system-bt.git
6 years agoAdd General Reject for invalid PDU ID
tedwang [Tue, 15 May 2018 14:21:39 +0000 (22:21 +0800)]
Add General Reject for invalid PDU ID

Add Avrcp Browse General Reject packet
Respond general reject when undefined AVRCP Browsing PDU ID sent from
remote.

Bug: 79376704
Test: run host native test net_test_btpackets
Change-Id: I8a44d8e3f0cc5fac89e23217726c76ede4aff916

6 years agoUse identity addr in BLE scan filter
Claire Treyz [Fri, 11 May 2018 15:13:28 +0000 (08:13 -0700)]
Use identity addr in BLE scan filter

For BT controllers with the ability to filter scans and resolve RPAs on
controller, when trying to filter for a Public ID type address the
filter must use the static identity address of the peer device instead
of the random pseudo address.

Bug: 78888800
Test: manually tested filtered scanning for BLE peer with RPA with a
device with both offloaded RPA resolution & controller filtering
supported. Tested on a device with no controller filtering, which has
no changes, as expected.

Change-Id: I1d92e219bdbc9ba2399eae637a1f4623d695a3f8
(cherry picked from commit 10704399e1cfbad3421c3272795952cad3ee2920)

6 years agoMerge "Check number of attributes before writing to a buffer" into pi-dev
TreeHugger Robot [Mon, 14 May 2018 19:39:15 +0000 (19:39 +0000)]
Merge "Check number of attributes before writing to a buffer" into pi-dev

6 years agoMerge "Add respond Reject with Invalid parameter for Unknown Capability ID" into...
Andre Eisenbach [Mon, 14 May 2018 19:38:34 +0000 (19:38 +0000)]
Merge "Add respond Reject with Invalid parameter for Unknown Capability ID" into pi-dev

6 years agoMerge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev am...
Ajay Panicker [Mon, 14 May 2018 18:45:23 +0000 (11:45 -0700)]
Merge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev am: 28af3285c7 am: 7860023df0
am: 1817ac9854

Change-Id: I6b715a091134e48bc2c96d22134c66fc67b155c5

6 years agoMerge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev am...
Ajay Panicker [Mon, 14 May 2018 18:41:20 +0000 (11:41 -0700)]
Merge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev am: 28af3285c7
am: 7860023df0

Change-Id: Id8004ef8b208731ba321e3abd1bb562a29f03548

6 years agoMerge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev
Ajay Panicker [Mon, 14 May 2018 18:37:26 +0000 (11:37 -0700)]
Merge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev
am: 28af3285c7

Change-Id: I9bb0aa68376166994103a659d181e3f7f071c3b5

6 years agoMerge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev
Ajay Panicker [Mon, 14 May 2018 18:27:44 +0000 (18:27 +0000)]
Merge changes from topic "am-deb20f2a-d7e9-4660-922e-16ad46b80c7a" into oc-dev

* changes:
  [automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb am: 58304c3cf3 skipped: ec6632f93a
  [automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb am: 58304c3cf3
  [automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb
  [automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b
  [automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241
  DO NOT MERGE: Check number of attributes before writing to a buffer

6 years agoCheck number of attributes before writing to a buffer
Ajay Panicker [Fri, 11 May 2018 19:03:07 +0000 (12:03 -0700)]
Check number of attributes before writing to a buffer

Bug: 73824150
Test: Compile
Change-Id: I2a28a503cd74758e707d1e591b55c278d2299f45
(cherry picked from commit f6db54f071f6974e18b10bb0c2cfcf397cd4c980)

6 years agoMerge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev...
Ajay Panicker [Mon, 14 May 2018 18:19:40 +0000 (11:19 -0700)]
Merge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev am: 89c77dff32 am: 992d901683
am: 3c6d9aef37

Change-Id: I83ccedc2c4a6e36e66c0b398db8e2578e3c379a6

6 years agoMerge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev...
Ajay Panicker [Mon, 14 May 2018 18:15:08 +0000 (11:15 -0700)]
Merge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev am: 89c77dff32
am: 992d901683

Change-Id: I4822314170228bc6df8d3b60f7ee04ea4fa7c5c2

6 years agoMerge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev
Ajay Panicker [Mon, 14 May 2018 18:11:06 +0000 (11:11 -0700)]
Merge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev
am: 89c77dff32

Change-Id: I50263727a1020e77133f92938f6ecf0770eef14f

6 years agoMerge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev
Ajay Panicker [Mon, 14 May 2018 18:01:38 +0000 (18:01 +0000)]
Merge "Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ" into oc-dev

6 years agoMerge "Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 23:30:55 +0000 (23:30 +0000)]
Merge "Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into pi-dev

6 years agoMerge "Explicitly restart audio processing when switching active device" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 23:16:03 +0000 (23:16 +0000)]
Merge "Explicitly restart audio processing when switching active device" into pi-dev

6 years ago[automerger skipped] Merge "DO NOT MERGE: Check number of attributes before writing...
Ajay Panicker [Fri, 11 May 2018 22:45:35 +0000 (15:45 -0700)]
[automerger skipped] Merge "DO NOT MERGE: Check number of attributes before writing to a buffer" into oc-dev am: 2f9f6adfed am: aded757078
am: 4a6c4b0c64  -s ours

Change-Id: I979219abffdf2fa7e851dcc326931c1c25d219fa

6 years ago[automerger skipped] Merge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTI...
Hansong Zhang [Fri, 11 May 2018 22:45:23 +0000 (15:45 -0700)]
[automerger skipped] Merge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev am: cf48e73715 am: 1fc8fe3b9f
am: 3e207131ab  -s ours

Change-Id: Iea5616f8aa43080304bdc30dd1543f2c2930401b

6 years ago[automerger skipped] [automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP...
Hansong Zhang [Fri, 11 May 2018 22:45:05 +0000 (15:45 -0700)]
[automerger skipped] [automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81 am: 90f604c087 skipped: 5ab83c7a00 am: e719eb2c4f am: f7ecdd2915
am: 9b5b26bc63  -s ours

Change-Id: Ie3d309838be405e0c800a235861a7862d99cf230

6 years agoMerge "DO NOT MERGE: Check number of attributes before writing to a buffer" into...
Ajay Panicker [Fri, 11 May 2018 22:41:24 +0000 (15:41 -0700)]
Merge "DO NOT MERGE: Check number of attributes before writing to a buffer" into oc-dev am: 2f9f6adfed
am: aded757078

Change-Id: I4ec111d45f8e76aef0095dbf2051b4c3e1f43c5a

6 years agoMerge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc...
Hansong Zhang [Fri, 11 May 2018 22:41:03 +0000 (15:41 -0700)]
Merge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev am: cf48e73715
am: 1fc8fe3b9f

Change-Id: I4ed11e20c3815108510e9d84a6afeda583254613

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Hansong Zhang [Fri, 11 May 2018 22:40:42 +0000 (15:40 -0700)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81 am: 90f604c087 skipped: 5ab83c7a00 am: e719eb2c4f
am: f7ecdd2915

Change-Id: Iaf1eada64bbf87ce545d4d0a975041b51bfb911e

6 years agoMerge "DO NOT MERGE: Check number of attributes before writing to a buffer" into...
Ajay Panicker [Fri, 11 May 2018 22:37:23 +0000 (15:37 -0700)]
Merge "DO NOT MERGE: Check number of attributes before writing to a buffer" into oc-dev
am: 2f9f6adfed

Change-Id: Ic6cfdf0368ff5b55a0cc0a4a41b006947d520cd4

6 years agoMerge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev
Hansong Zhang [Fri, 11 May 2018 22:37:00 +0000 (15:37 -0700)]
Merge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev
am: cf48e73715

Change-Id: Ie3b83f993975a6ac532072c774a3ca6c0d0b5272

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Hansong Zhang [Fri, 11 May 2018 22:36:38 +0000 (15:36 -0700)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81 am: 90f604c087 skipped: 5ab83c7a00
am: e719eb2c4f

Change-Id: I4626e6077542b983e7b6c8ba40d58f462fc215bb

6 years agoMerge "DO NOT MERGE: Check number of attributes before writing to a buffer" into...
TreeHugger Robot [Fri, 11 May 2018 22:26:01 +0000 (22:26 +0000)]
Merge "DO NOT MERGE: Check number of attributes before writing to a buffer" into oc-dev

6 years agoMerge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev
TreeHugger Robot [Fri, 11 May 2018 22:24:23 +0000 (22:24 +0000)]
Merge "DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE" into oc-dev

6 years agoMerge "HFP: Workaround for car kits that do not send AT+BAC command" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 21:52:53 +0000 (21:52 +0000)]
Merge "HFP: Workaround for car kits that do not send AT+BAC command" into pi-dev

6 years agoMerge "Hearing Aid: Add dumpsys log for audio packet" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 21:47:23 +0000 (21:47 +0000)]
Merge "Hearing Aid: Add dumpsys log for audio packet" into pi-dev

6 years agoMerge "bta: Only call get_acl_data_size_ble for LE" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 21:46:26 +0000 (21:46 +0000)]
Merge "bta: Only call get_acl_data_size_ble for LE" into pi-dev

6 years agoMerge "BTM_BleClearBgConnDev: Return if there is no BLE" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 21:46:23 +0000 (21:46 +0000)]
Merge "BTM_BleClearBgConnDev: Return if there is no BLE" into pi-dev

6 years agoMerge "Return early if vendor-specific command fails" into pi-dev
TreeHugger Robot [Fri, 11 May 2018 21:46:20 +0000 (21:46 +0000)]
Merge "Return early if vendor-specific command fails" into pi-dev

6 years agoExplicitly restart audio processing when switching active device
Pavlin Radoslavov [Thu, 10 May 2018 16:52:58 +0000 (09:52 -0700)]
Explicitly restart audio processing when switching active device

* Add internal APIs to restart A2DP session and use them
  when switching the A2DP active device:
  btif_a2dp_source_restart_session() and btif_a2dp_sink_restart_session() .
* Removed internal A2DP Source APIs that shouldn't be APIs
* Call immediately btif_a2dp_on_stopped() when processing
  BTIF_AV_STOP_STREAM_REQ_EVT event to stop sooner the audio
  datapath processing and report back to the Audio HAL call.
  This eliminates the need for waiting for the BTA_AV_STOP_EVT
  upcall event from the remote device.
* Added extra log information when processing events in the BtifAv
  state machine.

Bug: 78360113
Test: Manual: streaming A2DP, change active device, change codec setup.
Change-Id: Icb356587af9cfaee7aea9f3f9bc95a0fe000fc52
Merged-In: Icb356587af9cfaee7aea9f3f9bc95a0fe000fc52
(cherry picked from commit c7a5e6038a1c01de1a2219659f999e91003af598)

6 years agoAdd bound check for AVRC_EVT_APP_SETTING_CHANGE
Hansong Zhang [Fri, 11 May 2018 18:36:29 +0000 (11:36 -0700)]
Add bound check for AVRC_EVT_APP_SETTING_CHANGE

Test: manual
Bug: 73782082
Change-Id: I4e384a2f8c0d8c4af03bd5865b2e907321419c86

6 years agoDO NOT MERGE: Check number of attributes before writing to a buffer
Ajay Panicker [Fri, 11 May 2018 19:03:07 +0000 (12:03 -0700)]
DO NOT MERGE: Check number of attributes before writing to a buffer

Bug: 73824150
Test: Compile
Change-Id: I2a28a503cd74758e707d1e591b55c278d2299f45

6 years ago[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer...
Android Build Merger (Role) [Fri, 11 May 2018 18:58:10 +0000 (18:58 +0000)]
[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb am: 58304c3cf3 skipped: ec6632f93a

Change-Id: Id43b919238d9f5bf7b9621e1a492fcab41e77282

6 years ago[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer...
Android Build Merger (Role) [Fri, 11 May 2018 18:58:09 +0000 (18:58 +0000)]
[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb am: 58304c3cf3

Change-Id: Ice70ef13544a1f93a9dafb71241141274b81a7f1

6 years ago[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer...
Android Build Merger (Role) [Fri, 11 May 2018 18:58:08 +0000 (18:58 +0000)]
[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b am: 703cd5a1eb

Change-Id: Id36e3e2c089f6302db698b844a7ed0042e5b8658

6 years ago[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer...
Android Build Merger (Role) [Fri, 11 May 2018 18:58:06 +0000 (18:58 +0000)]
[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241 am: e24f24f31b

Change-Id: I8df01c872458bbc8b4ab435855b6c76353c8dab7

6 years ago[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer...
Android Build Merger (Role) [Fri, 11 May 2018 18:58:05 +0000 (18:58 +0000)]
[automerger] DO NOT MERGE: Check number of attributes before writing to a buffer am: d28e985241

Change-Id: Ic7688754333ee91513ef0fcd47594eb9e561b3dd

6 years agoDO NOT MERGE: Check number of attributes before writing to a buffer
Ajay Panicker [Fri, 11 May 2018 18:47:31 +0000 (11:47 -0700)]
DO NOT MERGE: Check number of attributes before writing to a buffer

Bug: 73824150
Test: Compile
Change-Id: Ie38ba177d6599afe28b5c6684bd951a75fa8a805

6 years agoDO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE
Hansong Zhang [Fri, 11 May 2018 18:36:29 +0000 (11:36 -0700)]
DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE

Test: manual
Bug: 73782082
Change-Id: I4e384a2f8c0d8c4af03bd5865b2e907321419c86

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Android Build Merger (Role) [Fri, 11 May 2018 18:41:13 +0000 (18:41 +0000)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81 am: 90f604c087 skipped: 5ab83c7a00

Change-Id: Ibcd75cd9298d3b3d03da14813514f662a141c66e

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Android Build Merger (Role) [Fri, 11 May 2018 18:41:11 +0000 (18:41 +0000)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81 am: 90f604c087

Change-Id: I45890811e5ea93ef7b2e42380b68064831a58097

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Android Build Merger (Role) [Fri, 11 May 2018 18:41:10 +0000 (18:41 +0000)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539 am: 26881fbd81

Change-Id: I3b58713fffba346fb96b93632755a41cf9f5a88e

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Android Build Merger (Role) [Fri, 11 May 2018 18:41:08 +0000 (18:41 +0000)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100 am: e621790539

Change-Id: I0f8c4399029939d01cdf9be1827e0957df8fcde6

6 years ago[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am...
Android Build Merger (Role) [Fri, 11 May 2018 18:41:06 +0000 (18:41 +0000)]
[automerger] DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE am: 9ca8320100

Change-Id: Ic53f90a5ce4767355afaeb0852053120f28df135

6 years agoDO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE
Hansong Zhang [Fri, 11 May 2018 18:40:44 +0000 (11:40 -0700)]
DO NOT MERGE AVRC: Add bound check for AVRC_EVT_APP_SETTING_CHANGE

Test: manual
Bug: 73782082
Change-Id: I4e384a2f8c0d8c4af03bd5865b2e907321419c86

6 years agoHFP: Workaround for car kits that do not send AT+BAC command
Jack He [Tue, 1 May 2018 06:59:40 +0000 (23:59 -0700)]
HFP: Workaround for car kits that do not send AT+BAC command

* Some misbehaving HF devices (e.g. some Hyundai car kits) indicate
  their support on Wide Band Speech and Codec Negotiation, but do not
  send the required AT+BAC command during Service Level Connection
  setup. However, such car kits still expect Fluoride to do codec
  negotiation during SCO setup.
* This CL adds a workaround so that when HF indicates support for WBS
  and codec negotiation, Fluoride will attempt codec negotiation even
  though AT+BAC is never received.
* Store the SDP feature locally. If WBS is supported and no AT+BAC is
  received, use the SDP features to set the suported codec.

Bug: 77883405
Test: make, connect SCO to and from Hyundai car kits
Change-Id: I2be6007022183cac5b9006f37089a587b4a67372
(cherry picked from commit e42cf153f8cc9f2b80153aa3eb7c0be04f3c326f)

6 years agoAdd respond Reject with Invalid parameter for Unknown Capability ID
tedwang [Wed, 9 May 2018 06:28:04 +0000 (14:28 +0800)]
Add respond Reject with Invalid parameter for Unknown Capability ID

Add handle Get Capabilities with Unknown Capability ID and unit test
for this.

Bug: 79269978
Test: Run host native test net_test_avrcp
Change-Id: I2cb606bcb6462190354bb471577d9383e43649c1

6 years agobta: Only call get_acl_data_size_ble for LE
Myles Watson [Thu, 3 May 2018 18:13:55 +0000 (11:13 -0700)]
bta: Only call get_acl_data_size_ble for LE

Pass 0xFFFF (max uint16_t) to GAP_ConnOpen, which will call
get_acl_data_size_ble() to correct the value, but only when the
connection type is LE.

Bug: 77495521
Bug: 76192234
Test: Start Bluetooth with a BT 3.0 chip (or a simulated one)
Change-Id: If46ea249081fc058faf09bcb5149f21d8baf7aa7
(cherry picked from commit a11bb2dcc23304a2d211f8b5237a5f5bff325880)

6 years agoBTM_BleClearBgConnDev: Return if there is no BLE
Myles Watson [Fri, 4 May 2018 17:15:46 +0000 (10:15 -0700)]
BTM_BleClearBgConnDev: Return if there is no BLE

Bug: 77495521
Bug: 76192234
Test: Start Bluetooth with a BT 3.0 chip (or a simulated one)
Change-Id: I718b7532bbba6100dd51c0677a44d41a2db0ce26
(cherry picked from commit 17fe6e4e06f38e5d997d81f8dfccfa744fe384a6)

6 years agoReturn early if vendor-specific command fails
Myles Watson [Thu, 3 May 2018 18:15:50 +0000 (11:15 -0700)]
Return early if vendor-specific command fails

Add CHECK() statements to crash if the callback is passed the incorrect
opcode or if there are no parameters.

Bug: 76192234
Bug: 77495521
Test: Start Bluetooth with a BT 3.0 chip (or a simulated one)
Change-Id: Iddd9a8503b2cfd52b16fb1c59f40e108b478e7b6
(cherry picked from commit aa10181425bc2fa3141d98f954abdb2b5aa641c9)

6 years agoMerge "A2DP: Add logging when A2DP fails to open" into pi-dev
TreeHugger Robot [Thu, 10 May 2018 22:38:39 +0000 (22:38 +0000)]
Merge "A2DP: Add logging when A2DP fails to open" into pi-dev

6 years agoMerge "HearingAid RemoveDevice - don't crash when profile not enabled" into pi-dev
TreeHugger Robot [Thu, 10 May 2018 22:10:49 +0000 (22:10 +0000)]
Merge "HearingAid RemoveDevice - don't crash when profile not enabled" into pi-dev

6 years agoHearing Aid: Add dumpsys log for audio packet
Hansong Zhang [Wed, 9 May 2018 21:39:56 +0000 (14:39 -0700)]
Hearing Aid: Add dumpsys log for audio packet

Add log for audio drops from audio HAL and buffer overflow
Add log for device capabilities and HiSyncId

Sample output:

Hearing Aid Manager:
  <device1> connected
    binaural right 0x...
    Packet counts (enqueued/flushed)                        : 73557 / 773
    Frame counts (enqueued/flushed)                         : 73557 / 773
  <device2> connected
    binaural left 0x...
    Packet counts (enqueued/flushed)                        : 74172 / 886
    Frame counts (enqueued/flushed)                         : 74172 / 886
  Hearing Aid Audio HAL:
    Counts (underflow)                                      : 0
    Bytes (underflow)                                       : 0
    Last update time ago in ms (underflow)                  : 0

Test: manual
Bug: 69623109
Change-Id: I5021b9214828b1846506638000f29af7343a3354
(cherry picked from commit b596bb17140c7fc82c73c7db62308aa057cf9aee)

6 years agoHearingAid RemoveDevice - don't crash when profile not enabled
Jakub Pawlowski [Thu, 10 May 2018 13:42:43 +0000 (06:42 -0700)]
HearingAid RemoveDevice - don't crash when profile not enabled

Bug: 79468820
Test: Unbond non-hearing aid device when profile not enabled
Change-Id: I2a87f8725447045e7bc5b2a33facf1ce14b47c54
(cherry picked from commit f7c7cd2120f9d407aab849fb553e57427bf3233e)

6 years agoUse weak pointers for device.cc callbacks to prevent use after delete
Ajay Panicker [Thu, 10 May 2018 19:39:32 +0000 (12:39 -0700)]
Use weak pointers for device.cc callbacks to prevent use after delete

Bug: 79400706
Test: Turn bluetooth off then on while connected to a device and playing
music

Change-Id: I2132bb01796a724fba6a36f4eca4f4795b919864

6 years agoMerge "Fix PTS: TC_GATT_SR_UNS_BI_01_C sends unsupported opcode" into pi-dev
TreeHugger Robot [Wed, 9 May 2018 23:29:36 +0000 (23:29 +0000)]
Merge "Fix PTS: TC_GATT_SR_UNS_BI_01_C sends unsupported opcode" into pi-dev

6 years agoA2DP: Add logging when A2DP fails to open
Jack He [Wed, 9 May 2018 22:44:09 +0000 (15:44 -0700)]
A2DP: Add logging when A2DP fails to open

* Make sure we output a log line whenever A2DP start request returns a
  failure state, namingly:
  - A2DP_CTRL_ACK_FAILURE
  - A2DP_CTRL_ACK_INCALL_FAILURE
  - A2DP_CTRL_ACK_DISCONNECT_IN_PROGRESS

Bug: 74988740
Test: make, logging only change
Change-Id: I63280d6280bf9c3d3ee6c578c1be332f8a9a3be0
(cherry picked from commit b67d5fc97c0a0db33173792b6781a0345ee75cf2)

6 years agoAdd bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ
Ajay Panicker [Fri, 13 Apr 2018 00:03:09 +0000 (17:03 -0700)]
Add bounds check to l2cble_process_sig_cmd L2CAP_CMD_DISC_REQ

Bug: 74121659
Test: Compiles
Change-Id: Idf58e7b25b41ae1bd43cdd51de424b18e03cc7e8

6 years agoFix PTS: TC_GATT_SR_UNS_BI_01_C sends unsupported opcode
Stanley Tng [Wed, 9 May 2018 17:39:37 +0000 (10:39 -0700)]
Fix PTS: TC_GATT_SR_UNS_BI_01_C sends unsupported opcode

In this PTS test, add code to send back an unsupported error response
when an unsupported OpCode is received.

Bug: 79347869
Test: Rerun and pass PTS test
Change-Id: Ibf95dbc18dabbe201850da675c7a1b2739624de9
(cherry picked from commit 12fbcb60c60540a7fb968466ccb90e9cdf08861f)

6 years agoFetch the presentation position only if the audio state is STARTED
Pavlin Radoslavov [Wed, 9 May 2018 01:00:24 +0000 (18:00 -0700)]
Fetch the presentation position only if the audio state is STARTED

The audio HAL will fetch the audio presentation position (for the
purpose of delay reporting if the Headset supports it) only if the
audio state is STARTED.
Otherwise, it will use the default value (e.g., the one used
when the Headset does not support delay reporting).

This avoids unnecessary transient re-opening of the HAL control path
between the Audio framework and Bluetooth native stack (e.g., during
shutdown).

Bug: 78360113
Test: Manual - A2DP streaming with Headsets that support delay reporting
Change-Id: I56f7e9373ba27606913c74fa818da40305df85d4
Merged-In: I56f7e9373ba27606913c74fa818da40305df85d4
(cherry picked from commit 61d1e86c5b4beb3bf4dabba3de0490cad637afb3)

6 years agoMerge "Handle unbonding in Hearing Aid profile" into pi-dev
android-build-team Robot [Tue, 8 May 2018 21:56:29 +0000 (21:56 +0000)]
Merge "Handle unbonding in Hearing Aid profile" into pi-dev

6 years agoHandle unbonding in Hearing Aid profile
Jakub Pawlowski [Tue, 8 May 2018 14:44:43 +0000 (07:44 -0700)]
Handle unbonding in Hearing Aid profile

Bug: 69623109
Change-Id: I3b1f778e414511a3748cebd2b0e233d638cd4d43
Fixes: 79207134
Test: unbond from Hearing Aid when connected or disconnected from it
(cherry picked from commit 30599617d20674634c75ad16de6ef74ae9b7cfa0)

6 years agoMerge "Send correct key state and ignore keys from inactive device (1/2)" into pi-dev
android-build-team Robot [Tue, 8 May 2018 18:57:29 +0000 (18:57 +0000)]
Merge "Send correct key state and ignore keys from inactive device (1/2)" into pi-dev

6 years agoMerge "Fixed PTS: TC_GATT_SR_GAR_BI_01_C failure" into pi-dev
android-build-team Robot [Tue, 8 May 2018 18:53:41 +0000 (18:53 +0000)]
Merge "Fixed PTS: TC_GATT_SR_GAR_BI_01_C failure" into pi-dev

6 years agoFixed PTS: TC_GATT_SR_GAR_BI_01_C failure
Stanley Tng [Mon, 7 May 2018 21:58:36 +0000 (14:58 -0700)]
Fixed PTS: TC_GATT_SR_GAR_BI_01_C failure

When the GATT Read Request has bad handle parameters, returns the
GATT_INVALID_HANDLE error code instead of GATT_INVALID_PDU.

Bug: 79340029
Test: Rerun PTS
Change-Id: I9de576076d7f7aece0831ef57b01c07a24209010
(cherry picked from commit be70112570a0a2d3b02818ee81ab0e6bdb8583b4)

6 years agoSend correct key state and ignore keys from inactive device (1/2)
Ajay Panicker [Fri, 4 May 2018 21:30:45 +0000 (14:30 -0700)]
Send correct key state and ignore keys from inactive device (1/2)

Also make it clearer whether the key state is pushed or released.

Bug: 79178216
Test: Run host native test net_test_avrcp
Change-Id: I8595ac97718bcb2af8f33643df4b9c8059a1b30b
(cherry picked from commit c4546f592b943463337a260ccbbe92546832200d)

6 years agoHFP: Remove parameter to start/stopScoUsingVirtualVoiceCall
Jack He [Thu, 3 May 2018 23:37:09 +0000 (16:37 -0700)]
HFP: Remove parameter to start/stopScoUsingVirtualVoiceCall

* Since HFP SCO routing is managed by setActiveDevice, there is no need
  for an input parameter to start/stopScoUsingVirtualVoiceCall

Bug: 76114959
Test: build
Change-Id: I2a3f9f7cb1191e2831d30630b2e0c3bee4a0acdb

6 years agoMerge "Fix memory leak for BTRC_ITEM_MEDIA." into pi-dev
android-build-team Robot [Fri, 4 May 2018 23:00:59 +0000 (23:00 +0000)]
Merge "Fix memory leak for BTRC_ITEM_MEDIA." into pi-dev

6 years agoIncrease the A2DP version from 1.2 to 1.3
Pavlin Radoslavov [Wed, 2 May 2018 22:09:42 +0000 (15:09 -0700)]
Increase the A2DP version from 1.2 to 1.3

Some headsets do not support properly the AVDTP 1.3 Delay Reporting
if the A2DP version is 1.2 .

Bug: 78409461
Test: Manual with Headsets that support AVDTP 1.3 Delay Reporting
      TestTracker/161070
Change-Id: Ia1e3afb3b5159101bc65b036ca5bd9f55ed4c431
Merged-In: Ia1e3afb3b5159101bc65b036ca5bd9f55ed4c431
(cherry picked from commit c35f912d2936db5e1bb77cc44f62f8361af049e3)

6 years ago[automerger skipped] Merge "DO NOT MERGE Prevent stack overflow in btif_storage"...
android-build-team Robot [Fri, 4 May 2018 01:59:08 +0000 (18:59 -0700)]
[automerger skipped] Merge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev am: 40f5f56d1c am: 6f06fa36e8
am: 0f6afc97b1  -s ours

Change-Id: I4356da74ab30f9818d895897457699b4f98fb709

6 years agoMerge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev am: 40f5f56d1c
android-build-team Robot [Fri, 4 May 2018 01:54:41 +0000 (18:54 -0700)]
Merge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev am: 40f5f56d1c
am: 6f06fa36e8

Change-Id: Ibaa5c02e34c2337458d27b76c6b60f8da47feab5

6 years agoMerge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev
android-build-team Robot [Fri, 4 May 2018 01:51:10 +0000 (18:51 -0700)]
Merge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev
am: 40f5f56d1c

Change-Id: Ia414bb14da02c1b01c8fc1cb3473657d6b6cdf1d

6 years agoMerge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev
android-build-team Robot [Fri, 4 May 2018 01:41:26 +0000 (01:41 +0000)]
Merge "DO NOT MERGE Prevent stack overflow in btif_storage" into oc-dev

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc...
android-build-team Robot [Thu, 3 May 2018 23:58:38 +0000 (16:58 -0700)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev am: 476e987261 am: 2df27358c4
am: 87e1fa9664

Change-Id: Id3d8870cdaa87e7be24966db112c9de93ab23680

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc...
android-build-team Robot [Thu, 3 May 2018 23:47:13 +0000 (16:47 -0700)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev am: 476e987261
am: 2df27358c4

Change-Id: I71a8c9ffb75a3d647294f4da01417ca78f601c4f

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev
android-build-team Robot [Thu, 3 May 2018 23:38:39 +0000 (16:38 -0700)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev
am: 476e987261

Change-Id: If96757870922276971579503ccce57b2b1af2a00

6 years ago[automerger skipped] [automerger] DO NOT MERGE Prevent stack overflow in btif_storage...
Hansong Zhang [Thu, 3 May 2018 23:29:56 +0000 (16:29 -0700)]
[automerger skipped] [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 560a6244ea am: 525aee59af am: 6a0ef37a82 skipped: 4dfb42893f am: 2503636b1e am: 27d3295db2 am: c3deead2f0 am: bbba8d8db4 skipped: e294ca0aa6 am: d095472fce am: c20649a364
am: b38abda13b  -s ours

Change-Id: Ib00527be4b4b86bff4d8c16e63b09afa7ec684dd

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc...
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc-mr2-dev

* changes:
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee am: 0d93124725
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958
  DO NOT MERGE Prevent stack overflow in btif_storage

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into cw...
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into cw-f-dev

* changes:
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958
  DO NOT MERGE Prevent stack overflow in btif_storage

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc...
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc-mr1-dev

* changes:
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958
  DO NOT MERGE Prevent stack overflow in btif_storage

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc...
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into nyc-dr1-dev

* changes:
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958
  DO NOT MERGE Prevent stack overflow in btif_storage

6 years agoMerge "DO NOT MERGE Prevent stack overflow in btif_storage" into nyc-dev
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge "DO NOT MERGE Prevent stack overflow in btif_storage" into nyc-dev

6 years agoMerge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev
android-build-team Robot [Thu, 3 May 2018 23:15:36 +0000 (23:15 +0000)]
Merge changes from topic "am-75dfedd1-e9af-4127-a4f2-dca9a919845a-nyc-dev" into oc-dev

* changes:
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee am: 0d93124725 skipped: 674ed907aa
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee am: 0d93124725
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156 am: f951aec9ee
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958 am: b26970f156
  [automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 1d200be958
  DO NOT MERGE Prevent stack overflow in btif_storage

6 years ago[automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 560a6244ea am...
Hansong Zhang [Thu, 3 May 2018 23:11:51 +0000 (16:11 -0700)]
[automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 560a6244ea am: 525aee59af am: 6a0ef37a82 skipped: 4dfb42893f am: 2503636b1e am: 27d3295db2 am: c3deead2f0 am: bbba8d8db4 skipped: e294ca0aa6 am: d095472fce
am: c20649a364

Change-Id: I34c4d01270e3094db26f42463d85cfcaa95b0de9

6 years ago[automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 560a6244ea am...
Hansong Zhang [Thu, 3 May 2018 22:59:22 +0000 (15:59 -0700)]
[automerger] DO NOT MERGE Prevent stack overflow in btif_storage am: 560a6244ea am: 525aee59af am: 6a0ef37a82 skipped: 4dfb42893f am: 2503636b1e am: 27d3295db2 am: c3deead2f0 am: bbba8d8db4 skipped: e294ca0aa6
am: d095472fce

Change-Id: I51cd293067070f82114459a98349cc34a25f6787

6 years agoMerge "Add AVRCP native logging to dumpsys" into pi-dev
android-build-team Robot [Thu, 3 May 2018 22:24:24 +0000 (22:24 +0000)]
Merge "Add AVRCP native logging to dumpsys" into pi-dev

6 years agoAdd AVRCP native logging to dumpsys
Ajay Panicker [Wed, 2 May 2018 23:23:13 +0000 (16:23 -0700)]
Add AVRCP native logging to dumpsys

Example output
AVRCP Target Native Service: 2 devices
  d4:90:9c:0a:48:d0
    Current Volume: 42
    Current Browsed Player ID: -1
    Registered Notifications:
      Play Status
    Last Play State: 2
    Last Song Sent ID: ""
    Current Folder: ""
    MTU Sizes: CTRL=1020 BROWSE=332

Bug: 79167906
Test: adb shell dumpsys bluetooth_manager
Change-Id: I749dc3c568ac7793ac924ab1e46c3fc7ae42a260
(cherry picked from commit 774eb4c2554f766a77fcdcd0c37737b50fbe0452)

6 years agoIgnore volume changed events from the non-active device
Ajay Panicker [Wed, 2 May 2018 17:05:24 +0000 (10:05 -0700)]
Ignore volume changed events from the non-active device

Bug: 78251684
Test: Run host native test net_test_avrcp
Change-Id: I164e9ded88c804da2ce8191c5f58cc053cfa6ecd
(cherry picked from commit 071caca5c78c0c7b3ad69e96b7ede98e6143c96b)

6 years agoFix memory leak for BTRC_ITEM_MEDIA.
Joseph Pirozzo [Mon, 30 Apr 2018 19:23:18 +0000 (12:23 -0700)]
Fix memory leak for BTRC_ITEM_MEDIA.

Memory is allocated for each media item received from a remote phone for
AVRCP media browsing.  Although the media item itself was freed, the
memory for each attribute was not freed.  Move the allocation up to
the parent function such that it can be allocated and freed in the same
location.

Bug: 78222934
Test: dumpsys meminfo com.android.bluetooth
Change-Id: I217830441949642cd6ef0f96ac5fde9251452095
(cherry picked from commit 21fe4bd30448edf967fe0da67e67c454276f7e59)

6 years agoHearing Aid: leave some radio time for other devices
Jakub Pawlowski [Thu, 15 Mar 2018 18:37:06 +0000 (11:37 -0700)]
Hearing Aid: leave some radio time for other devices

We should send maximum two packets in connection event, and they
should take less than 3.75ms with acknowledgements.
Leaving some radio time should make us able to keep third LE connection
to some less demanding devices.

Bug: 78364114
Bug: 69623109
Test: stream music through Hearing Aid and connect to some LE device
Change-Id: Ie97b9db456a957c11438208448c562435b1b0222
(cherry picked from 1e43d40b9201a7aae915d5f53059541a1cfb9b05)

6 years agoMerge "Implement GetTotalNumberOfItems response for AVRCP Browsing" into pi-dev
android-build-team Robot [Tue, 1 May 2018 22:21:46 +0000 (22:21 +0000)]
Merge "Implement GetTotalNumberOfItems response for AVRCP Browsing" into pi-dev

6 years agoImplement GetTotalNumberOfItems response for AVRCP Browsing
Ajay Panicker [Fri, 27 Apr 2018 13:59:22 +0000 (06:59 -0700)]
Implement GetTotalNumberOfItems response for AVRCP Browsing

Bug: 78636552
Test: run host test net_test_avrcp
Change-Id: Ie05d23874317978eb619d0e56a89f2c880166a52
(cherry picked from commit 16aa6a075e5cbb7c97bbc639b876221038212b62)

6 years agoAdd a missing call to btif_av_stream_stop() for SetActivePeer(null)
Pavlin Radoslavov [Tue, 1 May 2018 00:57:34 +0000 (17:57 -0700)]
Add a missing call to btif_av_stream_stop() for SetActivePeer(null)

Without this call, the BtifAv state machine could be left in Started
state, while the A2DP media task timer is canceled.
This internal state inconsistency prevents the proper handling
of Audio HAL commands like SUSPEND - no ACK is returned and
the Audio HAL is blocked.

Bug: b/78901123
Test: Manual - play music to Headset, select "play media to" > This device
      resume music, select "play media to" > Bluetooth Headet

Change-Id: I11b280bea76de02f522e61ebb0a9d7eb5b50f993
Merged-In: I11b280bea76de02f522e61ebb0a9d7eb5b50f993
(cherry picked from commit 361e2a46fb5c6cc1cc7b94a1d6aa780d8bc1f582)

6 years agoFix A2DP Suspend related multi-component deadlock
Pavlin Radoslavov [Mon, 30 Apr 2018 20:39:20 +0000 (13:39 -0700)]
Fix A2DP Suspend related multi-component deadlock

Apparently, the processing of A2DP Suspend from the Audio HAL
could result in a deadlock across multiple components:
  A2dpService -> AudioService  -> Audio-BT HAL -> BT Native Stack ->
  BT JNI upcall -> A2dpService

1) A2dpService -> AudioService:
   - Waiting inside setActiveDevice() -> synchronized (mStateMachines) ->
   mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent()
   - The mAudioManager call can be blocking: a followup call would wait
     for the previous call to complete.
2) AudioService -> Audio-BT HAL
   The AudioService is wating on the Audio-BT HAL to complete its request.
   In this case the request is SUSPEND
3) Audio-BT HAL -> BT Native Stack
   The Audio side of the Audio-BT HAL is waiting for the BT Native stack
   to ACK the SUSPEND command.
   More specifically, it is retrying few times with timeout of 250ms
   each iteration.

4) BT Native Stack -> BT JNI upcall
   - In the BT Native Stack the BtifAv FSM (see file btif/src/btif_av.cc)
     is in state StateStarted and has received the
     BTIF_AV_SUSPEND_STREAM_REQ_EVT because of the SUSPEND command from the
     Audio HAL.
   - As a result, the LocalSuspendPending flag has been set:
     peer_.SetFlags(BtifAvPeer::kFlagLocalSuspendPending);
   - Only after the above flag is reset, then the BT Native Stack will
     ACK the SUSPEND command from the HAL
   - The above flag will be reset when event BTA_AV_SUSPEND_EVT is received
     from the underlying stack
   - The BtifAv state machine has received the BTA_AV_SUSPEND_EVT event.
     However, prior to clearing the pending status, the FSM tries to
     report the audio state via JNI to the Java layer:
       btif_report_audio_state();
       ...
       peer_.ClearFlags(BtifAvPeer::kFlagLocalSuspendPending);
  - Apparently, all the processing inside the BtifAv FSM is done on
    the JNI thread, including the btif_report_audio_state() upcall.
5) BT JNI upcall -> A2dpService
  - The btif_report_audio_state() upcall calls indirectly
    A2dpNativeInterface.onAudioStateChanged() -> sendMessageToService() ->
    A2dpService.messageFromNative()
  - Within the A2dpService.messageFromNative() processing, there is
    "synchronized (mStateMachines) {}" block, and the processing there
    blocks because per (1) above A2dpService.setActiveDevice() is
    already inside its own "synchronized (mStateMachines) {}" block

The above deadlock is fixed by the following:
 - Modified the BTA_AV_SUSPEND_EVT processing such that
   the clearing of the kFlagLocalSuspendPending flag is done BEFORE
   the btif_report_audio_state()
 - Modified the BtifAv FSM such that the internal processing of the FSM
   events is done on the BTA thread instead of the JNI thread. Thus,
   the FSM processing cannot be blocked by JNI upcalls.

Also:
 - Updated the do_in_bta_thread() function to have a return value
   so it is more aligned with the corresponding do_in_jni_thread()
   implementation
 - Updated the reordering of some other btif_report_*() upcalls inside
   btif_av.cc so they are after the FSM internal processing in the
   current state.
 - Added few extra logs to the Audio-BT HAL (file audio_a2dp_hw.cc).

Bug: 72823323
Test: Disconnect/reconnect with Philips SBH7000 Headset
Change-Id: I7ccb558e458a8e90d0414f94463bda8d4b3fdc97
Merged-In: I7ccb558e458a8e90d0414f94463bda8d4b3fdc97
(cherry picked from commit 2a3b9b597ee07f8728bd9903b0bc104c4e24fd6c)

6 years agoMerge "Use the wrapped volume interface with the AVRCP conneciton handler" into pi-dev
Ajay Panicker [Mon, 30 Apr 2018 16:01:27 +0000 (16:01 +0000)]
Merge "Use the wrapped volume interface with the AVRCP conneciton handler" into pi-dev

6 years agoEnable HCI Sniff mode and disable subrating for A2DP
Guang Xie [Thu, 15 Feb 2018 20:42:15 +0000 (12:42 -0800)]
Enable HCI Sniff mode and disable subrating for A2DP

Enabling the HCI Sniff mode could help headsets to save power.

Note that subrating is disabled implicitly by NOT sending the
"Sent Sniff Subrating" HCI command to the BT controller,
and effectively using the default Sniff Subrating parameters.
The Headset shouldn't go into Subrating Mode to prevent
potential stuttering if the Headset chooses to use subrating
with the wrong parameters.

NOTE: This should affect only Pixel Buds.

Also:
 - Added some extra log messages
 - Minor cleanup (argument/variable renaming)

Bug: 74344711
Bug: 74361002
Test: Manual - audio streaming; examine btsnoop logs
Change-Id: Iec5086dba6f9003c21bcb41eddb3bc83ac7dddd1
Merged-In: Iec5086dba6f9003c21bcb41eddb3bc83ac7dddd1
(cherry picked from commit 1b548bb34a0bfc300b8aa03c271148141673922f)

6 years agoUse the wrapped volume interface with the AVRCP conneciton handler
Ajay Panicker [Fri, 27 Apr 2018 13:50:42 +0000 (06:50 -0700)]
Use the wrapped volume interface with the AVRCP conneciton handler

Use the wrapped volume interface in connection handler so that JNI calls
are automatically executed on the correct thread when called from the
connection handler.

Bug: 30602783
Test: Connect a device that doesn't support absolute volume and see that
the JNI call doesn't throw an exception.

Change-Id: Ife768c715022e70dd4055270c1d6cf76ba26aea3
(cherry picked from commit f4bfa13c912175f81f54ae0249bddf6e2b2b879d)

6 years agoDO NOT MERGE Prevent stack overflow in btif_storage
Hansong Zhang [Thu, 26 Apr 2018 22:50:53 +0000 (15:50 -0700)]
DO NOT MERGE Prevent stack overflow in btif_storage

Bug: 73963551
Test: manual
Change-Id: I5f7a583aad150ebf9e3d492181d80ca935c8aa3f