OSDN Git Service
Jakub Pawlowski [Mon, 5 Jun 2017 19:20:04 +0000 (12:20 -0700)]
Get rid of trivial BTA_GATTC_ events
Test: compilation test
Change-Id: I8c705d1bb0532cbe0dd69b1f3b0b5d1a63534a23
Jakub Pawlowski [Mon, 31 Oct 2016 19:56:12 +0000 (12:56 -0700)]
Initial DBus transport support
This patch adds initial support for DBus transport on Linux. It exposes
initial implementation of Adapter that can be Enabled and Disabled. One
can also introspect the interface to find the exposed methods. Further
patches will extend it's functionality.
Test: ninja -C out/Default -j 40
Change-Id: I173cc752b8d8aaa8706ed36f75f5a043cc987b1a
Jakub Pawlowski [Sat, 3 Jun 2017 23:39:04 +0000 (16:39 -0700)]
Fix order of parameters to BTA_GATTC_Open
Different order of parameters in different flavours of method caused
bug in btif_gatt_client.cc, where every client would be started as
opportunistic. This issue was introduced in commit
16bb48b320cde54a1a06a525f4d9be1421689649
Bug:
34951749
Test: sl4a GattReadTest was flaky without this patch
Change-Id: I243b11bd8e2c0da9f01cbd3eab95dc808bd54006
Jakub Pawlowski [Tue, 30 May 2017 18:21:04 +0000 (11:21 -0700)]
Pass GATT cb's by reference and other style fixes
Test: compilation test
Change-Id: I410d0d0a0bf49b9f3ca5e034c66fe8e82661cee7
Jakub Pawlowski [Tue, 30 May 2017 16:59:54 +0000 (09:59 -0700)]
Use std::queue for pending_enc_clcb
Test:
62188929
Change-Id: Ide07f15c5e5b6bc8b93ac350081b7bef7c7b3938
Sunny Kapdi [Thu, 1 Jun 2017 21:34:03 +0000 (14:34 -0700)]
Fix params of SetPeriodicAdvertisingParameters
Fix the sequence of SetPeriodicAdvertisingParameters
in the hci_cmd
Bug:
62268713
Change-Id: Ibdcd362458e9d7ee2f95106a2aefa76e1c264103
Avish Shah [Wed, 31 May 2017 05:13:57 +0000 (10:43 +0530)]
GATT: Fixed typo while notifying connection update
Current conditions checks whether the app registered for
PHY_UPDATE instead it should check for CONN_UPDATE.
Bug:
62206018
Test: Manual
Change-Id: Ie9d068a24d13ea0b186b0ca874531aa4ffd1121f
Myles Watson [Wed, 24 May 2017 20:16:40 +0000 (13:16 -0700)]
HCI: Improve timeout handling
Remove pending commands before enqueueing new ones and log all
pending commands when there is a timeout.
Bug:
37298084
Test: set the timeout to 20ms
Change-Id: I90a48db46a78f75dd78e468ee2d5c948afc1850e
Myles Watson [Tue, 9 May 2017 23:50:00 +0000 (16:50 -0700)]
HCI: Get debug info from the firmware on timeout
Bug:
37298084
Test: set the timeout to 20ms
Change-Id: I8b9815a03a15dcb6ce78c0692874b55cb4fc07bc
Jakub Pawlowski [Sat, 27 May 2017 01:51:27 +0000 (18:51 -0700)]
Get rid of unused tGATT_SCCB
Test: compilation test
Change-Id: I32fee6a93442c8415f7d855c1e4802bceb6fe5ff
Treehugger Robot [Sat, 27 May 2017 01:58:34 +0000 (01:58 +0000)]
Merge "HSP: Use peer_version during SCO setup"
Treehugger Robot [Sat, 27 May 2017 00:50:22 +0000 (00:50 +0000)]
Merge changes I0f43061b,I48c18401,I5073e800,I2c0926c7,I73120878
* changes:
Get rid of AMP_INCLUDED
Get rid of GAP control block
Get rid of GAP_TRACE_* logs
Get rid of GAP_CONN_INCLUDED
BLE GAP simplification
Jakub Pawlowski [Fri, 26 May 2017 22:54:23 +0000 (15:54 -0700)]
Get rid of AMP_INCLUDED
Change-Id: I0f43061b150cfc61bb31cfc7a580592454cfbf9f
Jakub Pawlowski [Fri, 26 May 2017 22:49:07 +0000 (15:49 -0700)]
Get rid of GAP control block
Instead of global GAP control block, use separate block for gap_conn.cc
and gap_ble.cc
Change-Id: I48c18401390300f80285ba5491e8d91ee63d55ef
Jakub Pawlowski [Fri, 26 May 2017 22:16:15 +0000 (15:16 -0700)]
Get rid of GAP_TRACE_* logs
This is a step required for making GAP testable, and not dependent on
any global log structures.
Change-Id: I5073e800cf842864021328308feb59a409927b2b
Myles Watson [Fri, 26 May 2017 00:24:49 +0000 (17:24 -0700)]
GATT: Interop fix for service changed indications
The Pixel C Keyboard disconnects if it receives an indication
for which it hasn't registered.
Test: Add a GATT service with Pixel C connected
Bug:
34352677
Change-Id: I1f717db40b2ba9ec21feac5fd9e339c09f140d51
Jakub Pawlowski [Fri, 26 May 2017 21:36:51 +0000 (14:36 -0700)]
Get rid of GAP_CONN_INCLUDED
Change-Id: I2c0926c7c935b6efe1f0ea35a86ed89edb746096
Jakub Pawlowski [Thu, 25 May 2017 16:05:23 +0000 (09:05 -0700)]
BLE GAP simplification
Test: manual
Change-Id: I73120878aadf41e54f8eb1aae75e9f9bbb1df942
Jack He [Tue, 23 May 2017 02:23:04 +0000 (19:23 -0700)]
HSP: Use peer_version during SCO setup
* HSP profile should use peer_version obtained through SDP search to
determine its behavior during SCO setup instead of a local version
during initialization
* Added a WARNING message if SDP search failed to get remote HSP
version, the default behavior is to use HSP 1.0
* Changed SDP search initialization to look for one UUID at a time
* See Bluetooth Erratum 3507
Test: make, HSP PTS test
Bug:
38210042
Change-Id: I67ce615a785b25a2e9304613a29d9be66a656c54
Jakub Pawlowski [Fri, 26 May 2017 17:25:02 +0000 (10:25 -0700)]
Remove dead code from GAP
Test: none
Change-Id: I23badbf73420e4af26e6d84f7b04fcd56100b122
Treehugger Robot [Thu, 25 May 2017 22:32:19 +0000 (22:32 +0000)]
Merge "MCAP: Add a test tool for MCAP"
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.
Jack He [Thu, 18 May 2017 05:26:05 +0000 (22:26 -0700)]
MCAP: Add a test tool for MCAP
* Add a command line tool for MCAP related tests
* This tool can access the Bluetooth stack via a command line program
* Type "help" to obtain a list of available console commands in this
Bluetooth
* Bluetooth must be disabled when this tool is running
Bug:
37867299
Test: make, PTS MCAP test
Change-Id: I106e6625ee8a29b7fdad88cdfeb99419054ef771
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 [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 [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 [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
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
Treehugger Robot [Thu, 18 May 2017 01:12:49 +0000 (01:12 +0000)]
Merge "Protect the message loop from accesses after HCI shutdown"
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 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 [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 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 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 [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 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 [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 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
Treehugger Robot [Thu, 11 May 2017 02:10:07 +0000 (02:10 +0000)]
Merge "Removed A2DP_GetTrackBitsPerSample() API because it is not needed"
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: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 [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 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 [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
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:13:56 +0000 (19:13 +0000)]
Merge "Reject LE COC if cid is duplicated"
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 [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 [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, 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, 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
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 [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 [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 [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 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 [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 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 [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
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 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
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
Hemant Gupta [Wed, 12 Apr 2017 18:26:15 +0000 (23:56 +0530)]
AVRCP 1.6: Limit GetFolderItemResponse
Usecase:
1) Connect from AVRCP Controller supporting browsing
having low L2CAP MTU eg 672.
2) Request for get folder items with large request items,
response for which will exceed MTU size.
Expected Result:
As per AVRCP 1.6 Spec, section 29.20 pg 178, response should be
limited to number of completed get folder items that can fit in
single AVCTP Browsing channel MTU even if the completed items
are less than actually requested by AVRCP Controller.
Observation:
DUT responding with Internal Error.
Root Cause:
When there is no space to fill complete Get Folder Item response
within MTU size, DUT was returning error.
Fix:
Send max completed items which can fit in single MTU packet.
Test: Checked if the remote device can receive the truncated
response and get folder items succeeds when remote device
reissues get folder item request with updated start list count.
Frequency: 5/5
Bug:
37304477
Change-Id: I1963f97075382fc8333038e3efffaf61a9d84a28
Stanley Tng [Tue, 18 Apr 2017 05:38:38 +0000 (22:38 -0700)]
Allow the Bluetooth MAC address to be updated asynchronously (3/3)
There are intermittent issues where either the returned Bluetooth
MAC address to Java framework is uninitialized or this address update
arrives too late. This fix will do 2 things:
(1) Returns error when MAC address is unavailable in the native code.
(2) Updates the MAC address later by adding a new broadcast event.
Test: Check address for these cases: factory reset, system reboot, and
Bluetooth re-enable.
Bug:
36709382
Change-Id: I7b1c526ee227897c003ac921078f317f96b92604
Jakub Pawlowski [Wed, 19 Apr 2017 14:05:00 +0000 (07:05 -0700)]
Expose LE advertiser address for easier PTS tests (4/6)
This patchset adds a hidden method getOwnAddress, that lets app with
BLUETOOTH_PRIVILEGED permission to lear their own addreess. This is done
exclusively for PTS tests.
Bug:
35147497
Test: manual
Change-Id: I5ad554d872f2b772f2bf91642a9648c4018d935c
Pavlin Radoslavov [Wed, 19 Apr 2017 21:27:56 +0000 (21:27 +0000)]
Merge changes from topics 'bt-a2dp-ldac-abr-adjustments', 'bt-a2dp-ldac-dropped-count'
* changes:
Print the LDAC adaptive bit rate adjustments
Fix/update the computation of the total dropped packets for LDAC and AAC
Treehugger Robot [Wed, 19 Apr 2017 20:31:45 +0000 (20:31 +0000)]
Merge "Remove libbt-vendor from system/bt/main/Android.bp"
Myles Watson [Mon, 17 Apr 2017 20:43:05 +0000 (13:43 -0700)]
test_vendor: Remove unused libbt-vendor files
Bug:
36810308
Test: builds
Change-Id: I50b4a3efaac622959dbf25c0f854d455057e6f3e
Myles Watson [Tue, 7 Mar 2017 12:57:03 +0000 (04:57 -0800)]
Remove libbt-vendor from system/bt/main/Android.bp
Platforms that need libbt-vendor, which is deprecated, should include the
build dependency in device.mk.
Bug:
36810308
Test: Angler Bluetooth starts/stops
Change-Id: I0e37bf48536ca134493aaa3a496bafb3b80cd882
Treehugger Robot [Wed, 19 Apr 2017 20:07:46 +0000 (20:07 +0000)]
Merge "bta_gattc_cache: Initialize gatt_db_elemement_t permissions to 0"
Pavlin Radoslavov [Wed, 19 Apr 2017 18:44:19 +0000 (11:44 -0700)]
Fix line formatting per clang-format
The fix is needed to resolve a merge conflict.
Test: Code compilation
Change-Id: I41cd79db1750b526fafa33e097c56a7cb46ba6af
Pavlin Radoslavov [Wed, 19 Apr 2017 17:50:16 +0000 (10:50 -0700)]
Print the LDAC adaptive bit rate adjustments
A2DP LDAC State:
...
LDAC quality mode : ABR
LDAC transmission bitrate (Kbps) : 990
LDAC saved transmit queue length : 0
LDAC adaptive bit rate encode quality mode index : 0
LDAC adaptive bit rate adjustments : 4
Test: A2DP streaming to headsets that support LDAC
Bug:
37287785
Change-Id: Ife8017ca129fa9b06ea85f6029c553a52a306cc2
Pavlin Radoslavov [Wed, 19 Apr 2017 03:05:39 +0000 (20:05 -0700)]
Fix/update the computation of the total dropped packets for LDAC and AAC
Also:
* Print the "LDAC transmission bitrate (Kbps)"
* Print the "LDAC adaptive bit rate encode quality mode index"
when the LDAC quality mode is ABR
A2DP LDAC State:
...
LDAC quality mode : ABR
LDAC transmission bitrate (Kbps) : 990
LDAC saved transmit queue length : 0
LDAC adaptive bit rate encode quality mode index : 0
Test: A2DP streaming to headsets that support LDAC
Bug:
37287785
Change-Id: I83b22090b087eb8a1e49d1853468b7dbbf9d9ad3
Treehugger Robot [Wed, 19 Apr 2017 06:08:48 +0000 (06:08 +0000)]
Merge "Read by UUID for PTS tests (4/5)"
Bailey Forrest [Wed, 19 Apr 2017 04:04:10 +0000 (21:04 -0700)]
bta_gattc_cache: Initialize gatt_db_elemement_t permissions to 0
Previously this value was uninitialized. Attribute permissions are not
discovable via the attribute protocol.
Bug: None
Test: Build. permissions are 0.
Change-Id: I5fdac3b90683245a0af0d6e27a2873499ca90e6c
Treehugger Robot [Wed, 19 Apr 2017 00:41:26 +0000 (00:41 +0000)]
Merge "AVRCP TG: Get Item Attribute command not working"
Hemant Gupta [Fri, 14 Apr 2017 06:37:37 +0000 (12:07 +0530)]
stack: AVRCP: add missing debug arguments
Fixes a crash while sending AVRCP Get Item Attribute response due to missing
function arguments.
Test: test with BMW kit, Crysler kit which trigger this bug
Bug:
37334553
Fixes:
37474772
Change-Id: Ie129e22e427896028a50e6b0ae8c2cdd151b0ea1
Jakub Pawlowski [Fri, 14 Apr 2017 14:27:49 +0000 (07:27 -0700)]
Read by UUID for PTS tests (4/5)
Add a hidden api for reading characteristic by UUID for PTS.
Bug:
35150313
Test: sl4a GattReadTest.byUuid
Change-Id: I072473c5f7b761707774efd89f8a22bfdf012135
Jacky Cheung [Mon, 17 Apr 2017 20:38:39 +0000 (13:38 -0700)]
Do not GATT_ERROR on MTU change
Bug:
37305498
Test: manual on MSM8909
Change-Id: I07389620efc914d0ece52262edc2c35b498d5564
Pavlin Radoslavov [Fri, 14 Apr 2017 10:45:18 +0000 (03:45 -0700)]
Add missing NULL pointer assignment after fixed_queue_free and alarm_free
Bug:
37285767
Test: Code compilation
Change-Id: I53f759ea477079b0b6aed4bcbeefb645886263d6
Pavlin Radoslavov [Thu, 13 Apr 2017 21:33:30 +0000 (14:33 -0700)]
Fix a race condition during HCI module shutdown
If an HCI event (e.g., incoming event) happens during
HCI module shutdown, and the processing of that event
calls update_command_response_timer() right after
"alarm_free(command_response_timer)" in the beginning
of hci_module_shut_down(), then update_command_response_timer()
will try to schedule an alarm on command_response_timer that is NULL.
Test: Enable/disable Bluetooth, added unit tests
Bug:
37241256
Change-Id: I7fd58446caedc135e906953644201f88b5df32bb
Andre Eisenbach [Thu, 13 Apr 2017 21:49:36 +0000 (14:49 -0700)]
Do not remove device security record on LMP timeout
If an LMP timeout is encountered in the middle of authentication, the
link key is removed from the controller (but not from NVRAM). This can
result in a follow up connction triggering a LINK_KEY_MISSING reply,
which in turn can cause a remote device to initiate pairing which will
then finally remove the link key stored in NVRAM as well.
This change prevents the link key from being removed from the Bluetooth
controller in case of a timeout during link authentication.
Bug:
36798442
Test: manual
Change-Id: Ic89a16b45756e3d40b2e374c645c8f245f6ce3fc
Hemant Gupta [Thu, 13 Apr 2017 14:34:36 +0000 (20:04 +0530)]
AVRCP TG: Get Item Attribute command not working
Usecase:
1) Connect from carkit supporting AVRCP 1.4/1.5 CT to DUT
2) Issue get item attribute command with valid attribute list.
Expected behaviour:
Get item attribute command succeeds and returns the requested
attributes of particular item
Observed result:
Get Item attribute command fails with BAD Param Error
Root Cause:
Wrong structure from tAVRC_COMMAND was being passed to fill_attribute_id_array
which was leading to error being returned.
Fix:
Use get_attrs of type tAVRC_GET_ATTRS_CMD instead of get_elem_attrs of type
tAVRC_GET_ELEM_ATTRS_CMD when remote device requests for get item attributes.
Test: Checked that now bad param error is not returned in response for
get item attribute command from remote device.
Bug:
37302234
Change-Id: I9245f726f37ffd666d143d2232dac868a2cc3268
Pavlin Radoslavov [Wed, 5 Apr 2017 23:38:42 +0000 (16:38 -0700)]
Reduce the audio A2DP HAL output audio stream buffer size
Reduce the audio A2DP HAL output audio stream buffer size
(per constant AUDIO_STREAM_OUTPUT_BUFFER_PERIODS) from 4 to 2.
After the change, the output buffer size is double the buffer period.
Bug:
35849921
Test: A2DP streaming with various codec settings. Testplans/83305.
Change-Id: I2a15d468e748a03b481bf2117903ab06cddd02a3
Treehugger Robot [Tue, 11 Apr 2017 20:09:18 +0000 (20:09 +0000)]
Merge "HFP: Disable BTRH feature"
liuchao [Tue, 11 Apr 2017 12:41:29 +0000 (20:41 +0800)]
Fix log record after return
Put log before the returned BUSY
Test: mm -j8
Change-Id: Ic3fb15a35adac363519cabecfcf8a2d3da60107c