OSDN Git Service

android-x86/system-bt.git
8 years agoRemove unused "cmn_ble_vsc_cb"; causing extended scan to not start
IHLHO KIM [Wed, 15 Jun 2016 05:27:53 +0000 (05:27 +0000)]
Remove unused "cmn_ble_vsc_cb"; causing extended scan to not start

The local variable "cmn_ble_vsc_cb" is referenced instead of btm_cb.
This causes generic LE scans to be used even though the controller
supports extended scans.

Change-Id: I8b1d817d4d04ee3a8db4285998b5a1916d046ccc

8 years agobta: use standard types
Marie Janssen [Fri, 17 Jun 2016 21:12:17 +0000 (14:12 -0700)]
bta: use standard types

Use standard types everywhere.
Use standard style for #if statements:
 - #if (VAR_NAME == TRUE)
 - #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__
Fix some debug statements to use __func__

Change-Id: Ib86de4de9f14529ecaa4f71597260e3b5785360b

8 years agoVectors as parameters to GATT write/indicate (1/3)
Jakub Pawlowski [Fri, 27 May 2016 22:48:03 +0000 (15:48 -0700)]
Vectors as parameters to GATT write/indicate (1/3)

This changes are covered in test cases:
GattReadTest.*
GattWriteTest.*

Bug: 29005882
Bug: 28485365
Change-Id: I1409e6ead22ff691190f9ea4c3ffe2267bd3bf33

8 years agoUse vector instead of C arrays in bta_gatt_api
Jakub Pawlowski [Fri, 27 May 2016 16:42:21 +0000 (09:42 -0700)]
Use vector instead of C arrays in bta_gatt_api

This changes are covered in test cases:
GattReadTest.*
GattWriteTest.*

Bug: 28485365
Change-Id: I0bb098b4d5e991ed53d3276ac6f7174723c59444

8 years agoAVRCP: rename constant AVRC_CTLR_INCLUDED
Marie Janssen [Fri, 17 Jun 2016 20:13:21 +0000 (13:13 -0700)]
AVRCP: rename constant AVRC_CTLR_INCLUDED

Typo fixed to AVRC_CTRL_INCLUDED

Change-Id: Ib0ac11916bf6e856ae2d3cfb842bd0b8fef56008

8 years agoHOGP: Clear pending operations for a given device on connect
Jakub Pawlowski [Mon, 13 Jun 2016 17:30:17 +0000 (10:30 -0700)]
HOGP: Clear pending operations for a given device on connect

If there are any HID operations scheduled after disconnect, mark the
device as no longer executing after establishing connection. Otherwise
we'll be unable to send any HID commands to it.

Change-Id: Ie1bb622388a3bcb574dec3dde76ef4518ee1102f
(cherry picked from commit 4362b8c559575a83897a5af55202ce2c1d19925c)

8 years agoHOGP: Preffer write command over write requests
Jakub Pawlowski [Tue, 14 Jun 2016 21:40:51 +0000 (14:40 -0700)]
HOGP: Preffer write command over write requests

Some HID devices will accept both write request and write command.
Prefer write commands when possible.

This is due to bug in some hardware, that will not send write response
when too many commands are queued.

Bug: 29184976
Change-Id: I5bafc067f044a48f152c60b8e17722067bc1453e
(cherry picked from commit af77225c0d7bec06d2417b0305ebcbab04144caa)

8 years agoMerge "BTIF: remove unnecessary 'extern "C"'"
Jakub Pawlowski [Fri, 17 Jun 2016 19:12:36 +0000 (19:12 +0000)]
Merge "BTIF: remove unnecessary 'extern "C"'"

8 years agoMerge "test_vendor_lib: refactor packet constructors"
Treehugger Robot [Fri, 17 Jun 2016 01:13:14 +0000 (01:13 +0000)]
Merge "test_vendor_lib: refactor packet constructors"

8 years agoAdd missing NULL pointers assignments
Pavlin Radoslavov [Thu, 16 Jun 2016 23:37:57 +0000 (16:37 -0700)]
Add missing NULL pointers assignments

Each pointer that was freed by one of the following functions should
be reset to NULL:
 - config_free()
 - data_dispatcher_free()
 - fixed_queue_free()
 - list_free()

Bug: 29421693
Change-Id: Ie55a04ed986393994564edcf872d7413b0767a85

8 years agoBTIF: remove unnecessary 'extern "C"'
Jakub Pawlowski [Thu, 16 Jun 2016 00:15:42 +0000 (17:15 -0700)]
BTIF: remove unnecessary 'extern "C"'

btif is all cpp now, with execption to uuid_to_string_legacy
and few methods imported/exported for main module.
There is no need to have c linkage for the rest of it.

Change-Id: I5e7079e1269dc6461b14b665587592270cdf3140

8 years agotest_vendor_lib: refactor packet constructors
Myles Watson [Thu, 26 May 2016 21:13:42 +0000 (14:13 -0700)]
test_vendor_lib: refactor packet constructors

Make it simpler to append bytes to payloads, since that's a common
operation.

Change-Id: I7fc975fb999add8e1a360b91bdae869d6d7d2029
Signed-off-by: Myles Watson <mylesgw@google.com>
8 years agoGATT: don't update link status for apps that were never connected
Jakub Pawlowski [Thu, 16 Jun 2016 15:16:48 +0000 (08:16 -0700)]
GATT: don't update link status for apps that were never connected

Right now, in GATT_Deregister we make a call to
gatt_update_app_use_link_flag, which might result in a call to
GATT_SetIddleTimeout on links that this client was never connected to.

In order to fix that, we must check if gatt_update_app_hold_link_status
made any changes to p_tcb->app_hold_link. If not, then skip updating
the timer.

Change-Id: I6f18ec7fe4e80e048adc9e360cae703b7d64d62a

8 years agoConvert HID and Device Manager BTA code to C++
Jakub Pawlowski [Fri, 27 May 2016 00:57:22 +0000 (17:57 -0700)]
Convert HID and Device Manager BTA code to C++

These are the only places that use BTA GATTC API. After this change it's
possible to change GATT API to use C++ types as arguments.

Bug: 28485365
Change-Id: Idf83396f4bc3a2cc8a9b41f69da5d033af1be678

8 years agoFix unused source warning
Dan Willemsen [Wed, 15 Jun 2016 22:46:15 +0000 (15:46 -0700)]
Fix unused source warning

These were using the wrong c++ extension, so the build system was not
picking them up.

Change-Id: I3a767a236bca05f04dd069bb1f40796f41cb8b60

8 years agoFix missing GATT Characteristic from last service
Jakub Pawlowski [Tue, 14 Jun 2016 19:23:44 +0000 (12:23 -0700)]
Fix missing GATT Characteristic from last service

GATT Service is contained between start and end handle. If
characteristic definition is at end handle, and it's value definition is
after end handle, it will not be properly discovered. That's because we
use value_handle instead of attribute_handle to identify
characteristics.

As a workaround, increase service boundary if value is defined after
it's definition.

Bug: 29253825
Change-Id: Ib145aea4f5cf38a1fbb977c301136e16f8f900f7
(chery picked from commit 552e630435a68d8f51d458dccf8697c625cf1510)

8 years agoUse UINT16 for GATT attribute id field
Jakub Pawlowski [Tue, 14 Jun 2016 19:47:52 +0000 (12:47 -0700)]
Use UINT16 for GATT attribute id field

Id field is equal to attribute handle, so it must be 16bits.
Otherwise only piece of GATT database can be used.

Bug: 29253825
Change-Id: Ia88e3ad3eb96ca8e97349aa5e852e66c57072b49
(cherry picked from commit e6b1cb43525e27f95de85dc43150d7368b9d4c35)

8 years agoAdd missing curly braces in clear notification
Jakub Pawlowski [Tue, 14 Jun 2016 16:26:24 +0000 (09:26 -0700)]
Add missing curly braces in clear notification

Change-Id: I59b13486f76735e5dd0c07d57b2671c746169bd8

8 years agoHOGP: Clear pending operations for a given device on disconnect
Jakub Pawlowski [Fri, 10 Jun 2016 23:32:26 +0000 (16:32 -0700)]
HOGP: Clear pending operations for a given device on disconnect

If there are any GATT operations interrupted by a disconnect, mark the
device as no longer executing. Otherwise we'll stil receive data from
the device, but we'll be unable to send any HID commands to it.

Bug: 29184976
Change-Id: I489f41c970abad0ff1145005d3250beafa83d27e

8 years agoDo not request AVRC_CAP_COMPANY_ID if A2DP Sink is not enabled
AnubhavGupta [Wed, 6 Apr 2016 06:17:05 +0000 (11:47 +0530)]
Do not request AVRC_CAP_COMPANY_ID if A2DP Sink is not enabled

Also fixed AVRC_PDU_GET_PLAY_STATUS timeout response.

Bug: 28177785
Change-Id: Icde64a5c1806453850abe101f9707fff61566566

8 years agoSet disable timer in case of any active ACL connection
Srinu Jella [Wed, 8 Jun 2016 10:20:53 +0000 (15:50 +0530)]
Set disable timer in case of any active ACL connection

Use Case: Disable time out when atleast one active ACL connections

Steps:
1. Turn ON Bluetooth
2. Connect to any Headset
3. Turn OFF bluetooth.

Failure: Turn OFF bluetooth is failed when atleast one active ACL connections

Root Cause:i If we have one or more active ACL links, so it is not notitying
BTA_DM_DISABLE_EVT to upper layer.

Fix: Set disable timer in case of any active ACL connection

Change-Id: Ica47717119f1ab9fa9f4f5244e8483c408276a2a

8 years agoMerge "Reject L2CAP INFO RSP and ECHO RSP on the LE signaling channel"
Treehugger Robot [Wed, 8 Jun 2016 00:45:46 +0000 (00:45 +0000)]
Merge "Reject L2CAP INFO RSP and ECHO RSP on the LE signaling channel"

8 years agoMerge "Fix payload size for GATT Read by type request"
Treehugger Robot [Wed, 8 Jun 2016 00:45:21 +0000 (00:45 +0000)]
Merge "Fix payload size for GATT Read by type request"

8 years agoFix payload size for GATT Read by type request
Subramanian Srinivasan [Fri, 27 May 2016 23:32:55 +0000 (16:32 -0700)]
Fix payload size for GATT Read by type request

Payload size for GATT Read by type request for UUID32 and UUID128
are incorrectly allocated. This leads to memory overflow when
Read by type request is sent for them and eventually results
in crash during free. This change makes sure that the payload
can accomodate upto 128 bit UUID.

This crash is observed while running TC_GAR_CL_BV_03_C Qual test
case.

Bug: 29011042
Change-Id: Ib2b41b769b394670099f4549f204e2972f7df876

8 years agoReject L2CAP INFO RSP and ECHO RSP on the LE signaling channel
Venkata Jagadeesh [Fri, 27 May 2016 10:06:20 +0000 (15:36 +0530)]
Reject L2CAP INFO RSP and ECHO RSP on the LE signaling channel

Steps:
Execute TC_LE_REJ_BI_02_C

Failure:
PTS stuck after sending INFO RSP, ECHO RSP on the LE signaling channel

Root Cause:
The Bluetooth stack is not rejecting INFO RSP, ECHO RSP even though
these commands are invalid for the LE signaling Channel.

Fix:
Reject the INFO RSP, ECHO RSP with error L2CAP_CMD_REJ_NOT_UNDERSTOOD.

Bug: 27852645
Change-Id: Ie09f658d606206cbdbea928e8cb6d10332743cf4

8 years agobtm: Restrict EXTENDED_INQUIRY_RESULT to 1 result
Myles Watson [Tue, 7 Jun 2016 23:14:18 +0000 (16:14 -0700)]
btm: Restrict EXTENDED_INQUIRY_RESULT to 1 result

The spec only allows one result per event.
Abort processing and return if the spec is not followed.

Bug: 29141745
Change-Id: Ic414b28adadec274779b0d953d12d499a619aff6
Signed-off-by: Myles Watson <mylesgw@google.com>
8 years agoFix invalid BDA parameter passing for connection parameter updates
Jakub Pawlowski [Fri, 3 Jun 2016 22:42:32 +0000 (15:42 -0700)]
Fix invalid BDA parameter passing for connection parameter updates

The BD_ADDR type is not a struct, just an array of bytes. Therefore,
Bind does not know how to store it for later execution, and just stores
the pointer to the first element, which is not valid at time of
execution.

Instead use bt_bdaddr_t, which is a struct. Bind will copy it's content
properly.

Change-Id: I4875aae4d7cbb809821d91a13554b8fdf310a7fe

8 years agoRemote device changes for SMP certification
Nitin Arora [Tue, 15 Mar 2016 22:00:36 +0000 (15:00 -0700)]
Remote device changes for SMP certification

Use Case:
Certification test cases for SMP require various scenarios
where the remote device needs to show a specific behavior
where it fails the pairing in a certain way, and the DUT is
required to abort the pairing properly.
In abcense of a proper PTS suite to execute these test cases,
we can use another device running the same host by configuring
certain run time property.

Test Cases:
TP/SCJW/BI-02-C
TP/SCJW/BV-02-C
TP/SCPK/BI-03-C
TP/SCPK/BI-04-C
TP/SCPK/BV-02-C
TP/SCPK/BV-03-C
TP/SCJW/BI-01-C
TP/SCCT/BV-01-C
TP/SCCT/BV-02-C
TP/SCPK/BI-01-C
TP/SCPK/BI-02-C
TP/SCPK/BV-04-C
TP/SCPK/BV-01-C

Fix:
Added a property in the bt_stack.conf file. The property name
is "SmpFailureCase". The values 2 to 6(inclusive), are forcausing SMP
failures with various failure reasons.
Failure case 1 and 9 are for producing error "Confirm value failure".
Cases 7 and 8 are for generating specific errors at pair cancel.

Note:
The default use of this feature is controlled using a compile
time flag BTM_BLE_SMP_CERTIFICATION.
The BTM_BLE_SMP_CERTIFICATION = TRUE is needed only while we
wait for the PTS support for the LE Secure connections.

Bug: 27852645
Change-Id: I1f7a8ff2659d85b5978b75870c57162a34d394d0

8 years agoClear BLE block from device records at unpair
Nitin Arora [Mon, 25 Apr 2016 21:47:51 +0000 (14:47 -0700)]
Clear BLE block from device records at unpair

Use Case:
Pair and unpair LE remote device repeatedly. The repair
intermittently fails with the error "DHKey Check Failure"

Failure:
Pairing failure is observed when pairing is performed
after unpairing, without performing a BT reset.
Further analysis of the SMP logs indicate that DUT uses the
static address of the remote device for calculation of the
MacKey value. At the time of pairing, the remote RPA should
be used (and the static address has not yet been distributed either).
The problem is caused by the previous dev record which is left in
the stack, and at the time of repair, stack picks the old device
record and reuses it.

Fix:
This change removes the entire BLE block from the device record,
after the unpairing is performed, so that a new device record
is allocated, after the repairing is done.

Bug: 27852645
Change-Id: I8d605d1bb3b1c32061a8d8a7a7fe0fe200030abc

8 years agoReset max_interval to BTM_BLE_CONN_INT_MIN_LIMIT
Eri Kasamatsu [Mon, 9 Nov 2015 05:40:02 +0000 (14:40 +0900)]
Reset max_interval to BTM_BLE_CONN_INT_MIN_LIMIT

In case of min_interval < BTM_BLE_CONN_INT_MIN_LIMIT
and max_interval < BTM_BLE_CONN_INT_MIN_LIMIT,
min_interval is reset to BTM_BLE_CONN_INT_MIN_LIMIT
but max_interval is not reset.
Then valid connection parameter updates can be rejected.

To avoid this, reset max_interval to BTM_BLE_CONN_INT_MIN_LIMIT
when max_interval is smaller than BTM_BLE_INT_MIN_LIMIT.

Change-Id: I5f54ddc0276f40d667ff433557b74ea4b100058d

8 years agoMerge "bt: Update libchrome APIs to r395517"
Luis Hector Chavez [Wed, 1 Jun 2016 21:50:00 +0000 (21:50 +0000)]
Merge "bt: Update libchrome APIs to r395517"

8 years agonet_test_bluetooth: RFCOMM test refactor
Ajay Panicker [Mon, 7 Dec 2015 22:18:16 +0000 (14:18 -0800)]
net_test_bluetooth: RFCOMM test refactor

Properly implement RFCOMM tests into net_test_rfcomm using GUnit.
Contains all the RFCOMM tests and the base class that the tests use.
This test currently requires the DUT to be paired with an HFP capable
device.

Bug: 25793348
Change-Id: I683db7c5f2779373b2e343c7ad21268e4969d014

8 years agoRemove currently unused peer device module and tests
Jakub Pawlowski [Sat, 28 May 2016 00:06:39 +0000 (17:06 -0700)]
Remove currently unused peer device module and tests

The module is currently not used and it is currently not obvious if this
should be a module in the first place.

Filed separate bug (#29057391) to re-visit the concept in a future
refactor, but removing unused code for now.

Bug: 29000421
Change-Id: Ie369574e62281fa1d7c3284c86c4509de558fa15

8 years agoBump HDP version to 1.1
Andre Eisenbach [Tue, 31 May 2016 21:18:36 +0000 (14:18 -0700)]
Bump HDP version to 1.1

Change-Id: I0bdec6fffa097dc919ee495216a2f272cc0dcf1e

8 years agoLimit number of SBC frames to fit into single MTU
Ayan Ghosh [Mon, 11 Nov 2013 13:55:16 +0000 (19:25 +0530)]
Limit number of SBC frames to fit into single MTU

- Calculate number of SBC frames to fit into single MTU for EDR capable
  remote devices. This makes sure the maximum utilization of the
  available bandwidth, keeping the bitrate at high quality.
- This change helps to address the discrepancy seen with a few available
  2 Mbps headsets which set the AVDTP media MTU size greater than the
  2DH5 packet payload size which eventually forces AVDTP packets to get
  fragmented in the controller. This change ensures packing of the SBC
  frames in a way that AVDTP packet size fits within the 2DH5 payload
  size.
- As packet size is restricted to meet the required bit rate more than
  one AVDTP packet can be sent to the controller in a given iteration
  based on the bit rate requirement.

Bug: 24875861
Change-Id: Icae7656ad563bbbdef65ecbfa15a89b26cf9edb2

8 years agoMerge "Update the HCI unit test if BT_CLEAN_TURN_ON_DISABLED is TRUE"
Treehugger Robot [Fri, 27 May 2016 20:01:16 +0000 (20:01 +0000)]
Merge "Update the HCI unit test if BT_CLEAN_TURN_ON_DISABLED is TRUE"

8 years agoUpdate the HCI unit test if BT_CLEAN_TURN_ON_DISABLED is TRUE
Pavlin Radoslavov [Fri, 27 May 2016 19:07:06 +0000 (12:07 -0700)]
Update the HCI unit test if BT_CLEAN_TURN_ON_DISABLED is TRUE

Bug: 28614494
Change-Id: I3f4a923f9e14faef57b2d694bfc253fd10749414

8 years agoFix misc-macro-parentheses warnings in embdrv/sbc.
Chih-Hung Hsieh [Fri, 20 May 2016 17:22:12 +0000 (10:22 -0700)]
Fix misc-macro-parentheses warnings in embdrv/sbc.

When compiled with WITH_TIDY=1, clang-tidy warns about
missing parameters around macro parameters.

Bug: 28705665
Change-Id: I79d234b88e090137412936b80303d21f0c59b0ae

8 years agoFix misc-macro-parentheses warnings
Chih-Hung Hsieh [Fri, 20 May 2016 17:29:31 +0000 (10:29 -0700)]
Fix misc-macro-parentheses warnings

When compiled with WITH_TIDY=1, clang-tidy warns about
missing parameters around macro parameters.

Bug: 28705665
Change-Id: I89c23cfe6eaefae5ef3c648a7c123c0501662c13

8 years agoDO NOT MERGE Randomize allocation canary
Marie Janssen [Fri, 4 Mar 2016 01:50:26 +0000 (17:50 -0800)]
DO NOT MERGE Randomize allocation canary

A static allocation canary can be susceptible to buffer overflow
exploit code bypassing, so this randomizes it on every run.

Bug: 27411268
Change-Id: I81b06f89951a012c08d846042653ec957f3e9127
(cherry picked from commit 7c054350fb7da9da1fdb86e7f7b9a801cf1c39e4)

8 years agoFix GATT attribute value allocation
Andre Eisenbach [Fri, 27 May 2016 00:13:42 +0000 (17:13 -0700)]
Fix GATT attribute value allocation

new type(arg) != new type[arg].... :'(

Bug: 28888632
Change-Id: I5adb2d21b8c77f9edf6ff22f56341358bfec817e

8 years agobt: Update libchrome APIs to r395517
Luis Hector Chavez [Sat, 21 May 2016 06:10:00 +0000 (23:10 -0700)]
bt: Update libchrome APIs to r395517

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Change-Id: Idb7365dd5b0b66c3926fc07b2264c9bc3477ae20

8 years agoMerge "test_vendor_lib: Add initial support for BLE"
Treehugger Robot [Thu, 26 May 2016 23:10:11 +0000 (23:10 +0000)]
Merge "test_vendor_lib: Add initial support for BLE"

8 years agoDo not allow LE connection timeout smaller than 1s for HID devices
Jakub Pawlowski [Thu, 26 May 2016 22:13:04 +0000 (15:13 -0700)]
Do not allow LE connection timeout smaller than 1s for HID devices

Bug: 28979841
Change-Id: I520608a13224601fb9101d00c08b34cdb0f8d374

8 years agoLinux build fix
Jakub Pawlowski [Thu, 26 May 2016 22:03:57 +0000 (15:03 -0700)]
Linux build fix

Change-Id: Iae3d7d77dda70a288022d81a5f3c8f156b95adc9

8 years agoConvert GATT related BTA code to C++
Jakub Pawlowski [Thu, 26 May 2016 18:08:21 +0000 (11:08 -0700)]
Convert GATT related BTA code to C++

Change-Id: I9c36d0ebeb1143395b3b38b3d179d12a9503d28a

8 years agoRemove all mentions of hashmap
Jakub Pawlowski [Thu, 26 May 2016 17:20:59 +0000 (10:20 -0700)]
Remove all mentions of hashmap

Change-Id: I4594c401d91c6d5e2626ca92593f0f29833844ab

8 years agoReplace hash_map in data_dispatcher with C++ unordered_map
Jakub Pawlowski [Thu, 26 May 2016 17:13:40 +0000 (10:13 -0700)]
Replace hash_map in data_dispatcher with C++ unordered_map

Change-Id: Ic8d99108fd557a1d994dcea5a2bf92aef98a0cac

8 years agoReplace hash_map in audio_a2dp_hw with C++ unordered_map
Jakub Pawlowski [Thu, 26 May 2016 00:49:32 +0000 (17:49 -0700)]
Replace hash_map in audio_a2dp_hw with C++ unordered_map

Change-Id: I64c7f72c91558bbbd2e31967d10733e0b98faa7e

8 years agoReplace hash_map in btm_ble_bgconn with C++ unordered_map
Jakub Pawlowski [Thu, 26 May 2016 00:10:56 +0000 (17:10 -0700)]
Replace hash_map in btm_ble_bgconn with C++ unordered_map

Change-Id: I19b99b88d6dbcf6d6425d102bf908038c09325cb

8 years agoReplace hash_map in peer with C++ unordered_map
Jakub Pawlowski [Wed, 25 May 2016 23:15:22 +0000 (16:15 -0700)]
Replace hash_map in peer with C++ unordered_map

Change-Id: Iae48d18cc370221c425b337fefb3a8255cda759a

8 years agoReplace hash_map in module_manager with C++ unordered_map
Jakub Pawlowski [Wed, 25 May 2016 22:53:45 +0000 (15:53 -0700)]
Replace hash_map in module_manager with C++ unordered_map

Change-Id: I9ee3c9349a5ea80f17f65a137d7fe7be5dc63e70

8 years agoReplace hash_map in packet_fragmenter with C++ unordered_map
Jakub Pawlowski [Wed, 25 May 2016 22:33:41 +0000 (15:33 -0700)]
Replace hash_map in packet_fragmenter with C++ unordered_map

Change-Id: I7707d21c44a5b8a18c925892d950155e3be72c30

8 years agoRemove unnecesarry hash_map includes
Jakub Pawlowski [Wed, 25 May 2016 21:46:19 +0000 (14:46 -0700)]
Remove unnecesarry hash_map includes

Change-Id: I929b2ec88e33643f128a3a72130bdb091e0b2143

8 years agoFix allocation_tracker crashes
Jakub Pawlowski [Wed, 25 May 2016 17:37:17 +0000 (10:37 -0700)]
Fix allocation_tracker crashes

Use C++ unordered_map in allocation_tracker.

Bug: 28888632
Change-Id: I15204b0bede5686af25fc6cdd05ce3097b436dd6

8 years agotest_vendor_lib: Add initial support for BLE
Myles Watson [Tue, 24 May 2016 16:52:51 +0000 (09:52 -0700)]
test_vendor_lib: Add initial support for BLE

Change-Id: If0d8e07ee0c76ed5f22c5f111b7e7be7f28c7bc3

8 years agoRemove the RFComm MCB from the ports when releasing it
Pavlin Radoslavov [Thu, 26 May 2016 01:08:29 +0000 (18:08 -0700)]
Remove the RFComm MCB from the ports when releasing it

Bug: 28849621
Change-Id: I3ce1c857d0d0a2c00c59d8f71b40685ae602dc29

8 years agoMerge "Remove unused profile manager"
Jakub Pawlowski [Thu, 26 May 2016 01:03:33 +0000 (01:03 +0000)]
Merge "Remove unused profile manager"

8 years agoRemove unused profile manager
Jakub Pawlowski [Wed, 25 May 2016 23:30:29 +0000 (16:30 -0700)]
Remove unused profile manager

Change-Id: Ib718117b523030a4cf5a33672d5523c19fe79431

8 years agotest_vendor_lib: run clang-format with brillo opts
Myles Watson [Wed, 25 May 2016 21:44:57 +0000 (14:44 -0700)]
test_vendor_lib: run clang-format with brillo opts

Change-Id: Ie2ead0a020e2358696a2f0e26f3c76a9dd29e266
Signed-off-by: Myles Watson <mylesgw@google.com>
8 years agoImprove config file sync during configuration save.
Jacky Cheung [Wed, 18 May 2016 22:41:09 +0000 (15:41 -0700)]
Improve config file sync during configuration save.

Add fsync() calls to force sync to disk while saving configuration
file.  It is necessary to do a sync on the temp file before rename,
and to sync again on its parent directory to ensure both the
file content and the directory are up-to-date.

Change-Id: I3a862ad59c8ae5beb8ea2c727eb5f275a2d5823e

8 years agoDon't disconnect on failure to register for service changed notification
Jakub Pawlowski [Mon, 23 May 2016 21:47:48 +0000 (14:47 -0700)]
Don't disconnect on failure to register for service changed notification

Bug: 28721625
Change-Id: I2214fb2576f0f0794922ed9b47d8805839d69bfd

8 years agoFix the timestamp in btsnoop format
Ben YoungTae Kim [Mon, 23 May 2016 23:15:07 +0000 (16:15 -0700)]
Fix the timestamp in btsnoop format

Due to overflow, timestamp does not have correct value.
Make sure it should be saved in long long type as 64bit.

Change-Id: Iaf1b1dd746dd52ab7e50b870efacde2b8dd0bed6
Signed-off-by: Ben YoungTae Kim <ytkim@qca.qualcomm.com>
8 years agoAdd L2CAP signaling headers and more ACL data to btsnooz
Andre Eisenbach [Tue, 17 May 2016 04:49:23 +0000 (21:49 -0700)]
Add L2CAP signaling headers and more ACL data to btsnooz

Increase the BTSNOOZ log buffer to 256kb and adds complete L2CAP
signaling headers as well as more data per ACL data packet. This will
allow additional RFCOMM debugging.

Fixes: 28845518
Change-Id: I19e1a4a40bb1c8d332a25283fb50635d791bc275

8 years agoAdd a missing OSI_NO_INTR() wrapper around socket read()
Pavlin Radoslavov [Wed, 18 May 2016 22:22:55 +0000 (15:22 -0700)]
Add a missing OSI_NO_INTR() wrapper around socket read()

Also, print a better error message.

Change-Id: I22da05fd5e9b10a5122705105ea7a45855eb144d

8 years agoImprove poll(2) handling and log messages
Pavlin Radoslavov [Wed, 18 May 2016 21:34:31 +0000 (14:34 -0700)]
Improve poll(2) handling and log messages

 * Better error handling and log messages inside
   uipc_flush_ch_locked()
 * Add missing error check inside UIPC_Read()
 * Add missing OSI_NO_INTR() wrapper around poll()
   inside function btu_exec_tap_fd_read()

Bug: 28823662
Change-Id: I5f1c720861bea594d53ed6465a5ff327ba352598

8 years agoAdd error log messages for A2DP commands
Pavlin Radoslavov [Wed, 18 May 2016 21:30:53 +0000 (14:30 -0700)]
Add error log messages for A2DP commands

Bug: 28823662
Change-Id: Ifa9950dd2277b444bedd5108beff2db029a5ed93

8 years agoAdd a log message to capture NULL pointer in l2c_link_hci_disc_comp()
Pavlin Radoslavov [Tue, 17 May 2016 00:14:03 +0000 (17:14 -0700)]
Add a log message to capture NULL pointer in l2c_link_hci_disc_comp()

Added a log message inside l2c_link_hci_disc_comp() to help capture
a NULL pointer p_lcb->p_fixed_ccbs[xx] that triggers SIGSEGV crash.
Also, updated the typedef of bdstr_t and moved it to
file "btcore/include/bdaddr.h"

Bug: 28765514
Change-Id: Iacd9376cfb9e18b58e18865581da8edad9f68821

8 years agoMerge "HID: Prevent incoming and outgoing SDP collision"
Treehugger Robot [Tue, 17 May 2016 19:21:54 +0000 (19:21 +0000)]
Merge "HID: Prevent incoming and outgoing SDP collision"

8 years agoMerge "Fix pairing state change in collision scenario"
Treehugger Robot [Tue, 17 May 2016 18:38:56 +0000 (18:38 +0000)]
Merge "Fix pairing state change in collision scenario"

8 years agoHID: Prevent incoming and outgoing SDP collision
Hemant Gupta [Wed, 7 Oct 2015 06:38:10 +0000 (12:08 +0530)]
HID: Prevent incoming and outgoing SDP collision

SDP is performed 2 times as part of HID connection in BD stack,
one after successful authentication, and one in HID stack layer
as SDP data is not stored currently in stack. When there is outgoing and
incoming connections, SDP failed message was posted which was resulting
in SDP failure for HID host resulting in improper disconnection of
HID interrupt channel.

Change-Id: I5b4813dc916696e2c0f76be27a85c1a89c2d8be0

8 years agoMerge "Check CCB state before executing channel state machine events"
Treehugger Robot [Tue, 17 May 2016 18:09:14 +0000 (18:09 +0000)]
Merge "Check CCB state before executing channel state machine events"

8 years agoFix pairing state change in collision scenario
venkata Jagadeesh [Thu, 1 Oct 2015 06:25:03 +0000 (11:55 +0530)]
Fix pairing state change in collision scenario

Symptom:
DUT Stuck in pairing state forever with selfy stick
during repair.

Steps:
1. Pair and connect remote devices with DUT.
2. Now un pair selfy stick from DUT.
3. Keep remote in discoverable mode.
4. Start inquiry and try to pair with device.

Failure:
Pairing with selfy stick always fails after collision.

Root Cause:
As we return from btm_sec_dd_create_conn with out
moving pairing state in connection collision scenario. Pairing
state will remains idle and pairing won't proceed further.

Fix:
Move the pairing state in collision scenario so that pairing
can proceed further.

Change-Id: Ic5c446ad3902b0ce16c7223ec2d8e4a625831446

8 years agoIncreasing LE Properties to broadcast.
Balraj Selvaraj [Wed, 6 Jan 2016 05:48:32 +0000 (11:18 +0530)]
Increasing LE Properties to broadcast.

Use case: Remote BD_NAME is not broadcasted when BLE device
pairing is done by using NFC where we broadcasted only UUID.

steps:
Connect with BLE device by using NFC and check the remote name.

Failure: Remote device name is not available.

Root cause: BD_NAME is not broadcasted when BLE device pairing
is done.

Fix: Added property to broadcast remote BD_NAME also as part
BLE device pairing using NFC.

Change-Id: Ie6cda489aabff15a0ebbc692a16f9428729a7dba

8 years agoCheck CCB state before executing channel state machine events
Gurpreet Ghai [Sun, 13 Mar 2016 16:18:30 +0000 (21:48 +0530)]
Check CCB state before executing channel state machine events

Use Case:
When a disconnect response is being executed, a timeout may
occur and timeout event gets enqueued in BTU process. When
processing of the disconnect event completes, timout event is received
at csm and is executed. However, by this time the Channel
Control Block is already released during previous event causing
errors.

Steps:
Various connection/disconnection scenario.

Failure:
If ccb is already released while processing of
previous event, the occurance of new enqueued event causes
crash.

Root cause:
Disconnection response event has already released
ccb and set lcb for this channel to null. The occurance of
timer event after this results in crash because lcb is
dereferenced while header creation to send disc response to
peer device.

Fix:
Added check for ccb state for whether it is currently in
use or released before executing events in csm.

Change-Id: I9110e6dd5273fa162b51c8aa15bd0030567d664b

8 years agoL2CAP: Handle invalid HCI packets
Matadeen Mishra [Wed, 3 Feb 2016 12:43:39 +0000 (18:13 +0530)]
L2CAP: Handle invalid HCI packets

- Handled Buffer over flow for uint16_t
- Discard invalid HCI packets from Codenomican test
  tool as data length and actual data not matching
  during reassembly

Use case:
Execute L2CAP test suit from Defensics Codenomican

Steps:
1. Pair and connect DUT to Codenomican tool
2. Execute L2CAP test suit from Defensics Codenomican

Failure:
Crash observed on DUT and Codenomican tool stuck in execution.

Root cause:
Codenomican tool sending invalid HCI packets to DUT and
there are no checks to handle buffer over flow and other invalid data
from Codenomican tool.

Change-Id: I6f93c80244fc39d607ad285185136bbbca83d7ae

8 years agoDon't process pair request when controller is not ready
Srinu Jella [Thu, 24 Sep 2015 07:53:36 +0000 (13:23 +0530)]
Don't process pair request when controller is not ready

Use case: when one application is trying to pair and
other application is turning off Bluetooth.

Steps: when one application is trying to pair and
other application is turning off Bluetooth.

Failure: Bluetooth process crashed.

Root Cause: Bluetooth process crashed due to assertion,
as controller module is not ready.

Fix: Made a checks for controller module is ready or not, If
it is ready then only go for pairing.

Change-Id: I72c72f6b5545c845e79874212359854023ffad98

8 years agoGAP: Save pin code length for incoming legacy SAP connection
venkata Jagadeesh [Wed, 2 Sep 2015 13:55:33 +0000 (19:25 +0530)]
GAP: Save pin code length for incoming legacy SAP connection

Use case: Carkit cannot reconnect to DUT in Sim Access Profile mode

Steps:
1. Pair with a car-kit (Agree all SAP, MAP, PBAP requests)
2. Initiate disconnection on DUT
3. Initiate re-connection on the car-kit.

Failure: SAP profile reconnection failing as dut gives negetive
linkkey reply.

Root Cause: sec_flags not getting updated without pin len and stack
triggering negative link key reply even linkkey is proper for 16 digit
authentication of SAP.

Fix: Save pin length during BTM_PINCodeReply.

Change-Id: I8300dd3ff497058291143313b169190910e0a7c5

8 years agoPrevent crash due to second attempt to clean up eager_reader
Srinu Jella [Tue, 29 Sep 2015 14:37:42 +0000 (20:07 +0530)]
Prevent crash due to second attempt to clean up eager_reader

Null out the eager readers once they are cleaned up, so we
don't try to clean them up later if an error occurs opening
the HAL again later.

Change-Id: I07df1010a1a619cb67b306d64e274d450234a002

8 years agobtif: Remove dead code from btif_storage
Marie Janssen [Mon, 16 May 2016 20:51:31 +0000 (13:51 -0700)]
btif: Remove dead code from btif_storage

Change-Id: I3ee4d8fd3a7697e0113d955982b21db123354a86

8 years agoAdd missing arguments to log messages
Pavlin Radoslavov [Sat, 14 May 2016 04:10:22 +0000 (21:10 -0700)]
Add missing arguments to log messages

Bug: 28769522
Change-Id: I37c2b8400619646a8711099cf0bd369c3cf8eb51

8 years agoAdd missing include for OSI_NO_INTR
Stefan Stanacar [Mon, 16 May 2016 11:25:39 +0000 (14:25 +0300)]
Add missing include for OSI_NO_INTR

Fixes building bt_vendor_linux since
OSI_NO_INTR is defined in osi.h

Change-Id: Ib95a3126ed4a7b8f0bdc7db3dd2ef162825f2cbe
Signed-off-by: Stefan Stanacar <stefan.stanacar@intel.com>
8 years agoFail gracioulsy when GATT_MAX_APPS reached
Jakub Pawlowski [Fri, 13 May 2016 20:09:08 +0000 (13:09 -0700)]
Fail gracioulsy when GATT_MAX_APPS reached

Bug: 28677905
Change-Id: I092494ab3f9e9ae4330d5d2a6f6ef010c61fe2a4

8 years agoaudio HAL: improve control socket error handling
Eric Laurent [Thu, 12 May 2016 01:18:54 +0000 (18:18 -0700)]
audio HAL: improve control socket error handling

Implement retry upon control socket receive error
in a2dp_ctrl_receive() if EAGAIN or EINTR.

Implement recovery from previous socket error in
a2dp_command().

Increase socket receive timeout to account for
headsets will long activation time.

Fixed state update error in start_audio_datapath()
in case the data socket is already opened.

Added missing mutex around state updated in oput_write()
and in_read()

Made read and write code symmetric.

Bug: 28727517
Change-Id: I68d7fe63f298bbd1e387ec42fdb1277b2dcdfef5

8 years agoRestart failed system calls interrupted with errno of EINTR
Pavlin Radoslavov [Thu, 12 May 2016 18:36:44 +0000 (11:36 -0700)]
Restart failed system calls interrupted with errno of EINTR

In number of places we don't handle properly system calls failures
when the errno is EINTR (i.e., the system call was interrupted
by a signal). In all our use cases, the system calls should be
restarted. The handling of the following system calls (as used in the code)
has been updated/fixed:

  poll, send, recv, sendmsg, nanosleep, epoll_wait
  read - mostly (e.g., socket-like fds)
  write - mostly (e.g., socket-like fds)
  select, accept, connect

Bug: 28471477
Bug: 28658141
Change-Id: I03e6f0f67e33876780fb6d02c33eb84547ba8f95

8 years agoAdd sync to write the backup file to the filesystem
Ajay Panicker [Thu, 12 May 2016 22:52:01 +0000 (15:52 -0700)]
Add sync to write the backup file to the filesystem

Bug: 27354612
Change-Id: I5a7751b6f08831d43647391774501f211336e9eb

8 years agoBuild fix for feldspar-dev
Jakub Pawlowski [Thu, 12 May 2016 22:02:55 +0000 (15:02 -0700)]
Build fix for feldspar-dev

Bug: 28485365
Change-Id: I25db2fe7577e98715eb10e105176c536fddb043a

8 years agoAdd config logging, make parsing stricter, and move sync
Ajay Panicker [Thu, 12 May 2016 18:03:39 +0000 (11:03 -0700)]
Add config logging, make parsing stricter, and move sync

The functions that parse the config file will report failure if
the config file is improperly formatted or is missing the necessary
Adapter section. Also moved sync to sync the filesystem after the
config file is saved.

Bug: 27354612
Change-Id: Ia75ff628d83bdc933c4bc16761d6c55eef19b757

8 years agoMerge "btif: only save config when bonded devices change"
Treehugger Robot [Thu, 12 May 2016 20:51:59 +0000 (20:51 +0000)]
Merge "btif: only save config when bonded devices change"

8 years agoRemove dead HID code
Jakub Pawlowski [Thu, 12 May 2016 16:24:38 +0000 (09:24 -0700)]
Remove dead HID code

This patch removes dead code in HID related to setting scan parameters
on remote device.

Change-Id: I96e0036b65d2ebb3b099d817683ed3d5a11b6bb7

8 years agobtif: only save config when bonded devices change
Marie Janssen [Wed, 11 May 2016 21:58:48 +0000 (14:58 -0700)]
btif: only save config when bonded devices change

Bug: 27354612

Change-Id: I15f816c85d3ab1991abf076f7c1ae2914d773d54

8 years agoRename all *.cpp files to *.cc to follow new style
Jakub Pawlowski [Thu, 12 May 2016 18:16:46 +0000 (11:16 -0700)]
Rename all *.cpp files to *.cc to follow new style

Change-Id: Ia79ee09348e67ff4a1712ee11a1e8480180a2623

8 years agoRewrite btif_gatts_register_app to new style
Jakub Pawlowski [Thu, 5 May 2016 18:16:00 +0000 (11:16 -0700)]
Rewrite btif_gatts_register_app to new style

Bug: 28485365
Change-Id: I5b9bd5a807492b254a5486c80dfb56769e95943f

8 years agoRewrite btif_gatts_open to new style
Jakub Pawlowski [Thu, 5 May 2016 18:09:12 +0000 (11:09 -0700)]
Rewrite btif_gatts_open to new style

Bug: 28485365
Change-Id: I20fdb5ffe6d52db291e9862f7e24fb43e060950f

8 years agoRewrite btif_gatts_close to new style
Jakub Pawlowski [Thu, 5 May 2016 18:03:32 +0000 (11:03 -0700)]
Rewrite btif_gatts_close to new style

Bug: 28485365
Change-Id: Ib8d7ed81cf958ab3dd5403c46409cbd506ac3dc1

8 years agoRewrite btif_gatts_add_included_service to new style
Jakub Pawlowski [Thu, 5 May 2016 17:47:14 +0000 (10:47 -0700)]
Rewrite btif_gatts_add_included_service to new style

Bug: 28485365
Change-Id: I4465493532578942045b979e542608972c5fa2ec

8 years agoRewrite btif_gatts_start_service to new style
Jakub Pawlowski [Thu, 5 May 2016 17:40:17 +0000 (10:40 -0700)]
Rewrite btif_gatts_start_service to new style

Bug: 28485365
Change-Id: I2c8b02ce42fd2bde3a4c448f6fb19ef8e3eb169a

8 years agoRewrite btif_gatts_stop_service to new style
Jakub Pawlowski [Thu, 5 May 2016 17:17:02 +0000 (10:17 -0700)]
Rewrite btif_gatts_stop_service to new style

Bug: 28485365
Change-Id: I79aaaa57139dca373fdf7c0424353cd5de0cb48f

8 years agoRewrite btif_gatts_send_indication to new style
Jakub Pawlowski [Thu, 5 May 2016 17:09:44 +0000 (10:09 -0700)]
Rewrite btif_gatts_send_indication to new style

Bug: 28485365
Change-Id: I1d3221be272e53245e09077dad9d291829350b45

8 years agoRewrite btif_gatts_send_response to new style
Jakub Pawlowski [Thu, 5 May 2016 17:03:35 +0000 (10:03 -0700)]
Rewrite btif_gatts_send_response to new style

Bug: 28485365
Change-Id: Id0dbfe28b0f77f542cd6961c041e70f90d0aa78b