OSDN Git Service

android-x86/system-bt.git
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 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

7 years agoMerge "Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT" into nyc-mr1-dev
Andre Eisenbach [Fri, 16 Sep 2016 20:09:59 +0000 (20:09 +0000)]
Merge "Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT" into nyc-mr1-dev
am: 654c6d13e5

Change-Id: I4ca7da856ba68edb44f9fd251d4f333590c98def

7 years agoAdd a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT
Jakub Pawlowski [Fri, 16 Sep 2016 20:09:59 +0000 (20:09 +0000)]
Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT
am: 5f98c2410f

Change-Id: Ic93722a25b865313ef94fcd84a7008b737f8a567

7 years agoFix NPE in l2cble_notify_le_connection
Jakub Pawlowski [Fri, 16 Sep 2016 20:09:44 +0000 (20:09 +0000)]
Fix NPE in l2cble_notify_le_connection
am: 5e61112a98

Change-Id: I6fbb661a7911c22b51952bfd54f5b342c9cb6b75

7 years agoFix bad address type assumption
Jakub Pawlowski [Fri, 16 Sep 2016 15:03:16 +0000 (08:03 -0700)]
Fix bad address type assumption

LE related code should not use BTM_ACL_IS_CONNECTED, because it assumes
classic transport.

In this particular case, connection created event, which was result of
advertising, caused cancellation of "LE Create Connection".
Attempt to send "LE Create Connection Cancel" was checking if connection
is already established, but was failing to do so becuase
BTM_ACL_IS_CONNECTED was used instead of btm_bda_to_acl with proper
transport. This caused just created connection to be dropped.

Bug: 31442085
Change-Id: Ia345a3d00e8567160f4abb2a31c4130ee69d67a3
(cherry picked from commit f5566938ba671329d91c84c30ab126fbcdfc16d7)

7 years agoMerge "Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT" into nyc-mr1-dev
Andre Eisenbach [Fri, 16 Sep 2016 19:56:58 +0000 (19:56 +0000)]
Merge "Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT" into nyc-mr1-dev

7 years agoAdd a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT
Jakub Pawlowski [Thu, 15 Sep 2016 15:02:05 +0000 (08:02 -0700)]
Add a missing case for BTA_DM_SEARCH_CANCEL_CMPL_EVT

Cancelling discovery was not handled properly in
btif_dm_search_services_evt and was causing crashes due to assert in
default case.

Bug: 31442085
Change-Id: If9a2c203730c9b06df5ff8d8e251f0c35addcb82
(cherry picked from commit 7df43240c4a7cf5ecd58a39f03d235bf52929d79)

7 years agoFix NPE in l2cble_notify_le_connection
Jakub Pawlowski [Thu, 15 Sep 2016 15:04:04 +0000 (08:04 -0700)]
Fix NPE in l2cble_notify_le_connection

Accessing p_lcb must be guarded with NULL check.

Bug: 31442085
Change-Id: I0f6e3f8e0247c5e8946c4d098f8a3ba442f5fb28
(cherry picked from commit b4458c93d5b5d7e2c103166d71daff560ee1a978)

7 years agoAdd security record for devices found through LE batch scan
Andre Eisenbach [Fri, 16 Sep 2016 17:29:19 +0000 (17:29 +0000)]
Add security record for devices found through LE batch scan
am: b4a5ec958f

Change-Id: I361aef8e79a9ef470b7e38bc71a30cf9104fa09f

7 years agoAdd security record for devices found through LE batch scan
Andre Eisenbach [Wed, 14 Sep 2016 19:41:37 +0000 (12:41 -0700)]
Add security record for devices found through LE batch scan

Currently, starting an LE batch scan are not added to the stack internal
device database, which means that the address type and device type
needed for a connection are not available.

This patch ensures that devices found during an LE scan are added to the
device database to ensure connection attempts will succeed.

Bug: 31309376
Change-Id: Ic52d7eaa03d17dcbbd848af9140038bc84ea3bd0
(cherry picked from commit e0295e2c2eb7cc6eb331d581ed8455d6b30b3bc6)

7 years agoUpdating QDID to reflect the certfication done for N.
pkanwar [Tue, 6 Sep 2016 22:29:58 +0000 (22:29 +0000)]
Updating QDID to reflect the certfication done for N.
am: a1e4dd95ea

Change-Id: Ic057ec7cc1ffc73073f35c1d7c828c3904a5065d

7 years agoUpdating QDID to reflect the certfication done for N.
pkanwar [Tue, 6 Sep 2016 16:21:35 +0000 (09:21 -0700)]
Updating QDID to reflect the certfication done for N.

Change-Id: Ia80cb82c833df341f832d2ab8cc71a868e2c8f5e

7 years agoFix HID crashing on reconnect
Jakub Pawlowski [Thu, 1 Sep 2016 21:08:50 +0000 (21:08 +0000)]
Fix HID crashing on reconnect
am: 0afaaa41b5

Change-Id: I04188383c9a7dc73b4988fd5e791c2ad625080f5

7 years agoFix HID crashing on reconnect
Jakub Pawlowski [Thu, 1 Sep 2016 10:29:51 +0000 (03:29 -0700)]
Fix HID crashing on reconnect

This patch fixes crashes on reconnection to HID device.
All those issues are already fixed in AOSP.

Bug: 31221398
Change-Id: I43b64d0b11b1f548cb373332777ea92d8a075466

8 years agoMerge "Disable auto-pairing for hands-free devices" into nyc-dev am: fb309b3ce7 am...
Andre Eisenbach [Mon, 29 Aug 2016 22:23:24 +0000 (22:23 +0000)]
Merge "Disable auto-pairing for hands-free devices" into nyc-dev am: fb309b3ce7 am: 88cc389d84
am: d810039327

Change-Id: I8f8921f7930a877c2dd7cbf5af24856ad7398e3a

8 years agoDisable auto-pairing for hands-free devices am: d2a37effc2 am: f7d632a29d
Andre Eisenbach [Mon, 29 Aug 2016 22:23:23 +0000 (22:23 +0000)]
Disable auto-pairing for hands-free devices am: d2a37effc2 am: f7d632a29d
am: d3b760ac45

Change-Id: Ia6057d521cb2e64d53e67400543607aef375e3cf

8 years agoMerge "Disable auto-pairing for hands-free devices" into nyc-dev am: fb309b3ce7
Andre Eisenbach [Mon, 29 Aug 2016 22:09:48 +0000 (22:09 +0000)]
Merge "Disable auto-pairing for hands-free devices" into nyc-dev am: fb309b3ce7
am: 88cc389d84

Change-Id: I6c325fa710adfefbbe3e448ebc28a0777253d5d3

8 years agoDisable auto-pairing for hands-free devices am: d2a37effc2
Andre Eisenbach [Mon, 29 Aug 2016 22:09:48 +0000 (22:09 +0000)]
Disable auto-pairing for hands-free devices am: d2a37effc2
am: f7d632a29d

Change-Id: I6cf3f7c2579e0ef395142aa3165c1e608e7e2fbc

8 years agoMerge "Disable auto-pairing for hands-free devices" into nyc-dev
Andre Eisenbach [Mon, 29 Aug 2016 22:05:26 +0000 (22:05 +0000)]
Merge "Disable auto-pairing for hands-free devices" into nyc-dev
am: fb309b3ce7

Change-Id: Ib7494cc47ff0e93f7f20a12dc79695697d2eecf0

8 years agoDisable auto-pairing for hands-free devices
Andre Eisenbach [Mon, 29 Aug 2016 22:05:26 +0000 (22:05 +0000)]
Disable auto-pairing for hands-free devices
am: d2a37effc2

Change-Id: I87c0ba767d7dcf91cfd6cb4903fea4efd6df392b

8 years agoMerge "Disable auto-pairing for hands-free devices" into nyc-dev
TreeHugger Robot [Mon, 29 Aug 2016 21:51:21 +0000 (21:51 +0000)]
Merge "Disable auto-pairing for hands-free devices" into nyc-dev

8 years agoaudio_a2dp_hw: Always update frame counter in out_write am: 5274ab7a31 am: 12851e1b46
Andy Hung [Mon, 29 Aug 2016 21:20:21 +0000 (21:20 +0000)]
audio_a2dp_hw: Always update frame counter in out_write am: 5274ab7a31 am: 12851e1b46
am: 9cc786805b

Change-Id: I66972340a617f44d4d9ca993f9ab394065947a8e

8 years agoaudio_a2dp_hw: Always update frame counter in out_write am: 5274ab7a31
Andy Hung [Mon, 29 Aug 2016 21:15:52 +0000 (21:15 +0000)]
audio_a2dp_hw: Always update frame counter in out_write am: 5274ab7a31
am: 12851e1b46

Change-Id: I16468c6316fc48923e63f9a52276a2307ce0ae56

8 years agoaudio_a2dp_hw: Always update frame counter in out_write
Andy Hung [Mon, 29 Aug 2016 21:12:22 +0000 (21:12 +0000)]
audio_a2dp_hw: Always update frame counter in out_write
am: 5274ab7a31

Change-Id: I6f40e0c813cbc7fe9801903f8c2cbfb08e05f6c0

8 years agoaudio_a2dp_hw: Always update frame counter in out_write
Andy Hung [Thu, 28 Jul 2016 17:45:54 +0000 (10:45 -0700)]
audio_a2dp_hw: Always update frame counter in out_write

Required now that we always return success.

Bug: 30025777
Change-Id: I7db51321672c128039545cc0fb604c615f169bc3
(cherry picked from commit f4a37b255d1d6fa4cf7cefe2aeb1c3f4fdf33f3c)

8 years agoMake gatt_attr use opportunistic connection am: 970d9d18ec
Jakub Pawlowski [Tue, 23 Aug 2016 20:32:50 +0000 (20:32 +0000)]
Make gatt_attr use opportunistic connection am: 970d9d18ec
am: de0eabbc05

Change-Id: Ic84f963c1efa375a643fe4c08ef0716c21e209b6

8 years agoGATT: don't update link status for apps that were never connected am: aab757d3d6
Jakub Pawlowski [Tue, 23 Aug 2016 20:32:48 +0000 (20:32 +0000)]
GATT: don't update link status for apps that were never connected am: aab757d3d6
am: a7dd707914

Change-Id: I9256c0f1ad331bca8b62e01790dcc9d6c5248e87

8 years agoMake gatt_attr use opportunistic connection
Jakub Pawlowski [Tue, 23 Aug 2016 20:27:39 +0000 (20:27 +0000)]
Make gatt_attr use opportunistic connection
am: 970d9d18ec

Change-Id: Iaff1375e619409afe9570b6fb79867070a339902

8 years agoGATT: don't update link status for apps that were never connected
Jakub Pawlowski [Tue, 23 Aug 2016 20:27:38 +0000 (20:27 +0000)]
GATT: don't update link status for apps that were never connected
am: aab757d3d6

Change-Id: Id9397aa59aae3570821c9838d428541cfb6a878a

8 years agoMake gatt_attr use opportunistic connection
Jakub Pawlowski [Mon, 18 Jul 2016 16:06:49 +0000 (09:06 -0700)]
Make gatt_attr use opportunistic connection

This patch creates new connection mode - opportunistic connection. When
such connection is made, no call to gatt_update_app_hold_link_status
will be made when it's started.

This means that connecting and disconnecting in this mode won't trigger
disconnect timer. When other, app creates regular connection and then
disconnects, the physical connection might get disconnected.

Opportunistic connection is used only for code setting CCC right now.

Bug: 30186455
Change-Id: Ia5be7682b6c3dcb4993060f818dee603aef3e19e

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.

Bug: 30186455
Change-Id: I6f18ec7fe4e80e048adc9e360cae703b7d64d62a

8 years agoMerge "GATT: don't update link status for apps that were never connected" into nyc...
Jakub Pawlowski [Fri, 19 Aug 2016 13:27:30 +0000 (13:27 +0000)]
Merge "GATT: don't update link status for apps that were never connected" into nyc-mr1-dev
am: fdab496066

Change-Id: I176b02758b89cec3e0af685bc1d6a51cc4e22584

8 years agoGATT: don't update link status for apps that were never connected
Jakub Pawlowski [Fri, 19 Aug 2016 13:27:30 +0000 (13:27 +0000)]
GATT: don't update link status for apps that were never connected
am: d921c78fc6

Change-Id: I35b5cd7df92916044b69c9b191978ccd207ee6d4

8 years agoMake gatt_attr use opportunistic connection
Jakub Pawlowski [Fri, 19 Aug 2016 13:27:29 +0000 (13:27 +0000)]
Make gatt_attr use opportunistic connection
am: 8ed030ff4a

Change-Id: I7f9926fa32daaf286de667b9faf8ef92f81d43f2

8 years agoMerge "GATT: don't update link status for apps that were never connected" into nyc...
TreeHugger Robot [Fri, 19 Aug 2016 06:15:04 +0000 (06:15 +0000)]
Merge "GATT: don't update link status for apps that were never connected" into nyc-mr1-dev

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 agoMake gatt_attr use opportunistic connection
Jakub Pawlowski [Mon, 18 Jul 2016 16:06:49 +0000 (09:06 -0700)]
Make gatt_attr use opportunistic connection

This patch creates new connection mode - opportunistic connection. When
such connection is made, no call to gatt_update_app_hold_link_status
will be made when it's started.

This means that connecting and disconnecting in this mode won't trigger
disconnect timer. When other, app creates regular connection and then
disconnects, the physical connection might get disconnected.

Opportunistic connection is used only for code setting CCC right now.

Bug: 30186455
Change-Id: Ia5be7682b6c3dcb4993060f818dee603aef3e19e

8 years agoRvert "Register for Service Changed notifications for untrusted devices"
Satomi [Tue, 9 Aug 2016 19:48:29 +0000 (19:48 +0000)]
Rvert "Register for Service Changed notifications for untrusted devices"
am: 3b9c4610e0

Change-Id: I18923bae68b0b186ab43f7bbb05ccc171980264b

8 years agoRvert "Register for Service Changed notifications for untrusted devices"
Satomi [Tue, 9 Aug 2016 16:30:11 +0000 (09:30 -0700)]
Rvert "Register for Service Changed notifications for untrusted devices"

This reverts commit 5f0e23d532f4f90d081ccc0e294f404eb5e5b688.

Instead of reusing service discovery data, gatt profile initiates
discovery by service uuid before regular service discovery is started,
and both discovery procedures interfere with each other.
As a result, link is dropped.

Bug: 30462943
Bug: 30481143
Change-Id: Ic63339f4f46eda70e575a4103974766d54a9d624
Signed-off-by: Satomi <michitsuta@casio.co.jp>
8 years agoFix APR crashes in read rssi callback
Jakub Pawlowski [Fri, 5 Aug 2016 19:07:32 +0000 (19:07 +0000)]
Fix APR crashes in read rssi callback
am: 17be4ae79a

Change-Id: I3d36ea5bc06e20be72103c9028e2719bc393a4de

8 years agoFix APR crashes in read rssi callback
Jakub Pawlowski [Fri, 5 Aug 2016 12:32:37 +0000 (05:32 -0700)]
Fix APR crashes in read rssi callback

When read RSSI timeouts, callback is called with NULL result. This was
causing crash.

Bug: 30562545
Change-Id: If379c2de4ceab48c021601851a8c83f995440460

8 years agoAdd dumpsys support for LE connection parameter updates
Jacky Cheung [Fri, 29 Jul 2016 23:39:39 +0000 (16:39 -0700)]
Add dumpsys support for LE connection parameter updates

Change-Id: Ia79483c72d3b0cfc1e339f9f4ac65295e68e8e5d

8 years agoMerge \"audio_a2dp_hw: Always update frame counter in out_write\" into nyc-mr1-dev
Andy Hung [Thu, 28 Jul 2016 23:50:06 +0000 (23:50 +0000)]
Merge \"audio_a2dp_hw: Always update frame counter in out_write\" into nyc-mr1-dev
am: ac9f5fbfa3

Change-Id: Ifc8aa0a9649c8f92190c372c4c816fbb1cbd4072

8 years agoaudio_a2dp_hw: Always update frame counter in out_write
Andy Hung [Thu, 28 Jul 2016 23:49:59 +0000 (23:49 +0000)]
audio_a2dp_hw: Always update frame counter in out_write
am: f4a37b255d

Change-Id: Idb6e3e27f412da21e14e45addaf31d0fa82e9ea4

8 years agoMerge "audio_a2dp_hw: Always update frame counter in out_write" into nyc-mr1-dev
Andy Hung [Thu, 28 Jul 2016 23:40:16 +0000 (23:40 +0000)]
Merge "audio_a2dp_hw: Always update frame counter in out_write" into nyc-mr1-dev

8 years agoaudio_a2dp_hw: Always update frame counter in out_write
Andy Hung [Thu, 28 Jul 2016 17:45:54 +0000 (10:45 -0700)]
audio_a2dp_hw: Always update frame counter in out_write

Required now that we always return success.

Bug: 30025777
Change-Id: I7db51321672c128039545cc0fb604c615f169bc3

8 years agoProper handling of AV connection collision
Ayan Ghosh [Thu, 28 Jul 2016 01:27:53 +0000 (01:27 +0000)]
Proper handling of AV connection collision
am: b82a27ed32

Change-Id: I2e6ad58ff61b95d3c6460d169e24702213bd31d5

8 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
(cherry picked from commit db1e3a5fbb41cd1faf572c5f89ec9212c5ff2986)

8 years agoRevert "Remove position dependent lookup tables in AT command parser"
Tom Turney [Mon, 25 Jul 2016 21:23:30 +0000 (21:23 +0000)]
Revert "Remove position dependent lookup tables in AT command parser"

This reverts commit 1e7afc829bde75489d14669b2baea1e9c47b1d56.

Revert Reason: This CL causes regressions b/30367872, b/30368041,
b/30368763.

Change-Id: I48da5caac1e9fe32462c236385f768b896fa6542

8 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.

Change-Id: I84f7d4f4a803e6e52bf2021c6c74917e90bbc846
Fixes: 29978908

8 years agoGATT: Deregister notification when a GATT connection is closed
ugo_yu [Fri, 3 Jun 2016 10:04:24 +0000 (18:04 +0800)]
GATT: Deregister notification when a GATT connection is closed

Precondition:
1. Pair with specific HOGP mouse.

Steps:
1. Pair with HOGP mouse (iBuffalo BSMBB09DS)
2. Unpair the mouse.
3. Pair the mouse again.

Failure:
Pairing is successful, but the mouse won't connect.

Root Cause:
Some HOGP mice send notifications before the stack writes the
client characteristic configuration descriptor.
The Bluetooth stack doesn't deregister these notifiactions
when disconnecting.

Fix:
Deregister notifications when the GATT connection closes.

Fixes: 29111689
Change-Id: I520faeaa5fc396381cb248d3a2c49efbffa12261

8 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

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
(cherry picked from commit 3737592a7846766083041e81d72a2fab0b27fb38)