OSDN Git Service

android-x86/system-bt.git
7 years agoMerge changes from topic 'beautiful-gatt-server'
Jakub Pawlowski [Wed, 3 Aug 2016 10:21:43 +0000 (10:21 +0000)]
Merge changes from topic 'beautiful-gatt-server'

* changes:
  GATT Server refactoring (4/4)
  Add C++ Parcelable types for Service, Characteristic, Descriptor

7 years agoMerge "Fix build when SMP_DEBUG=TRUE plus logging improvements"
Treehugger Robot [Mon, 1 Aug 2016 22:29:31 +0000 (22:29 +0000)]
Merge "Fix build when SMP_DEBUG=TRUE plus logging improvements"

7 years agoGATT Server refactoring (4/4)
Jakub Pawlowski [Sat, 26 Mar 2016 07:47:23 +0000 (00:47 -0700)]
GATT Server refactoring (4/4)

Right now in order to add gatt service, we need to add it piece by
piece - each characteristic and descriptor separately. This causes lots
of concurrency errors in higher layers. Instead accept whole service
definition and start whole service at once.

Also, use handles to identify GATT server attributes. It's already done
on clinet side.

Bug: 27999121
Change-Id: I42c796809423d116fe6755ef8b1c40da270427a5

7 years agoAdd C++ Parcelable types for Service, Characteristic, Descriptor
Jakub Pawlowski [Tue, 24 May 2016 19:42:45 +0000 (12:42 -0700)]
Add C++ Parcelable types for Service, Characteristic, Descriptor

This types will be used in upcoming GATT Client/Server code. They will
match ones you can found in frameworks/base.

Change-Id: I6080310a726bcbcd0cd36970712928b188f7bd24

7 years agoFix build when SMP_DEBUG=TRUE plus logging improvements
Jakub Pawlowski [Thu, 28 Jul 2016 13:11:36 +0000 (06:11 -0700)]
Fix build when SMP_DEBUG=TRUE plus logging improvements

Bug: 30460956
Change-Id: I2611501d1961b104c8e66b1a3fca414936dc321f

7 years agoRelax some of the timing parameters in the Alarm unit tests
Pavlin Radoslavov [Thu, 28 Jul 2016 20:11:10 +0000 (13:11 -0700)]
Relax some of the timing parameters in the Alarm unit tests

In certain environments (e.g., virtual machines), the alarm timeouts
can late by tens of ms (40ms have been observed in some cases).
Relaxing some of the unit tests timing parameters, so we can
continue testing for correctness as covered by the AlarmTest.

Bug: 28907913
Change-Id: I211c36a689774c5cdf427039e4c9184cf4147604

7 years agoProper handling of AV connection collision
Ayan Ghosh [Fri, 22 Jul 2016 09:41:11 +0000 (15:11 +0530)]
Proper handling of AV connection collision

Use case:
1. Pair to Remote
2. Turn OFF/ON BT on DUT
3. After DUT's BT is turned ON, Remote would reconnect to DUT

Failure:
  Bluetooth settings UI continues to display Connecting when
  BT was Turned OFF and ON.

Root cause:
- This is a connection collision case where remote is not responding
  to DUT initiated SDP attribute fetch request for AV. AV holds outgoing
  connection for sometime and meanwhile remote starts AV connection
  from its end. Then DUT disconnects the SDP channel after a second
  without waiting to fetch requested info, and this confuses DUT's AV
  state machine. The outgoing connection could not proceed as incoming
  AV L2CAP connects, because DUT's AV state machine is not equipped
  with handling this scenario. On incoming connection timer expiry, it
  does not start AV media channel as it finds AV Open has not been done
  from upper layer after incoming L2CAP got connected.

- When the incoming path 2s timer expires, the DUT checks whether Open
  has been called after incoming state is set. This is not the case here,
  because Open was triggered earlier as as part of the outgoing
  connection. As a result, A2DP cannot connect at all.

Fix:
- Properly set collision flags for handling AV connection collision.
- Update BTA AV handle even when BTIF AV state machine is yet to be built.

Bug: 30362987
Change-Id: I02a3adb62479b0f762bc792a5727d06e11eaaa52

7 years agoAllow the Bluetooth test library to be used as a vendor library
Greg Hartman [Tue, 26 Jul 2016 03:22:48 +0000 (20:22 -0700)]
Allow the Bluetooth test library to be used as a vendor library

Change-Id: I479fd72482399f878ef045271c7b493c94aa5ab7

7 years agobtif: Fix logic bug within register_application
Greg Kaiser [Mon, 27 Jun 2016 18:27:09 +0000 (11:27 -0700)]
btif: Fix logic bug within register_application

We were checking for the SINK bit twice in the same condition,
and would incorrectly report a SINK only mask as a DUAL device,
and would never hit the logic path to report a device as SINK.

Bug: 29763285
Change-Id: Ibc39db6396c09ddcd63896302dabf72841304cf2

7 years agoDon't use move in FOR_EACH_* macro
Jakub Pawlowski [Wed, 20 Jul 2016 10:12:49 +0000 (03:12 -0700)]
Don't use move in FOR_EACH_* macro

FOR_EACH_* macros are resolved to for loop. Using std::move inside it
will cause already moved object to be used when more than one observer
is registered. This patch fixes that.

Change-Id: Iaaa314f5eeed4094d1e0fc951d3664fb1514ba15

7 years agoMake parameter set S4 default for eSCO
Andre Eisenbach [Fri, 15 Jul 2016 17:50:32 +0000 (10:50 -0700)]
Make parameter set S4 default for eSCO

Bug: 29615817
Change-Id: I5256b31a746433f10c2e7de1629952f668c99d16
(cherry picked from commit af5b8248593c80acd8b1afb695eafe5801b44f7d)

8 years agoProcess Gatt read multiple response properly
Subramanian Srinivasan [Mon, 16 May 2016 18:14:03 +0000 (11:14 -0700)]
Process Gatt read multiple response properly

The Gatt server multi response queue is made NULL after each Gatt
server response is sent by BT stack in response to the remote Gatt
client's request. But the multi response queue is not initialized
again to process subsequent read multiple Gatt server responses.
Hence, the BT stack does not send Gatt server responses for the
subsequent read multiple requests from remote device which inturn
leads to disconnection. This change would process read multiple
responses by initializing the queue when it is null.

Some of Bluetooth certification test cases involve testing
Gatt server's capability to process and send read multiple
response.

Test case: TC_GAR_SR_BV_05_C

This change also cleans up unnecessary initialization and freeing
of multi rsp queue. This change makes sure that the stack initializes
multi rsp queue only when it is necessary(ie only when the Gatt
multiple read response is being processed).

Bug: 29011255

Change-Id: Ia3e2e1569ee16cac9c518f95501945257b9fb7fd

8 years agoFix linux build, missing strlcpy
Jakub Pawlowski [Thu, 14 Jul 2016 11:55:18 +0000 (04:55 -0700)]
Fix linux build, missing strlcpy

Compilation was failing with "missing strlcpy", this patch fixes that

Change-Id: Ic35d4bf4bed065fce27250a2d63d2fff606f6a3e

8 years agoUpdate libchrome BUILD.gn
Jakub Pawlowski [Thu, 14 Jul 2016 11:53:30 +0000 (04:53 -0700)]
Update libchrome BUILD.gn

Update BUILD.gn to match libchrome from top of AOSP.

Change-Id: I1d8638d67f816479e58af627ab5bd00649b72697

8 years agoAdd OnConnectionStateChanged to IBluetoothGattServerCallback
Jakub Pawlowski [Thu, 7 Jul 2016 23:40:11 +0000 (16:40 -0700)]
Add OnConnectionStateChanged to IBluetoothGattServerCallback

Currently native GattServer clients can't tell wether someone connected
or disconnnected to the device. This patch fixed that, by exposing
OnConnectionStateChangedCallback

Bug: 29835693
Change-Id: Ia7ef592f4031d021ab1b45808126ca57f9348d0e

8 years agoFix the implementation of macro BTM_IS_PUBLIC_BDA()
Chih-Hung Hsieh [Fri, 8 Jul 2016 17:29:55 +0000 (10:29 -0700)]
Fix the implementation of macro BTM_IS_PUBLIC_BDA()

Bug: 28705665
Change-Id: Id714a799c649ff85cf8bab9d8370626606fa7f2c

8 years agoDisable auto-pairing for hands-free devices
Andre Eisenbach [Thu, 7 Jul 2016 16:58:59 +0000 (09:58 -0700)]
Disable auto-pairing for hands-free devices

Fixes: 30004157
Change-Id: Id170856fbee5ea345f02f55d3a6e3376d846c2de
(cherry picked from commit e8b81851c33095fe3b3ac78329073309be5421e1)

8 years agoAdd callbacks to GATT read/write operation
Jakub Pawlowski [Fri, 13 May 2016 23:39:25 +0000 (16:39 -0700)]
Add callbacks to GATT read/write operation

There is no need for read/write callback to be a global event. It should
execute local callback instead.

Change-Id: Id7e915af9d30092d2f754eddc7c3aed4970eeb2f

8 years agoAdd logs for AVRCP commands that originate from a remote device
Ajay Panicker [Wed, 29 Jun 2016 23:39:07 +0000 (16:39 -0700)]
Add logs for AVRCP commands that originate from a remote device

Change-Id: I02b213913685d831bfe00e1938baef953428e048

8 years agoMerge "SMP: Delay authorization complete."
Jacky Cheung [Fri, 1 Jul 2016 20:23:35 +0000 (20:23 +0000)]
Merge "SMP: Delay authorization complete."

8 years agoFix google-explicit-constructor warnings in system/bt.
Chih-Hung Hsieh [Thu, 30 Jun 2016 22:45:24 +0000 (15:45 -0700)]
Fix google-explicit-constructor warnings in system/bt.

* Declare conversion constructors as 'explicit'.
* Add NOLINT to implicit converters.

Bug: 28341362
Change-Id: I81fecf19c0ee2e64dd6778b3dea78e04f111bfb4
Test: build with clang-tidy

8 years agoLog RSSI when A2DP buffers are flushed
Andre Eisenbach [Wed, 29 Jun 2016 19:46:13 +0000 (12:46 -0700)]
Log RSSI when A2DP buffers are flushed

To add another datapoint and potentially narrow down *why* we had to
flush the buffers, add RSSI logging to keep track of signal strength
during audio drop-out events.

Change-Id: Ie52f56290951130165a9f375a898a9bacf459d55

8 years agoA2DP media task: Flush full TX queue on congestion
Andre Eisenbach [Thu, 23 Jun 2016 23:14:53 +0000 (16:14 -0700)]
A2DP media task: Flush full TX queue on congestion

Currently, our TX queue does not allow for quick recovery of minor
congestion. As we only clear as much room in the queue as is needed to
fix the news frames needed for a given timer tick, any minor congestion
on the TX path can result in single frames to be dropped over an
excessively long amount of time.

From the "just rip the band-aid off" school of thought, drop the whole
queue instead to cause a single drop-out on congestion and catch up to
the live stream immediately, hoping that the stream recovers...

Bug: 29601962
Change-Id: I482c3cfef6d8b51143e54733eb2da5f70663636f
(cherry picked from commit d881c4b46776fe03a5861a3021bbe739b1f3cc58)

8 years agoSMP: Delay authorization complete.
Jacky Cheung [Tue, 17 May 2016 20:42:43 +0000 (13:42 -0700)]
SMP: Delay authorization complete.

Delay authorization complete during Bond Pending state in SMP.
Instead of automatically advancing the Bond Pending state, create
a 500ms window to allow the slave to stop pairing by sending over
the Pairing Failed command during the Bond Pending state.

BUG: 28475887
Change-Id: Ie59ff23128b5d523aa13c4db599be97396097cc3

8 years agoAdd BT_HCI_TIMEOUT and BT_CONFIG_SOURCE log events.
Jacky Cheung [Mon, 23 May 2016 19:39:01 +0000 (12:39 -0700)]
Add BT_HCI_TIMEOUT and BT_CONFIG_SOURCE log events.

These events are used to track HCI timeout and configuration file
usage respectively.

Change-Id: I5c8b6ef20b61f03b9ccb74f3b1c9784e4653b770

8 years agoSimplify GATT characteristic read memory handling
Jakub Pawlowski [Sat, 25 Jun 2016 00:06:41 +0000 (17:06 -0700)]
Simplify GATT characteristic read memory handling

Pass read result in a fixed sized array instead of a pointer.
This eliminates the need for any special memory management in btif.

Change-Id: I2a33d74b12f3059050855c9fc90fff785cc985ba

8 years agoMatch socket buffer sizes between audio HAL and BT server
Andy Hung [Wed, 4 May 2016 22:47:05 +0000 (15:47 -0700)]
Match socket buffer sizes between audio HAL and BT server

Adjust our mixer buffer size to be one quarter that of
the socket buffer size for quadruple buffering.

Increase socket buffer size from 20*512 to 28*512 to
smooth out variability in data draw from AudioFlinger.

Bug: 28286313
Change-Id: I8a9ca9e1f4639a0724cfe126acc670c2058cb0fb
(cherry picked from commit e97d975cce213b8c6e4f69bc3fc75411a1743647)

8 years agoGet rid of unused BTA_DYNAMIC_MEMORY
Jakub Pawlowski [Fri, 24 Jun 2016 21:05:58 +0000 (14:05 -0700)]
Get rid of unused BTA_DYNAMIC_MEMORY

Change-Id: Idc7fcddfecac9ab7d9800b496e2380ae277f357f

8 years agoUse bta_gattc_cb directly, not through aliases
Jakub Pawlowski [Fri, 24 Jun 2016 20:36:01 +0000 (13:36 -0700)]
Use bta_gattc_cb directly, not through aliases

Right now, bta_gattc_cb is not used directly, instead it's passed as
argument to methods that can use it directly.

Change-Id: I54fef4b8b1e11b3289e7961f70bea187173e9804

8 years agobtif: standardize types, #ifs
Marie Janssen [Wed, 22 Jun 2016 19:52:19 +0000 (12:52 -0700)]
btif: standardize types, #ifs

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__

Change-Id: Ic29d1d0b32c3ca9953752a4e5da6c28f45ec8895

8 years agoGATT: use one type for all server attributes
Jakub Pawlowski [Tue, 21 Jun 2016 23:16:09 +0000 (16:16 -0700)]
GATT: use one type for all server attributes

Right now we have three types, for attributes depending on how long
the uuid is. Instead, use one type.

Change-Id: I33bb4f3c57b7b1516eda871a77b71661b7ba39ce

8 years agoMerge "Remove unused "cmn_ble_vsc_cb"; causing extended scan to not start"
Treehugger Robot [Mon, 20 Jun 2016 22:53:14 +0000 (22:53 +0000)]
Merge "Remove unused "cmn_ble_vsc_cb"; causing extended scan to not start"

8 years agoVectors as parameters to GATT (1/3)
Jakub Pawlowski [Tue, 31 May 2016 20:14:13 +0000 (13:14 -0700)]
Vectors as parameters to GATT (1/3)

Bug: 29005882
Bug: 28485365
Change-Id: I0a5041073a39977c4fbc29879c383fa6720da641

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