OSDN Git Service

android-x86/system-bt.git
7 years agoAllocate buffers of the right size when BT_HDR is included am: 510697a0d7 am: 5da7401...
Pavlin Radoslavov [Thu, 13 Jul 2017 18:13:38 +0000 (18:13 +0000)]
Allocate buffers of the right size when BT_HDR is included am: 510697a0d7 am: 5da7401f62 am: 6a44d1821b
am: 4e8db0e0b4

Change-Id: I4b45cfe89d4460520eca795858309a83886e6c70

7 years agoAllocate buffers of the right size when BT_HDR is included am: 510697a0d7 am: 5da7401f62
Pavlin Radoslavov [Thu, 13 Jul 2017 18:11:07 +0000 (18:11 +0000)]
Allocate buffers of the right size when BT_HDR is included am: 510697a0d7 am: 5da7401f62
am: 6a44d1821b

Change-Id: Idfaeec3e29c40905e50e69df944134e403d41a1b

7 years agoAllocate buffers of the right size when BT_HDR is included am: 510697a0d7
Pavlin Radoslavov [Thu, 13 Jul 2017 18:08:37 +0000 (18:08 +0000)]
Allocate buffers of the right size when BT_HDR is included am: 510697a0d7
am: 5da7401f62

Change-Id: I551622b60e882a85a9c739ec22d08a5af55cb1c9

7 years agoAllocate buffers of the right size when BT_HDR is included
Pavlin Radoslavov [Thu, 13 Jul 2017 18:06:36 +0000 (18:06 +0000)]
Allocate buffers of the right size when BT_HDR is included
am: 510697a0d7

Change-Id: I5ca796fc392413dbf7f89332d1172904f980fab5

7 years agoAllocate buffers of the right size when BT_HDR is included
Pavlin Radoslavov [Thu, 6 Jul 2017 20:39:02 +0000 (13:39 -0700)]
Allocate buffers of the right size when BT_HDR is included

Bug: 63146105
Test: External script
Change-Id: I1f2c871e3fcf57aabdad9d07905e6dae643bd496
Merged-In: I1f2c871e3fcf57aabdad9d07905e6dae643bd496
(cherry picked from commit d88838a7237cd672d87b6b9cc8d56fff625fd1d5)
(cherry picked from commit b648c7dfe45c57842d58576f558fdf8edff10bec)
(cherry picked from commit 338e0485940ab278e6a2dc12285ba0798b79cfa4)

7 years agoDO NOT MERGE ANYWHERE HOGP mouse connect failed during OPP TX
Yamei Du [Thu, 1 Jun 2017 07:47:29 +0000 (07:47 +0000)]
DO NOT MERGE ANYWHERE HOGP mouse connect failed during OPP TX
am: dae59d3b83  -s ours

Change-Id: I2c48b9c67afda8ba35bfac258031de6909d1af12

7 years agoDO NOT MERGE ANYWHERE HOGP mouse connect failed during OPP TX
Yamei Du [Wed, 18 Nov 2015 09:28:07 +0000 (17:28 +0800)]
DO NOT MERGE ANYWHERE HOGP mouse connect failed during OPP TX

FW ACL buffer overflow.
One more ACL packet was sent to FW which is unexpected.

fix l2cap TX control defect.
Call fixed channel TX complete cb after packets is send to lower.

Bug: 26763700
Tested: manual
Change-Id: Iaba14a11c1583da2a72769ebd096e0baedf857c3
CR-Id: ALPS02404396

7 years agoDO NOT MERGE ANYWHERE Fix connect second BLE fail while BREDR coexist
Ruina Liu [Wed, 31 May 2017 00:38:38 +0000 (00:38 +0000)]
DO NOT MERGE ANYWHERE Fix connect second BLE fail while BREDR coexist
am: e90e72bb82  -s ours

Change-Id: Iee3ecc2a5c6d81a4fc2e72e8e21cd0d898199624

7 years agoDO NOT MERGE ANYWHERE Fix connect second BLE fail while BREDR coexist
Ruina Liu [Thu, 24 Sep 2015 02:04:16 +0000 (10:04 +0800)]
DO NOT MERGE ANYWHERE Fix connect second BLE fail while BREDR coexist

In scenario where BREDR/BLE links coexist, and BLE
transport is doing round-robin but BREDR transport is
not use round-robin, when uplayer trigger to transmit
BLE data, the BREDR lcb_pool with smaller array index
will break the for loop firstly. This can block the
L2cap packets transmission of the following BLE lcb_pool
even though there is available BLE controller buffer.

If BLE_INCLUDE is TRUE, then BREDR/BLE links maybe
coexist, change break to continue statement, so the
data transmission will not be blocked by the other
transport type in round-robin case.

Change-Id: I7ca739dfbf02acd2e30527c16ca616a7bad70c51
CR-Id: ALPS02303646

7 years agoMerge "DO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb" into cw...
Andre Eisenbach [Tue, 30 May 2017 21:06:25 +0000 (21:06 +0000)]
Merge "DO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb" into cw-f-dev
am: b044bae800  -s ours

Change-Id: Ic7314f6710c10c670ea3a4a24b4865661ee1451e

7 years agoMerge "DO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb" into cw...
TreeHugger Robot [Tue, 30 May 2017 21:00:28 +0000 (21:00 +0000)]
Merge "DO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb" into cw-f-dev

7 years agoDO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb
Andre Eisenbach [Thu, 3 Nov 2016 21:53:49 +0000 (14:53 -0700)]
DO NOT MERGE ANYWHERE Remove incorrect assert in btm_read_rssi_cb

|data| may be NULL if the RSSI request times out.
See btm_read_rssi_timeout implementation for details.

Bug: 32587130
Test: manual
Change-Id: Ide9dee819e1db24a39c05b086cd4c0b558ca23ef

7 years agoDO NOT MERGE ANYWHERE Check ACL link on non-opportunistic connection creation
Jacky Cheung [Thu, 11 May 2017 23:19:01 +0000 (23:19 +0000)]
DO NOT MERGE ANYWHERE Check ACL link on non-opportunistic connection creation
am: 0ce25115e9  -s ours

Change-Id: I105198593ba9994002205567038778162dc9e6d0

7 years agoDO NOT MERGE ANYWHERE Check ACL link on non-opportunistic connection creation
Jacky Cheung [Wed, 10 May 2017 21:23:06 +0000 (14:23 -0700)]
DO NOT MERGE ANYWHERE Check ACL link on non-opportunistic connection creation

At the time of connection, the idle timeout could have been set to a fixed
value, which is likely to be related to the completion of service discovery
after bonding.  A check on ACL link allows the idle timeout to be reset to no
timeout, which would eliminate local host disconnections observed due to
idle timeouts.

Bug: 37352720
Test: manual
Change-Id: Ie0b24b83020d502cf7c55421a27659215253b4d2

7 years agoDO NOT MERGE ANYWHERE Disable 3Mbps packets for AVDT ACL links.
Sridhar Vashist [Fri, 5 May 2017 01:17:20 +0000 (01:17 +0000)]
DO NOT MERGE ANYWHERE Disable 3Mbps packets for AVDT ACL links.
am: 7d3de37da0  -s ours

Change-Id: I90f535c99d45ebf0def0b2b08031a21f998c1c2e

7 years agoDO NOT MERGE ANYWHERE Disable 3Mbps packets for AVDT ACL links.
Sridhar Vashist [Fri, 28 Oct 2016 18:37:49 +0000 (13:37 -0500)]
DO NOT MERGE ANYWHERE Disable 3Mbps packets for AVDT ACL links.

3DH packets have a lower tolerance to background noise. A2DP requiring higher
bandwidth & realtime playback is especially suscepitble in this scenario.

Bug: 37515006
Test: oem manual
Change-Id: Id4d7452a86fe864eceb88a9fb16a40dc921a1e13

7 years agoMerge "DO NOT MERGE ANYWHERE Fix LE disconnecting right after pairing" into cw-f-dev
Jacky Cheung [Sat, 29 Apr 2017 03:52:59 +0000 (03:52 +0000)]
Merge "DO NOT MERGE ANYWHERE Fix LE disconnecting right after pairing" into cw-f-dev
am: b055f8b68a  -s ours

Change-Id: I7b31a9bb0a09d3e7bbb2b666331f4ac47a93efff

7 years agoMerge "DO NOT MERGE ANYWHERE Fix LE disconnecting right after pairing" into cw-f-dev
Jacky Cheung [Sat, 29 Apr 2017 03:48:18 +0000 (03:48 +0000)]
Merge "DO NOT MERGE ANYWHERE Fix LE disconnecting right after pairing" into cw-f-dev

7 years agoDO NOT MERGE ANYWHERE Fix LE disconnecting right after pairing
Jakub Pawlowski [Thu, 27 Apr 2017 11:52:34 +0000 (04:52 -0700)]
DO NOT MERGE ANYWHERE 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
(cherry picked from commit 7c8bab231328956d3b7569280cb162be4e345422)

7 years agoMerge "DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy" into cw-f-dev
Zach Johnson [Fri, 21 Apr 2017 21:04:06 +0000 (21:04 +0000)]
Merge "DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy" into cw-f-dev
am: b53535d61b  -s ours

Change-Id: I2399d1832fe643ef0057c2c4d0b0fa4bf860e760

7 years agoDO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy
Zach Johnson [Fri, 21 Apr 2017 21:03:23 +0000 (21:03 +0000)]
DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy
am: c61ef79a79  -s ours

Change-Id: I9704dd064ab5f37ca0ecb310be1cf73826737665

7 years agoMerge "DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy" into cw-f-dev
Zach Johnson [Fri, 21 Apr 2017 20:58:11 +0000 (20:58 +0000)]
Merge "DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy" into cw-f-dev

7 years agoDO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy
Zach Johnson [Wed, 19 Apr 2017 04:03:07 +0000 (21:03 -0700)]
DO NOT MERGE ANYWHERE Allow blocking AG SCO connects by policy

Needed for devices that support both HFP AG and HFP HF.

btsnoop logs show the sequence of events leading to failure:
(corroborated by bt logcat)

1. ACL connection with remote phone established on handle 0x01
2. ACL connection with remote headset established on handle 0x02
3. Incoming call in HF role from phone
4. Phone call locally published to telecom
5. Answer incoming call
6. SCO connection established with phone in HF role
7. AG role with headset picks up on call state change to answered
   via BTA_AG_IN_CALL_CONN_RES
8. Inside handler for BTA_AG_IN_CALL_CONN_RES, bta_ag_sco_open called
   to establish the SCO connection in the AG role with the headset,
   stomping on the previous (wanted) SCO connection with the phone.

Fix is to publish the SCO audio route policy to fluoride, so we can
stop 8 from happening.

Bug: 32958838
Test: manual:
      received incoming call in HF role, audio worked both ways;
      recieved incoming MT call, headset audio in AG role worked both ways
Change-Id: I12961598e8200bd1d5adb46ee8ec3a802114b80a

7 years agoDo not GATT_ERROR on MTU change
Jacky Cheung [Wed, 19 Apr 2017 21:35:03 +0000 (21:35 +0000)]
Do not GATT_ERROR on MTU change
am: a365626943

Change-Id: I956c4ca2e31d5c98e986738be0890c17e21b1186

7 years agoDo not GATT_ERROR on MTU change
Jacky Cheung [Fri, 14 Apr 2017 20:49:23 +0000 (13:49 -0700)]
Do not GATT_ERROR on MTU change

Bug: 37305498
Test: manual on MSM8909
Change-Id: Iabec87375da1e8cd05356a7be490a66205d24e78

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:38:39 +0000 (22:38 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf am: 585e0c08f5 am: 005eb1d305 am: 7752061901 am: 0ddb124e6e am: 2feb43b5b1
am: 72270d976b

Change-Id: I6dbf93e14a6c31092d2ecce2738b7680b738220c

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:33:09 +0000 (22:33 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf am: 585e0c08f5 am: 005eb1d305 am: 7752061901 am: 0ddb124e6e
am: 2feb43b5b1

Change-Id: I3d16a2939976a326ca20056b29818e2df550ee67

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:28:08 +0000 (22:28 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf am: 585e0c08f5 am: 005eb1d305 am: 7752061901
am: 0ddb124e6e

Change-Id: I61b9f5741d5fd6035fb7d472b83dc9df54eb3483

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:23:08 +0000 (22:23 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf am: 585e0c08f5 am: 005eb1d305
am: 7752061901

Change-Id: I1f821df2a72958ed17ce5bf8baed431a52dfb087

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:18:07 +0000 (22:18 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf am: 585e0c08f5
am: 005eb1d305

Change-Id: Ic4f826e4f963f969c360fe39c6e720c3fb013d23

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6...
Jack He [Tue, 11 Apr 2017 22:13:06 +0000 (22:13 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6 am: e6620d18cf
am: 585e0c08f5

Change-Id: If70a5f9b56845e758c2a2a3150936a72cac9f438

7 years agoCheck LE advertising data length before caching advertising records am: 1bef3546a6
Jack He [Tue, 11 Apr 2017 22:08:06 +0000 (22:08 +0000)]
Check LE advertising data length before caching advertising records am: 1bef3546a6
am: e6620d18cf

Change-Id: I412c0dd7854d7f6157e1974e285078909543bb41

7 years agoCheck LE advertising data length before caching advertising records
Jack He [Tue, 11 Apr 2017 22:03:05 +0000 (22:03 +0000)]
Check LE advertising data length before caching advertising records
am: 1bef3546a6

Change-Id: Ibbf6183833d7f00937742fa337a04569c4ef3c2f

7 years agoCheck LE advertising data length before caching advertising records
Jack He [Thu, 6 Apr 2017 00:59:58 +0000 (17:59 -0700)]
Check LE advertising data length before caching advertising records

Bug: 33899337
Test: make, receive LE advertising
Change-Id: I06b249ac5cabdef64528deda07b8bae749e1d2fd
(cherry picked from commit d57adbc350fdee4f27b82c9e39a14bd745d92320)

7 years agoDO NOT MERGE ANYWHERE Mark AutoConnParamUpdateAddr on first auto connection param...
Jacky Cheung [Fri, 7 Apr 2017 23:53:48 +0000 (23:53 +0000)]
DO NOT MERGE ANYWHERE Mark AutoConnParamUpdateAddr on first auto connection param update
am: dd467f108f  -s ours

Change-Id: Iae88352c83d7f3b1430c02e2af3a683bebae3bb2

7 years agoDO NOT MERGE ANYWHERE Mark AutoConnParamUpdateAddr on first auto connection param...
Jacky Cheung [Fri, 17 Mar 2017 17:21:40 +0000 (10:21 -0700)]
DO NOT MERGE ANYWHERE Mark AutoConnParamUpdateAddr on first auto connection param update

In the case that AutoConnParamUpdateAddr is missing, the first LE address
that performs the connection parameter update is inferred as the companion.
The address is recorded in AutoConnParamUpdateAddr.

BUG: 34693438

Change-Id: I2a6e0b10a4debe1e5f36052f67864854da0b3e47

7 years agoresolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064 am: b75b8e7f1a am:...
Pavlin Radoslavov [Wed, 15 Mar 2017 05:58:21 +0000 (05:58 +0000)]
resolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064 am: b75b8e7f1a am: d4f1f0e048
am: 0796aaa047

Change-Id: I216fb8bc48e84793e3c397c60f4311796ce5ef83

7 years agoresolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064 am: b75b8e7f1a
Pavlin Radoslavov [Wed, 15 Mar 2017 05:53:21 +0000 (05:53 +0000)]
resolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064 am: b75b8e7f1a
am: d4f1f0e048

Change-Id: Id111ef66d83a3427ccc8272115ef3191221ee3cc

7 years agoresolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064
Pavlin Radoslavov [Wed, 15 Mar 2017 05:47:20 +0000 (05:47 +0000)]
resolve merge conflicts of a3ee2e35 to nyc-dev am: a33dd28064
am: b75b8e7f1a

Change-Id: Iab4d37c1e43d62d9132ebf090ac43284f8b668a8

7 years agoresolve merge conflicts of a3ee2e35 to nyc-dev
Pavlin Radoslavov [Wed, 15 Mar 2017 05:41:49 +0000 (05:41 +0000)]
resolve merge conflicts of a3ee2e35 to nyc-dev
am: a33dd28064

Change-Id: I081f113d8908bb775f56c25beb105a3311b0affb

7 years agoresolve merge conflicts of a3ee2e35 to nyc-dev
Pavlin Radoslavov [Tue, 14 Mar 2017 21:46:15 +0000 (14:46 -0700)]
resolve merge conflicts of a3ee2e35 to nyc-dev

Bug: 34946955
Change-Id: Ieff690edd3aa527a0639483ec8e1e3b661f0ecc4
Merged-In: I0b6f50dee05a58db8c043b4d01fb58c9acbeede9

7 years agoCheck the HCI length before extracting the L2CAP length and CID am: 33c68c82c1 am...
Pavlin Radoslavov [Tue, 14 Mar 2017 21:10:16 +0000 (21:10 +0000)]
Check the HCI length before extracting the L2CAP length and CID am: 33c68c82c1 am: 172f0d8f7c
am: ca64d3d38b

Change-Id: I239b72b4cc81728c3e859b7f4efcb820c9d8fef9

7 years agoCheck the HCI length before extracting the L2CAP length and CID am: 33c68c82c1
Pavlin Radoslavov [Tue, 14 Mar 2017 21:05:16 +0000 (21:05 +0000)]
Check the HCI length before extracting the L2CAP length and CID am: 33c68c82c1
am: 172f0d8f7c

Change-Id: Ifb002936f93d85d635ab76ddf52c0ddb44cb9d3e

7 years agoCheck the HCI length before extracting the L2CAP length and CID
Pavlin Radoslavov [Tue, 14 Mar 2017 20:59:46 +0000 (20:59 +0000)]
Check the HCI length before extracting the L2CAP length and CID
am: 33c68c82c1

Change-Id: I1f94530ef90162747ef6a62c3a601856ea1d6672

7 years agoCheck the HCI length before extracting the L2CAP length and CID
Pavlin Radoslavov [Wed, 8 Mar 2017 02:48:21 +0000 (18:48 -0800)]
Check the HCI length before extracting the L2CAP length and CID

Bug: 34946955
Test: A2DP streaming to a headset
Change-Id: I0b6f50dee05a58db8c043b4d01fb58c9acbeede9
(cherry picked from commit ecc0835114cbae3033d8b0e25bd8b443880d5077)

7 years agoCorrected default value assignments in Bluetooth A2DP Metrics
Jack He [Fri, 20 Jan 2017 19:17:44 +0000 (11:17 -0800)]
Corrected default value assignments in Bluetooth A2DP Metrics

* In certain cases btif_media_task_stop_aa_req() could be called before
  btif_media_task_start_aa_req() is called, resulting in session_start_us
  to be 0. In this case, audio_duration_ms = time_now_us() - 0 will be a
  very large number that is not the actual audio duration.This CL marks
  audio_duration_ms as -1 in the above situation so that we can
  differentiate between valid and invalid audio durations
* Set default timer and counter values to 0 when
  tx_queue_dequeue_stats.total_updates > 1
* Move update_scheduling_stats for tx_queue_enqueue_stats to
  btif_media_task_aa_handle_timer as we intend to capture the time
  intervals for enqueue scheduling instead of time intervals between
  frame enqueue (i.e. one scheduling event can enqueue multiple frames)
* Use tx_queue_enqueue_stats instead of *dequeue* since only enqueue is
  triggered by timer event

Bug: 33694310
Test: Code compilation, BtFunhausMetricsTest
Change-Id: I10984920afd4d77f07a5ac75736f8dcd69b13af8

7 years agoFix A2DP Metrics Logging Capacity
Jack He [Tue, 17 Jan 2017 23:41:30 +0000 (15:41 -0800)]
Fix A2DP Metrics Logging Capacity

* Set the maximum number of wake events logged to 1000
* Stop logging wake log name as it takes too much memory
* Add counters for each of the repeated values in BluetoothLog so that
  the true number of events can be determined while oldest event get
  dropped
* Log Bluetooth session disconnect reasons using enum instead of string
  in order to save memory usage
* Apply changes to bluetooth.proto in ag/1460462 on system/bt

Bug: 33694310
Test: Code compilation and unit tests
Change-Id: I2cc6f9304725938b63b211d615eb1941eac60edf

7 years agoFix NPE when discovering invalid GATT datatbase
Jakub Pawlowski [Mon, 16 Jan 2017 12:05:57 +0000 (04:05 -0800)]
Fix NPE when discovering invalid GATT datatbase

When doing a discovery of invalid GATT database, where two services are
added with same start handle, characteristics are added to the first
one, where descriptors are added to the later. This cause NPE when
adding descriptor.

Bug: 34280184
Test: manual test
Change-Id: I27619098df33a641cb089b82cf4d4ffd3c6e6aea
(cherry picked from commit 8957fdca4f6a1ba963b81983e8a40a82c3b1122d)

7 years agoMerge "Serialize stack shutdown, state change callback and cleanup" into cw-f-dev
Jacky Cheung [Tue, 10 Jan 2017 18:12:20 +0000 (18:12 +0000)]
Merge "Serialize stack shutdown, state change callback and cleanup" into cw-f-dev
am: 718b632f2b

Change-Id: I1ce4066cb7598d38cd2963ff2a9800a8f9f5debe

7 years agoSerialize stack shutdown, state change callback and cleanup
Gurpreet Ghai [Tue, 10 Jan 2017 18:12:19 +0000 (18:12 +0000)]
Serialize stack shutdown, state change callback and cleanup
am: 352b8e89ea

Change-Id: Icace606e4c596074c4a120678d65511c78f683c4

7 years agoMerge "Serialize stack shutdown, state change callback and cleanup" into cw-f-dev
Jacky Cheung [Tue, 10 Jan 2017 18:02:33 +0000 (18:02 +0000)]
Merge "Serialize stack shutdown, state change callback and cleanup" into cw-f-dev

7 years agoresolve merge conflicts of 316589aa to nyc-mr2-dev
Andre Eisenbach [Tue, 10 Jan 2017 02:21:38 +0000 (18:21 -0800)]
resolve merge conflicts of 316589aa to nyc-mr2-dev

Change-Id: I1a5e1b3d09b5bc5d13eda31fd633146536dbd7ee

7 years agoRemove position dependent lookup tables in AT command parser
Andre Eisenbach [Mon, 9 Jan 2017 23:05:41 +0000 (23:05 +0000)]
Remove position dependent lookup tables in AT command parser
am: 8d3cf5988a

Change-Id: I0a690f1538c49fbed743ccf324d240dbb8c927c8

7 years agoFix A2DP metrics session duration
Jack He [Fri, 9 Dec 2016 03:29:00 +0000 (19:29 -0800)]
Fix A2DP metrics session duration

* Fixed A2DP duration counting. It is now counting from music play start
  to music play end.
* Start logging a2dp connection as Bluetooth sessions. Currently, only
  A2DP connections are logged. Thus the bluetooth session length will be
  the total connection length and the length within A2DP session message
  will be the audio connection length.
* Add a audio_duration_millis field in A2DPSession to record audio duration
* Add bonded memory constraint for metrics entries
* Use a builder mechanism to only build metrics upon dumping
* Refactor metrics module into BluetoothMetricsLogger class
* Created unit test for BluetoothMetricsLogger

Bug: 33694310
Test: Code compilation, Unit test, BtFunhausMetricsTest
Merged-In: Iea2a997c4ea074687a5d50860e9229f0e1b82659
Change-Id: Iea2a997c4ea074687a5d50860e9229f0e1b82659
(cherry picked from commit f3175629208a64b190dde4dcf5f92cacef70d3e9)

7 years agoAdd LeakyBondedQueue to libosi
Jack He [Tue, 20 Dec 2016 19:57:17 +0000 (11:57 -0800)]
Add LeakyBondedQueue to libosi

* LeakyBondedQueue is a fixed size queue that leaks oldest item when
  reaching its capacity. This is useful in creating memory bonded data
  structure where freshness is more important than full coverage.
* The queue is protected by a simple mutex and is thread-safe, although
  improvements could be made to lock enqueue and dequeue separately, it
  is not implemented at this moment due to lack of demand
* The queue uses unique_ptr to automatically free its content when it is
  destructed
* Add several tests to verify its API and memory management
* This data structure will be firstly used in the metrics module

Bug: 33781460
Test: Code compilation, unit tests
Merged-In: I51cb73666ac58e4792d9cba0d6f16dad30a0ff39
Change-Id: I51cb73666ac58e4792d9cba0d6f16dad30a0ff39
(cherry picked from commit a22dd221033bb6b4052544c4489934a4ba2a3416)

7 years agoSerialize stack shutdown, state change callback and cleanup
Gurpreet Ghai [Mon, 12 Sep 2016 12:06:53 +0000 (17:36 +0530)]
Serialize stack shutdown, state change callback and cleanup

Use Case: Bluetooth On/Off scenario, User switch

Steps:
1. Turn ON Bluetooth
2. Switch user
Also observed on occurrence of enable/disable timeout during On/Off testing.

Failure: Crash while sending state change HAL callback.

Root Cause: In the event when stack cleanup is queued to stack manager
thread when stack shutdown is being processed, stack cleanup starts
execution as soon as stack shutdown is finished.
If the function event_signal_stack_down posted to btif thread at the
end of stack shutdown is executed after stack cleanup crash occurs.

Fix: Serialized the execution of stack shutdown, state change callback
execution and stack cleanup to happen in same order.

Test: code compilation.

Change-Id: Ic96205b5c304acb44eab53f4e2cb150726643bda
(cherry picked from commit 16e112b1861d8f1147325372608c905627e00e88)

7 years agoRemove position dependent lookup tables in AT command parser
Andre Eisenbach [Sat, 23 Jul 2016 06:15:11 +0000 (23:15 -0700)]
Remove position dependent lookup tables in AT command parser

The various position dependent lookup tables in the AT command parser
were out of sync, causing invalid responses to the AT+CBPS command for
example.

This patch gets rid of positionally dependent enums for simple lookup
tables that correlate all the values for easier, less error prone
maintenance of the related tables.

This re-instates a previously reverted patch after fixing incorrect
field order in tBTA_AG_INDICATOR_MAP.

Change-Id: I7f8a052e78706c8c72c5102b38cfe9ce200ae0d9
Fixes: 29978908

7 years agoDO NOT MERGE ANYWHERE Fix the timestamp in btsnoop format
Ben YoungTae Kim [Thu, 15 Dec 2016 21:08:23 +0000 (21:08 +0000)]
DO NOT MERGE ANYWHERE Fix the timestamp in btsnoop format
am: aa40aa18bc  -s ours

Change-Id: I4fc659fbacd28f726d336d04600289ed891e00f6

7 years agoMove btsnoop_hci.log to /data/misc/bluetooth/logs
Ajay Panicker [Wed, 14 Sep 2016 18:46:23 +0000 (11:46 -0700)]
Move btsnoop_hci.log to /data/misc/bluetooth/logs

Bug: 31466840
Change-Id: Ibd8f8b85eb59be8bfbb8a7c83b5935802624a748
(cherry picked from commit 12aeda148b39f82d07733ad5c3eafcc9264707a1)

7 years agoDO NOT MERGE ANYWHERE Fix the timestamp in btsnoop format
Ben YoungTae Kim [Mon, 23 May 2016 23:15:07 +0000 (16:15 -0700)]
DO NOT MERGE ANYWHERE 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>
7 years agoDO NOT MERGE ANYWHERE Do not update sco_state when no matching peer_addr is found
Zheng Zhang [Mon, 12 Dec 2016 19:10:59 +0000 (19:10 +0000)]
DO NOT MERGE ANYWHERE Do not update sco_state when no matching peer_addr is found
am: 3e1402c31c  -s ours

Change-Id: I235c9562890483bcba881a59c718c14b2f6ce2a2

7 years agoDO NOT MERGE ANYWHERE Do not update sco_state when no matching peer_addr is found
Zheng Zhang [Wed, 23 Mar 2016 03:03:19 +0000 (11:03 +0800)]
DO NOT MERGE ANYWHERE Do not update sco_state when no matching peer_addr is found

In the bta_hf_client_sco_conn_cback function, sco_state should not be set to
BTA_HF_CLIENT_SCO_SHUTDOWN_ST when no matched peer_addr found, so that it
can handle BTA_HF_CLIENT_SCO_OPEN_E event later.

Bug: 26416310
Change-Id: I4540230c792490f79e4cca24cb4b34a1c383422f
(cherry-picked from 2dfcbda49f694fcf1355955c334926e8641b4dc5)

7 years agoAdd extra logs by default inside sdp_copy_raw_data()
Pavlin Radoslavov [Tue, 29 Nov 2016 00:59:43 +0000 (16:59 -0800)]
Add extra logs by default inside sdp_copy_raw_data()

The extra logging is needed for investigating an issue that
is hard to reproduce.

Test: code compilation
Bug: 31795382
Change-Id: Ibe500e332dba8f44485b44bcac32d11be52520a6
Merged-In: Ibe500e332dba8f44485b44bcac32d11be52520a6
(cherry picked from commit 9f9166c5830e06f816ff8299f74518f7ec781347)

7 years agoMerge changes from topic 'ble_oob_sc_mr2' into nyc-mr2-dev
Jakub Pawlowski [Fri, 2 Dec 2016 20:14:00 +0000 (20:14 +0000)]
Merge changes from topic 'ble_oob_sc_mr2' into nyc-mr2-dev

* changes:
  Fix incorrect check for empty out-of-band pairing data
  BLE OOB Pairing - parse address type (1/5)
  Add LE Secure Connection data parsing (3/4)

7 years agoImprove HOGP input report error handling
Lawrance Liu [Tue, 4 Oct 2016 08:09:15 +0000 (16:09 +0800)]
Improve HOGP input report error handling

This fixes com.android.bluetooth crash when receiving HOGP input report
for unknown characteristic.

Test: Pair/Unpair BLE mouse/keyboard devices.
(cherry picked from commit 9e6f5ad992060fe91dbacc302417a30ddf5e7a57)
Bug: 33257618
Change-Id: I4bb3fb02cffdcc5b1273f8ace281826eccce6639

7 years agoCleanup GATT cache when remote device is disconnected
Jakub Pawlowski [Tue, 29 Nov 2016 19:45:09 +0000 (11:45 -0800)]
Cleanup GATT cache when remote device is disconnected

According to Bluetooth spec, GATT cache should not be persisted between
reconnections for unbonded devices. Bonded devices store the cache on
the disk and will read it on reconnection.

Bug: 33123476
Test: sl4a GattReadTest
Change-Id: If2ca53c7b22a346e7236514ea7b461695c923f74
(cherry picked from commit 9580a30918c256cf20fdb68823115864155e6243)

7 years agoFix how LE connection parameters are set after connecting.
Jakub Pawlowski [Fri, 11 Nov 2016 21:35:18 +0000 (13:35 -0800)]
Fix how LE connection parameters are set after connecting.

This patch fixes bug introduced in commit
95075be6e95e9021c1ddd834bcf9e3771c57c217
which would cause unnecessary connection parameter update request
to be send. It should be send only right after connecting.

Bug: 32563079
Bug: 28435172
Change-Id: Ibd9301a990f12a94e8043b9c29a480f068251ba8

7 years agoFix incorrect check for empty out-of-band pairing data
Jakub Pawlowski [Thu, 10 Nov 2016 23:56:46 +0000 (15:56 -0800)]
Fix incorrect check for empty out-of-band pairing data

Bug: 32780409
Test: try pairing with nRF52DK using OOB LE SC
Change-Id: I3c165843bb76c372b76bdc18a7d9226345d39037
(cherry picked from commit a638cc509bf8fe4157c0aa5d3e39011063d3587a)

7 years agoBLE OOB Pairing - parse address type (1/5)
Jakub Pawlowski [Thu, 10 Nov 2016 00:39:10 +0000 (16:39 -0800)]
BLE OOB Pairing - parse address type (1/5)

When address type is not parsed, creating bond to devices not using
random address is impossible.

Bug: 32780409
Test: try pairing with nRF52DK using random address
Change-Id: Idc0315e9e3f9e17c3cf56fa483c8e21eb3590f01
(cherry picked from commit 7921e8f594079e00e90173a8fe7483ad72443b34)

7 years agoAdd LE Secure Connection data parsing (3/4)
Jakub Pawlowski [Thu, 28 Jul 2016 12:58:35 +0000 (05:58 -0700)]
Add LE Secure Connection data parsing (3/4)

Bug: 30460956
Change-Id: I216142090fe99b25ef7697fceceb278b761a182b

7 years agoresolve merge conflicts of c5bae32 to nyc-mr2-dev
Andre Eisenbach [Tue, 8 Nov 2016 08:26:35 +0000 (00:26 -0800)]
resolve merge conflicts of c5bae32 to nyc-mr2-dev

Change-Id: Ib1acd5c8f60785470906941228593aa7453d5830

7 years agoMask out HFP 1.7 feature bits if peer version is <1.7
Andre Eisenbach [Tue, 8 Nov 2016 00:23:56 +0000 (00:23 +0000)]
Mask out HFP 1.7 feature bits if peer version is <1.7
am: ebba3ef2ea

Change-Id: Ifba883eecdf6296d94f6181564e3fdf69ec5a452

7 years agoMask out HFP 1.7 feature bits if peer version is <1.7
Andre Eisenbach [Sat, 5 Nov 2016 00:43:17 +0000 (17:43 -0700)]
Mask out HFP 1.7 feature bits if peer version is <1.7

Bug: 32378402
Merged-In: I568e8c4c584d56d744cf7a30273feac1d8d4c4df
Change-Id: Iac8684bdfd02b18cce260bedefb829e8f7285361
(cherry picked from commit 1ad2678e2ff5fa3dbfae9dc76ab646db10794e4e)
(cherry picked from commit 571f23ca31cdbc87cae8c078b5885246dd779498)

7 years agoRemove position dependent lookup tables in AT command parser
Andre Eisenbach [Sat, 23 Jul 2016 06:15:11 +0000 (23:15 -0700)]
Remove position dependent lookup tables in AT command parser

The various position dependent lookup tables in the AT command parser
were out of sync, causing invalid responses to the AT+CBPS command for
example.

This patch gets rid of positionally dependent enums for simple lookup
tables that correlate all the values for easier, less error prone
maintenance of the related tables.

This re-instates a previously reverted patch after fixing incorrect
field order in tBTA_AG_INDICATOR_MAP.

Change-Id: I7f8a052e78706c8c72c5102b38cfe9ce200ae0d9
Fixes: 29978908

7 years ago[DO NOT MERGE] Remove incorrect assert in btm_read_rssi_cb
Andre Eisenbach [Thu, 3 Nov 2016 21:53:49 +0000 (14:53 -0700)]
[DO NOT MERGE] Remove incorrect assert in btm_read_rssi_cb

|data| may be NULL if the RSSI request times out.
See btm_read_rssi_timeout implementation for details.

Bug: 32587130
Test: manual
Change-Id: Ide9dee819e1db24a39c05b086cd4c0b558ca23ef

7 years agoDO NOT MERGE ANYWHERE Auto Connection Parameter Update for Whitelisted Address
Jacky Cheung [Thu, 3 Nov 2016 22:20:20 +0000 (22:20 +0000)]
DO NOT MERGE ANYWHERE Auto Connection Parameter Update for Whitelisted Address
am: eac369fc17  -s ours

Change-Id: I78c55cc18fadc66a7dc943446ffc60a4e145a774

7 years agoDO NOT MERGE ANYWHERE LE Connection Parameter Update Callback
Jacky Cheung [Thu, 3 Nov 2016 22:20:19 +0000 (22:20 +0000)]
DO NOT MERGE ANYWHERE LE Connection Parameter Update Callback
am: f4314979ba  -s ours

Change-Id: I9594cfb0e7be17a5e3d13631602ade1767df26ec

7 years agoDO NOT MERGE ANYWHERE Auto Connection Parameter Update for Whitelisted Address
Jacky Cheung [Fri, 28 Oct 2016 21:17:14 +0000 (14:17 -0700)]
DO NOT MERGE ANYWHERE Auto Connection Parameter Update for Whitelisted Address

Auto adjust connection interval parameter after a certain idle
period on the connection.

BUG: 32380838

Change-Id: I28cf4f6d5dcfb7a0bfb6aa652d939e16fbdcdcde

7 years agoDO NOT MERGE ANYWHERE LE Connection Parameter Update Callback
Jacky Cheung [Fri, 28 Oct 2016 18:47:11 +0000 (11:47 -0700)]
DO NOT MERGE ANYWHERE LE Connection Parameter Update Callback

The callback ends at the btif layer and does not go up to the HAL layer.
Event logging is added to track success rate.

BUG: 28800115

Change-Id: I73ad281437760e1d61dd4e504401b270eb77e3e6

7 years agoAssign pairing code to bta_dm_cb before device name resolution
Jack He [Tue, 1 Nov 2016 18:30:51 +0000 (11:30 -0700)]
Assign pairing code to bta_dm_cb before device name resolution

Device name resolution, BTM_ReadRemoteDeviceName(), will cause
bta_dm_sp_cback() to exit early and bta_dm_pinname_cback() callback
will be invoked after the resolution, which continues the pairing
with pairing code from bta_dm_cb.num_val. Hence, bta_dm_cb.num_val
needs to be assigned before BTM_ReadRemoteDeviceName() is called.

Test: manual
Bug: 31381715
Change-Id: I61f06a9d878dd72154d6621eb094dcea5f701cbc
(cherry picked from commit db76fa4d26d73402a3f03b288a0999f8694dbea8)

7 years agoFix random crashes in HID related code am: e318faa73a
Jakub Pawlowski [Tue, 25 Oct 2016 20:57:55 +0000 (20:57 +0000)]
Fix random crashes in HID related code am: e318faa73a
am: 1fe98c51ab

Change-Id: Ic1010a65720d0e90024e16b87353017321e34f8f

7 years agoFix random crashes in HID related code
Jakub Pawlowski [Tue, 25 Oct 2016 20:53:26 +0000 (20:53 +0000)]
Fix random crashes in HID related code
am: e318faa73a

Change-Id: I134f5f63052d7173b106422cebda1c9987c15e4a

7 years agoFix random crashes in HID related code
Jakub Pawlowski [Mon, 24 Oct 2016 22:00:12 +0000 (15:00 -0700)]
Fix random crashes in HID related code

Operation on characteristics/descriptors shouldn't access GATT database
when it's executed. This could happen while service rediscovery is in
progress.

Bug: 32240759
Test: connect to HID device
Change-Id: Ie2b6e6b451456204b1cea1e500df9a0ff949a9ef
(cherry picked from commit d8f09d077d9017a522c17f4b9a49328b0ed3e91e)

7 years agoMerge "DO NOT MERGE ANYWHERE Add Wear-specific feature to override LE IO capability...
Jacky Cheung [Thu, 20 Oct 2016 20:42:05 +0000 (20:42 +0000)]
Merge "DO NOT MERGE ANYWHERE Add Wear-specific feature to override LE IO capability" into cw-f-dev

7 years agoReset device security flags when pairing fails
Andre Eisenbach [Thu, 20 Oct 2016 20:33:35 +0000 (20:33 +0000)]
Reset device security flags when pairing fails
am: 667e1fe3d7

Change-Id: I1dd2d6d1a3f1dd613ae6d02d167f4fd7e015aadf

7 years agoReset device security flags when pairing fails
Andre Eisenbach [Tue, 18 Oct 2016 00:32:45 +0000 (17:32 -0700)]
Reset device security flags when pairing fails

Bug: 29998634
Test: manual
Change-Id: Icd9a76a065de147372df060c0b9555c75bcf46bc

7 years agoDO NOT MERGE ANYWHERE Add Wear-specific feature to override LE IO capability
Jacky Cheung [Wed, 19 Oct 2016 21:59:06 +0000 (14:59 -0700)]
DO NOT MERGE ANYWHERE Add Wear-specific feature to override LE IO capability

Force the first bond to use Just Works pairing when
WEAR_LE_IO_CAP_OVERRIDE is set to TRUE.

Bug: 32234733
Change-Id: I1732be86dd888586c603112fb6c3010974b54a13

7 years agoMerge "Fix HFP AT command BIA failures" into cw-f-dev
Zach Johnson [Wed, 12 Oct 2016 17:08:27 +0000 (17:08 +0000)]
Merge "Fix HFP AT command BIA failures" into cw-f-dev

7 years agoFix HFP AT command BIA failures
Devin Kim [Wed, 7 Sep 2016 04:47:47 +0000 (13:47 +0900)]
Fix HFP AT command BIA failures

Running the PTE test case TC_AG_IIA_BV_01_I, a failure occurs due to
missing initialization of tBTA_AG_VAL.

Bug: 31325270
Test: PTS
Change-Id: I683eccd53d40e79ec03545166b18ffa1922f0fb2

7 years agoFix bad GATT client state machine state after successfull cache load
Jakub Pawlowski [Tue, 4 Oct 2016 16:45:43 +0000 (16:45 +0000)]
Fix bad GATT client state machine state after successfull cache load
am: f87953f1be

Change-Id: If89361b40bd9abf0150afa4ac2af1b02366eafc7

7 years agoFix bad GATT client state machine state after successfull cache load
Jakub Pawlowski [Mon, 3 Oct 2016 20:25:01 +0000 (13:25 -0700)]
Fix bad GATT client state machine state after successfull cache load

If the GATT service cache was successfully loaded from a file, the
state must be reset to idle.

Bug: 31175159
Change-Id: I92ebf1bec9d2e7467d7412b41923614ec5a13b6d

7 years agoFix 100 LE device connection limitation
Andre Eisenbach [Wed, 28 Sep 2016 23:53:42 +0000 (23:53 +0000)]
Fix 100 LE device connection limitation
am: 013c32bf98

Change-Id: I64d57c1a19e41bcf35569eb707f58d31c9a54d63

7 years agoFix 100 LE device connection limitation
Andre Eisenbach [Wed, 28 Sep 2016 01:07:58 +0000 (18:07 -0700)]
Fix 100 LE device connection limitation

Currently after 100 devices are added to the device security database,
any subsequent LE connection to a newly discovered LE device address
will fail as entries in the security record database are not reused.

This patch removes a device record if the device itself is removed and
also ensures that the oldest device security record is deleted if the
limit is reached to ensure a new record can be allocated.

Bug: 31625900
Change-Id: I22f6c82c64a9a9bfb2a16d79182903e5aa011355

7 years agoFix unnecessary error message during GATT discovery
Jakub Pawlowski [Tue, 27 Sep 2016 15:44:34 +0000 (15:44 +0000)]
Fix unnecessary error message during GATT discovery
am: f2e3bea844

Change-Id: Ied4363b52980f4a1e146c6186ffe920770f65866

7 years agoFix unnecessary error message during GATT discovery
Jakub Pawlowski [Mon, 26 Sep 2016 21:05:18 +0000 (14:05 -0700)]
Fix unnecessary error message during GATT discovery

Bug: 31637098
Change-Id: Ib2545e7827bd338d2e22c88836818fce23e7a057

7 years agoFix the BLE connection failure with some mice
chaoyu.x.wu [Fri, 23 Sep 2016 19:56:34 +0000 (19:56 +0000)]
Fix the BLE connection failure with some mice
am: 58c27b48aa

Change-Id: I45bdf4a316fca554c8c85cefdb87cff0cd2d21e6

7 years agoFix the BLE connection failure with some mice
chaoyu.x.wu [Mon, 11 Apr 2016 06:08:48 +0000 (14:08 +0800)]
Fix the BLE connection failure with some mice

If enable the "connection parameters update" during GATT discovery,
it may cause some device connection failure due to connection timeout.
Since the the "connection parameter update" is enabled again when GATT
discovery completed, remove the enable of "connection parameter update"
after SMP complete to fix the issue.

This issue was already fixed in commit 2d41fe1c, but then it was
re-introduced in commit 444a8da8, which also removed comment explaining
the issue, added back in this patch.

Bug: 29060797
Change-Id: I42b0b36056821c30d887484e22bfcbd04ea7ca03
(cherry picked from commit 1ec17e06c73c67592aeda29e0aaa03580fdecce9)

7 years agoAdd BT_HCI_UNKNOWN_MESSAGE_TYPE log event
Pavlin Radoslavov [Fri, 16 Sep 2016 21:55:29 +0000 (21:55 +0000)]
Add BT_HCI_UNKNOWN_MESSAGE_TYPE log event
am: e1c8ed17c7

Change-Id: Ie4625f75dcfd71ae9740af80721a53be19045055

7 years agoAdd BT_HCI_UNKNOWN_MESSAGE_TYPE log event
Pavlin Radoslavov [Wed, 14 Sep 2016 23:39:02 +0000 (16:39 -0700)]
Add BT_HCI_UNKNOWN_MESSAGE_TYPE log event

If the received HCI type is unknown, then log an event and abort.
The most likely reason for that to happen is if the UART stream
is corrupted. We cannot recover from that, and there is not much
else we can do.

Also, fixed a bug in an HCI-related unit test that was exposed
by the above change.

Bug: 31432127
Change-Id: Ia888c485f177af4962268bf8f593b27fd7a4b080
(cherry picked from commit 27ec0c7824cf67b8a36bf5391734e6d2fc6207e2)

7 years agoFix bad address type assumption
Jakub Pawlowski [Fri, 16 Sep 2016 20:10:23 +0000 (20:10 +0000)]
Fix bad address type assumption
am: 1e688824d9

Change-Id: I522a7131368106919866b6f764eff43927a86124