OSDN Git Service
Jakub Pawlowski [Thu, 25 May 2017 22:30:29 +0000 (22:30 +0000)]
Fix GATT Server disconnecting for no reason
am:
16bb48b320
Change-Id: I6c511d6825620e87503fce76f7c70114f8fd87fc
Jakub Pawlowski [Thu, 25 May 2017 22:30:26 +0000 (22:30 +0000)]
Revert "Fix GATT Server disconnecting for no reason"
am:
63e8f19255
Change-Id: I6e717171f346ce5d7331f8ea13821e6b54bdb5d6
Jakub Pawlowski [Thu, 25 May 2017 21:18:09 +0000 (21:18 +0000)]
Fix crashes when GAP operation is interrupted by disconnection
am:
feec106412
Change-Id: I3e714e751e0110cbff1ad6459e5e51b1cd324e56
Jakub Pawlowski [Thu, 25 May 2017 16:09:12 +0000 (09:09 -0700)]
Fix GATT Server disconnecting for no reason
Connections created by GAP profile should be ephemeral, and not
interfere with the connection timeout.
When a device is bonded, listing services through DM would cause a
DM APP to create a connection, and later to disconnect. This causes
connection to timeout. In case a device was already connected, this
should not happen.
Bug:
34951749
Test: manual
Change-Id: Iad04fd9eed4c664f35131442e3f83a704497a067
Jakub Pawlowski [Thu, 25 May 2017 20:24:28 +0000 (13:24 -0700)]
Revert "Fix GATT Server disconnecting for no reason"
This reverts commit
b69edd55ffe953d4f71f4a948e3feb2243223980.
Jakub Pawlowski [Thu, 25 May 2017 15:21:53 +0000 (08:21 -0700)]
Fix crashes when GAP operation is interrupted by disconnection
Also fixes potential issue while allocating control blocks.
Test: none
Bug:
38499153
Change-Id: I5101ac97476953cdfece45c3fa9b909e38b9d2dd
Jakub Pawlowski [Thu, 25 May 2017 14:21:53 +0000 (14:21 +0000)]
Fix GATT Server disconnecting for no reason
am:
b69edd55ff
Change-Id: I02d9ded4520eabb317b85a5a10888e9432c991cf
Jakub Pawlowski [Wed, 24 May 2017 23:15:21 +0000 (16:15 -0700)]
Fix GATT Server disconnecting for no reason
When two devices are bonded, even if the device is supposed to act just
as a GATT Server, service discovery is performed. Doing "read by type"
should not trigger connection timeout, or disconnection, as the server
should wait for the client to finish connection.
Please note that it does not GATT Client behaviour, as they manage the
connection timeout through L2CA_SendFixedChnlData called on each data
packet.
Bug:
34951749
Test: manual
Change-Id: If53cf63dc204238a60839497992c870b1b39aa60
Jack He [Wed, 24 May 2017 20:42:46 +0000 (20:42 +0000)]
MCAP: Add test interface for PTS test (2/2)
am:
722ce12bab
Change-Id: Idf202cccd67609408beb0f7ca7b98b75b914abf8
Jack He [Sat, 13 May 2017 20:52:12 +0000 (13:52 -0700)]
MCAP: Add test interface for PTS test (2/2)
* PTS tests requires MCAP APIs to be called at protocol level
* This CL creates a test interface to enable the above functionality
Bug:
37867299
Test: make, no user visible effect
Change-Id: I15cc6cc613ce8f7c57564296e45077ab877c269b
Jack He [Tue, 23 May 2017 22:50:39 +0000 (22:50 +0000)]
MCAP: Fix bugs in MCAP stack
am:
b3a8dc2ece
Change-Id: I325234385a1b27cfdef45a785b09880b56570f93
Jack He [Thu, 18 May 2017 05:22:18 +0000 (22:22 -0700)]
MCAP: Fix bugs in MCAP stack
* Fix error response message for clock sync opcodes
* Fix error response message for CREATE_MDL opcode
* Fix logging in the MCAP stack
Bug:
37867299
Test: make, PTS MCAP test
Change-Id: I7a37ac04806bca20d732357f00b4761577b4be19
Ajay Panicker [Mon, 22 May 2017 22:03:56 +0000 (22:03 +0000)]
Merge "Remove logspam when initializing logging for Bluetooth"
am:
0e3621da9f
Change-Id: I37043759504c279eb9063df8dddfa35762843462
Ajay Panicker [Mon, 22 May 2017 21:57:58 +0000 (21:57 +0000)]
Remove logspam when adding GATT attributes
am:
60177e01c4
Change-Id: I1f740dbf89ae5a2888a053d31d37d292748872e7
Treehugger Robot [Mon, 22 May 2017 21:55:19 +0000 (21:55 +0000)]
Merge "Remove logspam when initializing logging for Bluetooth"
Ajay Panicker [Wed, 17 May 2017 01:46:22 +0000 (18:46 -0700)]
Remove logspam when adding GATT attributes
Bug:
37905488
Test: Code still compiles
Change-Id: I479fc82a15f977b7e3d50b07302241909efc8856
Ajay Panicker [Wed, 17 May 2017 05:43:51 +0000 (22:43 -0700)]
Remove logspam when initializing logging for Bluetooth
Bug:
37803501
Test: Code still compiles
Change-Id: I9326e58aff0d80e441cb92c41e0e4a7d70e32b1b
Pavlin Radoslavov [Thu, 18 May 2017 01:23:24 +0000 (01:23 +0000)]
Merge "Protect the message loop from accesses after HCI shutdown"
am:
e5a161ef01
Change-Id: I00d1ae80216d84119234b79d3110bc0f9560b6bf
Treehugger Robot [Thu, 18 May 2017 01:12:49 +0000 (01:12 +0000)]
Merge "Protect the message loop from accesses after HCI shutdown"
Jakub Pawlowski [Thu, 18 May 2017 00:16:49 +0000 (00:16 +0000)]
Protect concurrent access to local state used during BLE scanning
am:
eb43e9cf12
Change-Id: Ic5b8a1677799e18402921b874a0f58c2e0aa1541
Pavlin Radoslavov [Wed, 17 May 2017 01:50:43 +0000 (18:50 -0700)]
Protect the message loop from accesses after HCI shutdown
Bug:
38330724
Test: Manual: enable/disable Bluetooth
Change-Id: Iaece4cd608c67b28b436ded9fcc51c0bf28f4098
Jakub Pawlowski [Wed, 17 May 2017 22:23:22 +0000 (15:23 -0700)]
Protect concurrent access to local state used during BLE scanning
Make sure that all access happens on jni thread
Bug:
38298938
Test: Code compilation
Change-Id: I38246626d2c6390586b314b27889dd9ba905f406
Marie Janssen [Wed, 17 May 2017 20:54:03 +0000 (20:54 +0000)]
Blacklist Kinivo BTC350 for Absolute Volume
am:
e1fca1bacd
Change-Id: Ie0771c6e1607130851d9cbf4f69ddfad1e07013b
Marie Janssen [Wed, 17 May 2017 01:40:45 +0000 (18:40 -0700)]
Blacklist Kinivo BTC350 for Absolute Volume
The volume is erratic on the speakers when the speaker is reporting
linear increase, with decreases for higher volumes.
Test: check that absolute volume not used for Kinivo Speakers
Bug:
37872586
Change-Id: Ic5f409e8631bece66a75372b916faa9c104e2024
Pavlin Radoslavov [Wed, 17 May 2017 01:45:33 +0000 (01:45 +0000)]
Disable MONO channel mode for LDAC
am:
f7e48dff99
Change-Id: I320fe419ed51b9b85944a485e022932fa36ff4de
Pavlin Radoslavov [Tue, 16 May 2017 23:20:23 +0000 (16:20 -0700)]
Disable MONO channel mode for LDAC
Bug:
38351937
Test: A2DP streaming to LDAC headset and switching MONO/STEREO in Settings
Change-Id: I20c5069fd5d104b9ebe767ae2728af7d7b2ae1d9
Jakub Pawlowski [Tue, 16 May 2017 20:29:24 +0000 (20:29 +0000)]
Discover primary service by UUID for PTS tests (1/4)
am:
45aebe75f7
Change-Id: Id2f05d32e1dfb8632c50707cb19af1a80a91f8da
Jakub Pawlowski [Tue, 16 May 2017 17:47:54 +0000 (10:47 -0700)]
Discover primary service by UUID for PTS tests (1/4)
Bug:
38123054
Test: manual
Change-Id: Ic97a964ca2a25a84c6abcf41acb0f3fb583488a2
Jakub Pawlowski [Mon, 15 May 2017 18:34:01 +0000 (18:34 +0000)]
Fix crash on GATT service unregistration
am:
0d89212035
Change-Id: I85f1bc7e5823c359f9f1d96b4fdf6ff12f35c127
Jakub Pawlowski [Mon, 15 May 2017 07:58:07 +0000 (00:58 -0700)]
Fix crash on GATT service unregistration
When SDP_MAX_RECORDS were reached in SDP db, which usually happen by
registering big number of GATT services, unregistration of a service was
causing a crash. This was because we moved from memory after the array
into last element.
Bug:
38265174
Test: manual
Change-Id: I7b0235213fb07c85dcc1245f1c840b41267521d5
Emil Lenngren [Fri, 12 May 2017 22:39:20 +0000 (22:39 +0000)]
Fix BLE white list issues
am:
8451ad010e
Change-Id: Ic3a2f4f77f7d74f4021a68df3f996b5c9e0920c9
Emil Lenngren [Mon, 19 Dec 2016 19:21:19 +0000 (19:21 +0000)]
Fix BLE white list issues
Since Bluetooth 4.2 and errata ESR08 there may not be more than one
connection between two LE device addresses. Also the stack assumes
there is at maximum one connection to the same address. This patch
makes sure there are no connected devices in the white list when a
connection attempt is started. Since some (even 4.2) controllers don't
handle this correctly, currently this method is used regardless of
controller in this patch.
When the maximum L2CAP connections were reached and a new connection
was established to a device using auto connect, the stack hung and
would no longer create new connections until Bluetooth was restarted,
since the state change to BLE_CONN_IDLE was forgotten. This patch
resets the state correctly, and also never initiates a connection
unless there is space to avoid connect-disconnect loop.
There were also bugs in the background_connections hash map; memory was
not freed when an element was erased and an incorrect hash function
which used the pointer to a bd addr instead of the bd addr itself which
basically meant that elements were never removed. This patch removes
the dynamic memory allocation and uses a correct hash function.
There was a bug that might lead to that the white list was filled
beyond its maximum, due to the counter was updated on the HCI command
complete event, which might run too late. Now the space is instead
calculated based on what commands have been sent to the controller.
The address type of the address added to the white list must also be
tracked, otherwise it might be updated due to a BLE scan, and later the
wrong address is removed from the white list. This patch fixes this.
(Preferably 49-bit bd addrs should be used as identifier through the
whole stack but we're not there yet.)
There was a queue of size 10 with pending white list operations. That
queue got full if there was initially 10 devices in the white list,
then the 10 devices were removed and immediately after 10 other devices
were added. This patch removes the queue altogether by instead syncing
against the background_connections hash map.
Bug: https://code.google.com/p/android/issues/detail?id=219910
Test: stress-testing with a bunch of BLE devices and inspecting HCI log
Change-Id: I78de654ffbea5f4962a189caf984f7f2934e8fbe
Pavlin Radoslavov [Fri, 12 May 2017 18:46:06 +0000 (18:46 +0000)]
Don't ignore the A2DP Sink preferred SBC codec config
am:
d62e522131
Change-Id: I0b85499fa56336a735101eab886f52ea0fd8692a
Pavlin Radoslavov [Fri, 12 May 2017 18:46:02 +0000 (18:46 +0000)]
Set the RTP Header Marker bit selectively per A2DP codec
am:
3b8391cd47
Change-Id: I6678114e4e9c423b198aa15ee5da12cd973d46d7
Pavlin Radoslavov [Fri, 12 May 2017 10:02:08 +0000 (03:02 -0700)]
Don't ignore the A2DP Sink preferred SBC codec config
If the A2DP Sink device sends "Set Configuration" with its preferred
SBC configuration, try using that configuration when selecting
the codec parameters instead of the A2DP Sink SBC capability.
Test: A2DP streaming, PTS AVDTP Tests: TC_ACP_SRC_SIG_SMG_BV_18_C,
TC_ACP_SRC_SIG_SMG_BV_20_C, TC_ACP_SRC_SIG_SMG_BV_22_C
PTS A2DP Tests: A2DP/SRC/SET/BV-04-I, A2DP/SRC/SET/BV-06-I
Bug:
37723311
Bug:
35664023
Change-Id: I48e2aa664b899c1cda5df4d1f86f9cfa3a9a67f6
Pavlin Radoslavov [Fri, 12 May 2017 08:16:10 +0000 (01:16 -0700)]
Set the RTP Header Marker bit selectively per A2DP codec
Add a mechanism to set the RTP Header Marker bit per codec.
Currently, the Marker bit is set only for AAC.
Test: A2DP streaming, PTS AVDTP tests: TC_ACP_SRC_TRA_BTR_BV_01_C,
TC_INT_SRC_SIG_SMG_BV_17_C, TC_INT_SRC_TRA_BTR_BV_01_C
Bug:
37723283
Change-Id: I9b8e77d44c750746c169df9628d5539ad2406b92
Jakub Pawlowski [Fri, 12 May 2017 08:26:20 +0000 (08:26 +0000)]
Improve GATT Server database handling.
am:
6395f1547e
Change-Id: I1519dd0981b430a9a76a91126ad403616a856cea
Jakub Pawlowski [Tue, 9 May 2017 12:02:38 +0000 (05:02 -0700)]
Improve GATT Server database handling.
- use references instead of pointers where possible. Thanks to it we can
remove some reduntant null checks and simplify the code.
- use directly allocated memory instead of own buffers. Thanks to it the
stack uses around 12kb less of memory after startup.
- use list and vector from std library, instead of some hand-written
implementations.
This patch is a prerequisite for further server refactoring, that will
further reduce the space used, make unit-testing possible, and enable
proper handling of PTS GATT tests.
Test: sl4a GattReadTest
Bug:
38225928
Change-Id: I1620be682259ccb8f0c02754806e355e3f1ad0c1
Joseph Pirozzo [Thu, 11 May 2017 23:11:31 +0000 (23:11 +0000)]
Disable output_sample.pcm
am:
daf55dfda0
Change-Id: Ifdc79bb2e4c3530c50f985a8cc1a949e25266b11
Joseph Pirozzo [Thu, 11 May 2017 16:36:47 +0000 (09:36 -0700)]
Disable output_sample.pcm
Update include files to include bt_target.h as it has the necessary
defines to correctly allow bdroid_buildcfg.h to enable and disable
dumping to output_sample.pcm.
Bug:
38180732
Test: Stream Bluetooth audio to device and observe that
output_sample.pcm does not get written or appended to.
Change-Id: Ia7926f93a47489686d315e3c9abd1618cb8adda3
Pavlin Radoslavov [Thu, 11 May 2017 02:19:00 +0000 (02:19 +0000)]
Merge "Removed A2DP_GetTrackBitsPerSample() API because it is not needed"
am:
d93b54eada
Change-Id: I2c6324ab93de6bfd2f1cf2dc7cef52c6be955863
Treehugger Robot [Thu, 11 May 2017 02:10:07 +0000 (02:10 +0000)]
Merge "Removed A2DP_GetTrackBitsPerSample() API because it is not needed"
Jack He [Thu, 11 May 2017 01:59:52 +0000 (01:59 +0000)]
Merge changes from topic 'eSCO'
am:
a5095e6eac
Change-Id: I6ec9013bc90d038078e33e271e77125a45689f1d
Jack He [Thu, 11 May 2017 01:59:40 +0000 (01:59 +0000)]
eSCO: Additional fix to get eSCO working for HFP and HSP (3/5)
am:
400ac497f4
Change-Id: I2590f334f411a43ebbd5198ab964d776f096e249
Myles Watson [Thu, 11 May 2017 01:59:29 +0000 (01:59 +0000)]
eSCO: Remove BTM_WBS_INCLUDED from the stack (2/5)
am:
3e634d6c1e
Change-Id: I99fff15789f389fe71f140db81bceac3bac42b71
Mudumba Ananth [Thu, 11 May 2017 01:59:16 +0000 (01:59 +0000)]
eSCO: BT 4.1 Enhanced SCO command (1/5)
am:
57f6508cf7
Change-Id: Ic45dc0c4bae5c40f3d144246efe1d3e2603e8b4b
Treehugger Robot [Thu, 11 May 2017 01:53:44 +0000 (01:53 +0000)]
Merge changes from topic 'eSCO'
* changes:
eSCO: Format changes to original vendor patch (4/5)
eSCO: Additional fix to get eSCO working for HFP and HSP (3/5)
eSCO: Remove BTM_WBS_INCLUDED from the stack (2/5)
eSCO: BT 4.1 Enhanced SCO command (1/5)
Andre Eisenbach [Thu, 11 May 2017 00:44:03 +0000 (00:44 +0000)]
Merge "HID: Add support for Set Idle and Get Idle commands (2/4)"
am:
642e53b17f
Change-Id: I6087d0517494ff36810c71c5e3ffa1d337c4f9f2
Andre Eisenbach [Thu, 11 May 2017 00:37:42 +0000 (00:37 +0000)]
Merge "HID: Add support for Set Idle and Get Idle commands (2/4)"
Pavlin Radoslavov [Thu, 11 May 2017 00:09:00 +0000 (17:09 -0700)]
Removed A2DP_GetTrackBitsPerSample() API because it is not needed
The A2DP_GetTrackBitsPerSample() API was replaced in the past
by A2dpCodecConfig::getAudioBitsPerSample() .
* Removed A2DP_GetTrackBitsPerSample() and related codec-specific APIs:
- A2DP_GetTrackBitsPerSampleSbc
- A2DP_GetTrackBitsPerSampleAac
- A2DP_GetTrackBitsPerSampleAptx
- A2DP_GetTrackBitsPerSampleAptxHd
- A2DP_GetTrackBitsPerSampleLdac
NOTE: The removed A2DP_GetTrackBitsPerSampleLdac implementation
had a bug: a2dp_ldac_caps.bits_per_sample -> ldac_cie.bits_per_sample
This bug itself was uncovered when switching to clang-
3960126
- A2DP_VendorGetTrackBitsPerSample()
* Replaced few leftover usages of A2DP_GetTrackBitsPerSample()
A2dpCodecConfig::getAudioBitsPerSample()
* Updated the unit tests
Test: Code compilation, unit tests, A2DP streaming
Bug:
37752547
Change-Id: I7feeda0f32922b8ef888b157673e3e2ade98b179
Jack He [Mon, 8 May 2017 00:27:47 +0000 (17:27 -0700)]
eSCO: Format changes to original vendor patch (4/5)
* Format changes to original vendor patch
* Re-order part of SCO creation code to improve readability
* Make log more concise and usefull
Bug:
19540029
Test: make, HFP PTS test, testplans/86884, testplans/87103
Change-Id: Ie0199519afb30f56568c04fef728fce44a172063
Jack He [Mon, 8 May 2017 00:26:02 +0000 (17:26 -0700)]
eSCO: Additional fix to get eSCO working for HFP and HSP (3/5)
* Removed vendor specific call after codec negotiation and before eSCO
command is sent to Bluetooth chip
* Removed vendor specific call after a SCO connection is requested by
the peer
* Removed vendor specific save audio state methods
Bug:
19540029
Test: make, HFP PTS test, testplans/86884, testplans/87103
Change-Id: I899405a8eaa2f38ee0de04949c5288f9eefa74df
Myles Watson [Fri, 10 Feb 2017 00:26:34 +0000 (16:26 -0800)]
eSCO: Remove BTM_WBS_INCLUDED from the stack (2/5)
All of our platforms support WBS.
Bug:
19540029
Test: make, HFP PTS test, testplans/86884, testplans/87103
Change-Id: I384d49f73935ebb35b17132e71c85174797c435e
Mudumba Ananth [Thu, 9 Feb 2017 17:05:48 +0000 (09:05 -0800)]
eSCO: BT 4.1 Enhanced SCO command (1/5)
Added support for BT 4.1 enhanced SCO feature on the stack.
This feature allows the stack to create a SCO connection with
remote device by using Hci_Enhanced_Setup_Synchronous_Connection
command after checking the controller (4.1) support for
enhanced SCO command.
Added the command parameters to use the command in both wide band
speech(WBS) and narrow band speech(NBS) scenarios.
Number of Broadcom vendor specific commands(VSCs)that are needed
to be sent to Broadcom controllers along with this command have
also been updated accordingly
NOTE: This change would also need a firmware patch for
the feature to work on Broadcom contollers which will
be delivered to Google in a separate change set.
Bug:
19540029
Test: make, HFP PTS test, testplans/86884, testplans/87103
Change-Id: I1014d81be5cbe91078a4484dd072ac3957bfdfe4
Marie Janssen [Wed, 10 May 2017 20:05:22 +0000 (20:05 +0000)]
btif: GetItemAttributes can return no attributes
am:
840f4f3de9
Change-Id: I6f63ea40bfd90552ad32ae2c25a3576676e42b0b
Marie Janssen [Fri, 14 Apr 2017 21:07:19 +0000 (14:07 -0700)]
btif: GetItemAttributes can return no attributes
If there are no attributes available, it's possible to return zero
attributes from a GetItemAttributes request.
This is triggered by some carkits who are unhappy when they only get
titles back (the only required item) and ask for the rest of the
attributes (which we don't have).
Test: connect to honda carkit and get snoop logs to confirm
Bug:
36055995
Bug:
35956792
Change-Id: I5a31e206565d212e456111d8c6b542c7a1569e5a
Jakub Pawlowski [Wed, 10 May 2017 17:31:35 +0000 (17:31 +0000)]
GATT Server: check UUID
am:
671ad6679c
Change-Id: I54da771e90d8d206f7fd0d4118072199a046eadb
Jakub Pawlowski [Wed, 10 May 2017 11:39:26 +0000 (04:39 -0700)]
GATT Server: check UUID
Characteristic and descriptor can't use UUID equal to GATT Attribute
Types. Using such UUID would result in invalid GATT database, and
crashes during service discovery.
Test: manual
Bug:
38134693
Change-Id: Ide2c21109f885cbc79287452b1dabd3f532de385
Hemant Gupta [Tue, 30 Jul 2013 10:41:33 +0000 (16:11 +0530)]
HID: Add support for Set Idle and Get Idle commands (2/4)
Provides an interface for application to send Set Idle
and Get Idle commands to remote HID Device. Support for these
two commands was missing from existing code, so existing code
design is reused to add support for these two commands.
Without this support following mandatory PTS test cases for HID 1.0
cannot be passed, TC_HOS_HID_BV_05/06.
Test: Executed PTS tests TC_HOS_HID_BV_05/06 and confirmed if they can
pass
Bug:
34344715
Change-Id: I14bc2dc349354fd87ef8aba25357514398532e87
Jack He [Wed, 10 May 2017 02:37:03 +0000 (02:37 +0000)]
Fix broken linux build
am:
2b59c4a084
Change-Id: I2acaae3044cba1e50647e21c1104218211294b79
Jack He [Thu, 4 May 2017 20:27:25 +0000 (13:27 -0700)]
Fix broken linux build
* Generic linux does not have property_get_int32. Instead,
osi_property_get_int32() is created to handle OS_GENERIC cases
* Some linux header have sigevent.sigev_notify_attributes typed as
(pthread_attr_t *) whereas others typed it as (void *), as any pointer
can be implicitly casted to (void *), the current casting to (void *)
is unncessary and will break build on systems using (pthread_attr_t *)
Test: make, unit test, no user visible effect
Change-Id: I24b33da453dc9d40656168a3bcd900d9c99219ce
Ajay Panicker [Mon, 8 May 2017 19:34:28 +0000 (19:34 +0000)]
Merge "Swap BTA and HCI queues with message loops"
am:
f5db809606
Change-Id: I499fd6260777c054fa1763d1febf9be01234f1bc
Treehugger Robot [Mon, 8 May 2017 19:27:33 +0000 (19:27 +0000)]
Merge "Swap BTA and HCI queues with message loops"
Andre Eisenbach [Mon, 8 May 2017 19:19:57 +0000 (19:19 +0000)]
Merge "Reject LE COC if cid is duplicated"
am:
95e3c5ac39
Change-Id: I16e1c8bc032df0215f72187639fe9e8a31444192
Andre Eisenbach [Mon, 8 May 2017 19:13:56 +0000 (19:13 +0000)]
Merge "Reject LE COC if cid is duplicated"
ravishankar srivatsa [Mon, 8 May 2017 18:01:51 +0000 (18:01 +0000)]
Add additional failure modes for SMP PTS test cases
am:
fd102ca161
Change-Id: Ie808ef38dcd0367b54eee0f66362e4c2dac04407
Ajay Panicker [Wed, 1 Mar 2017 18:00:30 +0000 (10:00 -0800)]
Swap BTA and HCI queues with message loops
Swapping out the queues with base::MessageLoop allows for an easier refactor
of alarms as we can just replace them with an instance of base::Timer. Also
refactored out the data_dispatcher as most of the code wasn't being used.
Bug:
37245162
Test: Bluetooth sanity test and listening to music
added net_test_btu_message_loop
Change-Id: I73c359f07a225733dc89f51422a6a24ce807c593
Jaganath Kanakkassery [Tue, 2 May 2017 10:54:16 +0000 (16:24 +0530)]
Reject LE COC if cid is duplicated
This is for PTS test TP/LE/CFC/BV-20-C.
The scenario is there is already one COC between DUT and PTS.
Then PTS tries to establish one more COC with same cid which
should be rejected.
Change-Id: I094a4058ac0e7bb9d7344e66d9feafee17bc3d53
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
ravishankar srivatsa [Thu, 4 May 2017 04:43:58 +0000 (10:13 +0530)]
Add additional failure modes for SMP PTS test cases
SM/MAS/SCJW/BI-01-C [Just Works, IUT Initiator, Secure Connections -Pairing Failed
For Lower tester to handle step 15.
Lower Tester responds with a Pairing Failed command in phase 2 with reason code
0x0C (Numeric Comparison Failed).
Bug:
37707831
Change-Id: Ia7103330d1d1ecb06e39502c2a0976585b203ba5
Signed-off-by: Ravishankar Srivatsa <Ravishankar.Srivatsa@intel.com>
Test: manual
Martin Brabham [Sat, 6 May 2017 03:00:31 +0000 (03:00 +0000)]
bta_dm: Stop copying garbage
am:
36d19de1aa
Change-Id: Ie723a15c8f9f9280dd93beaccbada8a1458b8717
Martin Brabham [Mon, 1 May 2017 23:30:40 +0000 (16:30 -0700)]
bta_dm: Stop copying garbage
After we reach 7 ACL connections we have 7 peer device records.
Once we reach this then we lose a connection and shrink the list we
copy garbage into the last peer device record. This can cause the flag
remove_dev_pending to be set to something > 0 thus true which causes the
stack to remove the device and its bonding information on the next
acl change event.
ACL Connections can happen from any connection (pairing, SDP, etc...)
Bug:
36598959
Test: Manual
Change-Id: Ifbaa4098edba442274ffde183960ef53169988e7
Ajay Panicker [Sat, 6 May 2017 00:27:09 +0000 (00:27 +0000)]
Move hci_thread to a message loop and prevent thread from spinning
am:
48294531bf
Change-Id: I4b1e3da909a4cd6125c17f4dc56a0d73aad31f70
Ajay Panicker [Fri, 28 Apr 2017 22:26:38 +0000 (15:26 -0700)]
Move hci_thread to a message loop and prevent thread from spinning
Before this patch, if there was a message on the command queue and
there were no command credits, the thread reactor would spin trying
to process the message on the command queue and would continue until
a credit was received. This led to a bug where upon switching users,
hci_thread would spin and try to use 100% of the CPU. This is fixed
by moving over to a message loop and queue system. The message loop
processes all the messages. If there aren't enough command credits,
command messages are deferred to the command queue and popped off
whenever more credits are aquired. The deferred queue has priority
to credits over recently posted messages.
Bug:
37733903
Test: Swap users with the real time scheduling patch applied, and
general Bluetooth usage.
TestTracker: 86249
Change-Id: Ib775e47f6d4810d3d7d8af5b3ba84adc4ada3da5
(cherry picked from commit
ffee0ee8a102101ded1d3fa398f20c4215e0c441)
Jakub Pawlowski [Fri, 5 May 2017 22:05:19 +0000 (22:05 +0000)]
LE advertise data parsing refactor
am:
103b2c44d3
Change-Id: I467cf2628393c11d316ad12664aa04f19106f036
Jakub Pawlowski [Fri, 28 Apr 2017 21:59:46 +0000 (14:59 -0700)]
LE advertise data parsing refactor
* merge BTM_CheckAdvData and BTM_CheckEirData into GetFieldByType
* check wether AD data is properly formatted when the packet is
received. Some controllers were returning malformed data that
resulted in stack crashes for BT5 packets.
* add tests to verify the helpers work as expected
Test: added net_test_stack_ad_parser
Bug:
37671082
Change-Id: I49e43d7cf7d0a8ace1ee45d9b14b2b8440096b05
Jakub Pawlowski [Fri, 5 May 2017 08:51:50 +0000 (08:51 +0000)]
Check device name length
am:
3a4e7622ff
Change-Id: Ie5935fa0bb9b15c2a3caae3db43fdaebf4a83002
Jakub Pawlowski [Fri, 28 Apr 2017 12:15:16 +0000 (05:15 -0700)]
Check device name length
BT spec limits the length of device name to 248 bytes. With the new
LE advertising packets, that can go up to 1650 bytes long, we must check
the length of device name received.
Bug:
37671082
Test: manual
Change-Id: Iad309d638003c2391014c9764605d84ed5717cb1
Pavlin Radoslavov [Thu, 4 May 2017 18:27:24 +0000 (18:27 +0000)]
Merge "Remove 96.0 and 88.2 kHz sample rate from A2DP AAC capability"
am:
d861719531
Change-Id: Iee78e052c01a772f30c6dcf19a9bf97036751f5c
Treehugger Robot [Thu, 4 May 2017 18:23:50 +0000 (18:23 +0000)]
Merge "Remove 96.0 and 88.2 kHz sample rate from A2DP AAC capability"
Jakub Pawlowski [Thu, 4 May 2017 16:49:44 +0000 (16:49 +0000)]
Add supervision timeout workaround for Nexus Remote
am:
9e6747537a
Change-Id: I89970cc9eaf72cbbbae294dc1a6816b612ed7579
Jakub Pawlowski [Tue, 28 Mar 2017 19:58:34 +0000 (12:58 -0700)]
Add supervision timeout workaround for Nexus Remote
The Nexus Remote would report 100ms supervision timeout in its preferred
connection parameters. In some noisy environments, this might cause
connection to be dropped. As a workaround, set the timeout to 3s for the
remote.
Test: manual
Bug:
36645397
Bug:
37717216
Change-Id: I665a854e9d55067ec1aca273c31d06c6114c48be
Pavlin Radoslavov [Thu, 4 May 2017 05:48:28 +0000 (22:48 -0700)]
Remove 96.0 and 88.2 kHz sample rate from A2DP AAC capability
The A2DP AAC Source capabilty should not include 96.0 and 88.2 kHz
sample rate - those were included unintentionally without being tested.
Bug:
37968743
Test: A2DP AAC streaming
Change-Id: Ia3228d4d14d3288acfda42fbaf8ab248ae530b48
Andy Hung [Wed, 3 May 2017 01:44:11 +0000 (01:44 +0000)]
audio_a2dp_hw: fix fd leak on open
am:
2ae1ddbb73
Change-Id: Ieed84c659c4b10d126ab31cf0d2fe1ad15083e27
Andy Hung [Mon, 1 May 2017 22:04:57 +0000 (15:04 -0700)]
audio_a2dp_hw: fix fd leak on open
Open hal fds can be checked by
adb shell lsof | grep audio@2. | grep socket | wc
Test: connect and disconnect BT, check open fd.
Bug:
37726871
Change-Id: Id446c43515eceb0828cfb33807a4c0b4c6145a6d
(cherry picked from commit
cef156574c9928164b7a5e263a5494cf61ca39d8)
Ajay Panicker [Fri, 28 Apr 2017 00:20:40 +0000 (00:20 +0000)]
Prevent buffer overflow caused by decrementing past zero
am:
882db61b73
Change-Id: I1de124b2baf7dd3c691df95680c20600680841c0
Ajay Panicker [Tue, 13 Dec 2016 18:51:12 +0000 (10:51 -0800)]
Prevent buffer overflow caused by decrementing past zero
Bug:
33555809
Test: Sanity test with Bluetooth
Change-Id: I4c82d3c162ffdc9436f9cd8985061655a055774b
Jakub Pawlowski [Thu, 27 Apr 2017 19:30:24 +0000 (19:30 +0000)]
Fix LE disconnecting right after pairing
am:
7c8bab2313
Change-Id: I22b794624d6f3b51d1e0089802cbf53c64305b51
Jakub Pawlowski [Thu, 27 Apr 2017 11:52:34 +0000 (04:52 -0700)]
Fix LE disconnecting right after pairing
When a device connect to android over LE, the default policy is to keep
this connection. If any app "claims" this connnection, and then stop
using it, we'll disconnect from the device after a short timeout.
If pairing is triggered to such device, that is connected but not used
by any app, it will cause disconnect after the pairing is finished. This
is because using SMP over fixed LE L2CAP channel is conseidered as
connecting, using, and disconnecting a channel by the stack. This is
obvious logic error - using fixed channels should not require
"connecting" to them.
As a temporary workaround, do not trigger a timeout when a fixed SMP
channel is closed over LE.
For LE only devices, this means they will stay connected after the
pairing until some app starts using them or they disconnect. For dual
mode devices, Classic connection will be established and SDP will be
performed. The classic connection will be disconnected if no app will
use it, and the LE connection to the device will stay up.
Bug:
37352720
Test: manual
Change-Id: Ic9d688aacf84e0267277b12b28dfa7cc57fdcea6
Ajay Panicker [Thu, 27 Apr 2017 17:39:55 +0000 (17:39 +0000)]
Limit btsnoop file size (5/8)
am:
99c3422442
Change-Id: I015663966b19215d7ea4c3add0ed93948430df64
Ajay Panicker [Tue, 18 Apr 2017 03:53:24 +0000 (20:53 -0700)]
Limit btsnoop file size (5/8)
Limit btsnoop file size by rotating between snoop files. The rotation occurrs
when a fixed number of packets have been logged and will start overwriting
the older file.
Bug:
35998031
Test: Enable snoop logs from developer options and let logs get large
Merged-In: Ia8741223cb31b2c20d9ef5607e9204cc3946b165
Change-Id: Ia8741223cb31b2c20d9ef5607e9204cc3946b165
Jacky Cheung [Wed, 26 Apr 2017 22:27:57 +0000 (22:27 +0000)]
Fix issue with BLE advertising not started when local privacy is not enabled
am:
afdd081b4b
Change-Id: I22817c79ffc0d7749261b18bcbd608fad70c20d3
Jacky Cheung [Wed, 26 Apr 2017 17:27:41 +0000 (10:27 -0700)]
Fix issue with BLE advertising not started when local privacy is not enabled
Bug:
37282500
Test: manual
Change-Id: I44657d0b3315bc241373c8cbaf6a2b6a6e49f31d
Philip Cuadra [Wed, 26 Apr 2017 17:02:11 +0000 (17:02 +0000)]
Make Bluetooth audio threads use RT scheduling
am:
96c42e70f5
Change-Id: Idcea625a9ca29fe5f5b4c0cc81e74e28d3670b04
Philip Cuadra [Thu, 23 Mar 2017 17:10:34 +0000 (10:10 -0700)]
Make Bluetooth audio threads use RT scheduling
Bluetooth threads that are used in audio have deadline
requirements for glitchless playback. Those threads need to be
scheduled as RT tasks to ensure that they can meet the deadline even if
there is high system load.
Bug
37518404
Test: play Bluetooth audio, check for RT with systrace
Change-Id: I4505fbce55e5a4fe18d00dbda23646a60e482efd
Jakub Pawlowski [Tue, 25 Apr 2017 10:40:29 +0000 (10:40 +0000)]
Merge "Handle remote not supporting LL_SLAVE_FEATURE_REQ"
am:
e3caefe394
Change-Id: I15ab18d2f7aec748287c0420f143c4a57e8a0e4f
Treehugger Robot [Tue, 25 Apr 2017 10:35:03 +0000 (10:35 +0000)]
Merge "Handle remote not supporting LL_SLAVE_FEATURE_REQ"
Pavlin Radoslavov [Tue, 25 Apr 2017 05:06:37 +0000 (05:06 +0000)]
Add missing library dependency when compiling the unit tests
am:
044921b223
Change-Id: I491edb09f445b5aca0948c134cb78a0334804043
Pavlin Radoslavov [Tue, 25 Apr 2017 00:37:20 +0000 (17:37 -0700)]
Add missing library dependency when compiling the unit tests
This fixes a compilation issue when compiling with ASAN enabled.
Bug:
37624756
Test: make -j 40 SANITIZE_TARGET='address coverage' tests
Change-Id: I9caa3d404e60ee105435539744ed2b8ccf353700
Hemant Gupta [Tue, 25 Apr 2017 00:08:46 +0000 (00:08 +0000)]
AVRCP 1.6: Limit GetFolderItemResponse
am:
a7c7437bbf
Change-Id: I6e0eedf6a7486aadcb6fabf214f1bafa2efd2233
Jakub Pawlowski [Mon, 24 Apr 2017 13:34:11 +0000 (06:34 -0700)]
Handle remote not supporting LL_SLAVE_FEATURE_REQ
Test: for PTS
Change-Id: I3030a068c1c4980fa7cbb23b478afbe441584869