OSDN Git Service

android-x86/system-bt.git
6 years agoMerge "Call bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE"
Treehugger Robot [Mon, 7 Aug 2017 22:49:25 +0000 (22:49 +0000)]
Merge "Call bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE"

6 years agoUse a mutex to protect the scheduling of tBTA_PM_TIMER
Pavlin Radoslavov [Sun, 6 Aug 2017 06:47:50 +0000 (23:47 -0700)]
Use a mutex to protect the scheduling of tBTA_PM_TIMER

Bug: 63689331
Test: Code compilation
Change-Id: If062f7b3e2c17cb5a1ac2c8ef0813a2fe5c5a5f5

6 years agoMerge "test_vendor: Add Iterator tests"
Treehugger Robot [Mon, 7 Aug 2017 17:42:41 +0000 (17:42 +0000)]
Merge "test_vendor: Add Iterator tests"

6 years agotest_vendor: Use Custom Iterators in L2CAP Classes
johnshamoon [Wed, 26 Jul 2017 17:28:07 +0000 (10:28 -0700)]
test_vendor: Use Custom Iterators in L2CAP Classes

Use custom bounded iterators instead of vector iterators in L2capPacket and
L2capSdu.

Test: Passes unit tests in test/l2cap_test.cc
Change-Id: I892083ec6155b18c4b222f3c38d17d2d9fef686c

6 years agotest_vendor: Add Iterator tests
johnshamoon [Tue, 25 Jul 2017 16:50:04 +0000 (09:50 -0700)]
test_vendor: Add Iterator tests

Add Iterator tests to check that the overloaded operators and bounded iterators
are implemented correctly.

Test: Run the unit tests:
out/host/linux-x86/nativetest64/test-vendor_test_host/\
test-vendor_test_host --gtest_filter=IteratorTest.*
Change-Id: I6402cc36fe6818fa972524ac20aed526128a8553

6 years agoMerge "test_vendor: Add HciPacket and Iterator classes"
Treehugger Robot [Fri, 4 Aug 2017 20:13:17 +0000 (20:13 +0000)]
Merge "test_vendor: Add HciPacket and Iterator classes"

6 years agoProtect the btif config state with a lock during cleanup
Pavlin Radoslavov [Fri, 4 Aug 2017 18:26:21 +0000 (11:26 -0700)]
Protect the btif config state with a lock during cleanup

Bug: 64186300
Test: Code compilation, enable/disable Bluetooth
Change-Id: Ic2397a128d59c9cc69cbd8252734b69eb7c02501

6 years agoAdvertisement parsing fix for zero padding
Jakub Pawlowski [Fri, 4 Aug 2017 15:56:53 +0000 (08:56 -0700)]
Advertisement parsing fix for zero padding

When AD data is zero padded, and Scan Response is appended at end, data
becomes invalid. Instead, zero paddning must be removed first.

Test: AdvertiseDataParserTest.RemoveTrailingZeros
Bug: 38489707
Change-Id: I229ca3db6c92bc06bc1429e72412417010721063

6 years agoAdded another entry to the INTEROP_2MBPS_LINK_ONLY interoperability database
Pavlin Radoslavov [Fri, 4 Aug 2017 00:34:07 +0000 (17:34 -0700)]
Added another entry to the INTEROP_2MBPS_LINK_ONLY interoperability database

Bug: 64357126
Test: Audio streaming to the affected carkit
Change-Id: I160eb3775c77fe400798f038d2aae7dd7825aacb
(cherry picked from commit a5f0a7717d129ca8164a0712e63f41cc4b60dd72)

6 years agotest_vendor: Add HciPacket and Iterator classes
johnshamoon [Wed, 19 Jul 2017 19:06:54 +0000 (12:06 -0700)]
test_vendor: Add HciPacket and Iterator classes

HciPacket is the abstract base class for all packet types.

Iterator is the custom iterator class that all packet types will use
to iterate through. The iterators in this class are bounded from
[start_of_packet, length_of_packet]. This prevents incrementing the iterator
passed the end sentinel.

Test: Passes all of the tests in test/iterator_test.cc
Change-Id: If9fec9ae32d9a23575ad3e9219b8249d164bc0d5

6 years agoDon't reuse AVDTP internal state for different purposes
Pavlin Radoslavov [Wed, 2 Aug 2017 20:52:14 +0000 (13:52 -0700)]
Don't reuse AVDTP internal state for different purposes

A number of issues were exposed by carkits that proactively try
to discover the codecs supported by the Phone and explicitly select
the A2DP codec.

* Don't reuse p_scb->p_cap for storing the most recent fetched capability
  and for storing the result configuration while reconfiguring the stream.
  Instead, use p_scb->cfg for storing the result configuration.
* Don't try to reconfigure the audio stream before all peer's capabilities
  have been retrieved.
* Don't reset p_scb->sep_info_idx after fetching all capabilities inside
  bta_av_save_caps(), otherwise the stream reconfiguration logic is
  confused. Apparently, p_scb->sep_info_idx is overused for both:
  (a) Pointing where to store the next capability while fetching the
      capabilities.
  (b) Storing the selected the SEP after the codec selection is completed.
  Resetting p_scb->sep_info_idx to 0 creates logical confusion when the
  actual selected SEP index is 0.
* Add extra debug log messages

Test: Connecting to and streaming with various carkits
Bug: 64128712
Change-Id: I5f57e9069d5402bcbb17613470ac0d29c8e45069
(cherry picked from commit c64dc1d28496b5e917d0f82317d40d3c60e6495d)

6 years agoAdd A2DP_DumpCodecInfo() API
Pavlin Radoslavov [Wed, 2 Aug 2017 20:43:44 +0000 (13:43 -0700)]
Add A2DP_DumpCodecInfo() API

The API can be used to display A2DP codec info when using |LOG_DEBUG|.

Test: Code compilation
Bug: 64128712
Change-Id: I04379b45f24adb7008365d38ccc8aa7f49ed4b73
(cherry picked from commit 81c2234305d4c84eb38f0d5a92605e3b42366f84)

6 years agoWorkaround for Traxxas
Jakub Pawlowski [Tue, 1 Aug 2017 22:12:04 +0000 (15:12 -0700)]
Workaround for Traxxas

Bug: 64252588
Test: net_test_stack_ad_parser
Change-Id: I1471e9e5f0f36ec931f8d86c927abbc1137e2b94

6 years agoMerge "AVRCP Controller request metadata on playback."
Joseph Pirozzo [Wed, 2 Aug 2017 19:33:05 +0000 (19:33 +0000)]
Merge "AVRCP Controller request metadata on playback."

6 years agoMerge "AE: Set secondary adv max skip to zero"
Treehugger Robot [Wed, 2 Aug 2017 17:08:20 +0000 (17:08 +0000)]
Merge "AE: Set secondary adv max skip to zero"

6 years agoAVRCP Controller request metadata on playback.
Joseph Pirozzo [Tue, 1 Aug 2017 21:58:03 +0000 (14:58 -0700)]
AVRCP Controller request metadata on playback.

Track metadata is only provided when requested, and the current
implementation only requested it when there was a track change
notification.  Add a request for metadata whenever there is an
update to indicate that the play status is playing.

Bug: 63998350
Test: Start playing media, make a phone call, end a phonecall observe
metadata is correct.

Change-Id: Iea5cdacfe95c1a98cdaf73836ee6359a923f481b

7 years agotest_vendor: Rename discoverable devices.
jruthe [Tue, 1 Aug 2017 23:44:15 +0000 (16:44 -0700)]
test_vendor: Rename discoverable devices.

Test: compiles
Change-Id: I1fc1f6845995e9e816556679622db6f6d447b7b3

7 years agoAE: Set secondary adv max skip to zero
Sunny Kapdi [Tue, 13 Jun 2017 19:20:04 +0000 (12:20 -0700)]
AE: Set secondary adv max skip to zero

Setting secondary adv max skip to zero to guarantee
when the AUX Tx happens. This way the App can use the
primary advertising interval to dictate the AUX Tx
interval.

Bug: 62552121
Change-Id: Id66222e4f8a583c42acafb6532f81a817504e606

7 years agoMerge "Fix processing of Inquiry results data"
Treehugger Robot [Tue, 1 Aug 2017 05:59:41 +0000 (05:59 +0000)]
Merge "Fix processing of Inquiry results data"

7 years agoUse the correct AVDTP version-specific features
Satish Kodishala [Fri, 24 Feb 2017 09:39:01 +0000 (15:09 +0530)]
Use the correct AVDTP version-specific features

Failure:
A2DP is not reconnected after power cycling DUT BT.

Root cause:
AVDTP v1.3 feature request (AVDT_GetAllCapReq) sent by DUT
as remote supports the same, but this 1.3 feature is not
completely supported by DUT which leads to erroneous behavior.

Fix:
Use AVDT_GetAllCapReq request only when both host and remote
AVDTP version are 1.3 and above.

Test: 1.Pair to CarKit; 2.Connect to CarKit; 3.Do BT power cycle @ DUT
Bug: 35657623
Change-Id: I66c2d7d8fe8506b74282bcca93595e1cbf5c2565

7 years agoFix processing of Inquiry results data
Subramanian Srinivasan [Fri, 26 May 2017 00:05:11 +0000 (17:05 -0700)]
Fix processing of Inquiry results data

Process inquiry results data based on the data
length sent from the lower stack layers and not
by using HCI_EXT_INQ_RESPONSE_LEN.

Bug: 62589724
Change-Id: Iee4a2c8f0dfb459404b28ba21061f7ced9f8455c

7 years agoFix the MAC address for INTEROP_2MBPS_LINK_ONLY entry
Pavlin Radoslavov [Mon, 31 Jul 2017 03:18:57 +0000 (20:18 -0700)]
Fix the MAC address for INTEROP_2MBPS_LINK_ONLY entry

Bug: 62394764
Test: Code compilation
Change-Id: I3e6d8bb8258d6cc56ce05d7f17dda445859f011a

7 years agoAdd interoperability mechanism to restrict the AVDTP MTU for AAC codec
Pavlin Radoslavov [Fri, 28 Jul 2017 02:19:32 +0000 (19:19 -0700)]
Add interoperability mechanism to restrict the AVDTP MTU for AAC codec

Also, add an interoperability entry for devices that are known
to have AAC-related issues.

Test: A2DP streaming to Headsets
Bug: 63725151
Change-Id: Ic9b6640da44ebc28bfa63a19a87f0543d69bc576

7 years agoRetry authentication in key-missing or pairing collision use case
Matadeen Mishra [Fri, 17 Feb 2017 07:10:53 +0000 (12:40 +0530)]
Retry authentication in key-missing or pairing collision use case

Problem:
A2DP connection failing with connection timeout

Steps:
1. Pair and connect car kit from DUT
2. Disconnect the car kit from DUT
3  Unpair DUT from car kit menu and initiate pairing from car kit.
   Pairing and A2DP connection should be successful.

Failure:
Paring and A2DP connections fail

Root Cause:
As the stack posting authentication failure to upper layers
when SOC gives key missing error code remote removed from
DUT paired list, but same time lower layers keep retrying
for missing key and leading to connection failure.

Fix:
Don't post authentication complete to upper layers when stack
re trying for security in key missing or transaction collision cases

Test: manual
Bug: 35448920
Change-Id: I970c8679bf27801fe46f8dd757d6435ed500f77f
(cherry picked from commit 35752e32fb5d859c012f6d06f2c22fa6b1f84174)

7 years agoMerge "Revert "bt: Update libchrome APIS to r456626.""
Eric Laurent [Wed, 26 Jul 2017 20:02:18 +0000 (20:02 +0000)]
Merge "Revert "bt: Update libchrome APIS to r456626.""

7 years agoMerge "Use a mutex to protect the consistency of the tBTA_PM_TIMER state"
Treehugger Robot [Wed, 26 Jul 2017 19:48:05 +0000 (19:48 +0000)]
Merge "Use a mutex to protect the consistency of the tBTA_PM_TIMER state"

7 years agoMerge "HFP Client connect Audio"
Treehugger Robot [Wed, 26 Jul 2017 18:30:08 +0000 (18:30 +0000)]
Merge "HFP Client connect Audio"

7 years agoMerge "Remove unwanted space characters from dialing number"
Treehugger Robot [Wed, 26 Jul 2017 17:50:46 +0000 (17:50 +0000)]
Merge "Remove unwanted space characters from dialing number"

7 years agoRevert "bt: Update libchrome APIS to r456626."
Luis Hector Chavez [Wed, 26 Jul 2017 17:36:20 +0000 (17:36 +0000)]
Revert "bt: Update libchrome APIS to r456626."

This reverts commit 014890b74878022db7d23be47db179ba06e01856.

Reason for revert: Broke the mac_sdk
Exempt-From-Owner-Approval: Fixing mac_sdk

Change-Id: I11652839faf8430a7ee6ad64af0a7bd6985478e8

7 years agoUse a mutex to protect the consistency of the tBTA_PM_TIMER state
Pavlin Radoslavov [Wed, 26 Jul 2017 06:55:04 +0000 (23:55 -0700)]
Use a mutex to protect the consistency of the tBTA_PM_TIMER state

Bug: 63689331
Test: Code compilation
Change-Id: Id8ab78473e1f766d5a76b967024b7ff4af499667

7 years agoCall bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE
Bailey Forrest [Wed, 26 Jul 2017 02:50:39 +0000 (19:50 -0700)]
Call bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE

Without bta_dm_sp_cback, bluetooth.h platform API does not function
correctly when BTM_IO_CAP_NONE is set.
- bond_state_changed_callback is never called
- get_remote_device_properties returns nothing

This reverts eb1ad1d47b84767d9af180243cb14ac409331a0d

Bug: 63603696
Test: Test on device. bond_state_changed_callback called
Change-Id: If8d537355eb12c84ecbf5eb2d07fb27b178d9c66

7 years agoHFP Client connect Audio
Joseph Pirozzo [Thu, 29 Jun 2017 21:23:01 +0000 (14:23 -0700)]
HFP Client connect Audio

Listen for incomming SCO connections any time the Hands Free Profile is
connected to a phone.  Additionally allow eSCO connections on devices
that only support the standard SBC audio codec.

Bug: 62086689
Test: pair and connect a phone via HFP then start a phonecall and
enable and disable audio routing through BT observe that the connection
is established everytime.

Change-Id: I11319a4a85f8c9d36114a6fc09da0f0b8da16672

7 years agoRemove unwanted space characters from dialing number
Stanley Tng [Tue, 25 Jul 2017 17:07:05 +0000 (10:07 -0700)]
Remove unwanted space characters from dialing number

Certain car kits might send an AT command with space characters in
the dialing number. This commit adds a workaround to trim these unwanted
space characters.

Bug: 6340999
Test: Manual test with a car kit but purposely added numbers with spaces.
Change-Id: I9c238bc625fff8503c45cbbfaeb8bdd15b8a7d9a

7 years agobt: Update libchrome APIS to r456626.
Jay Civelli [Mon, 27 Mar 2017 16:53:18 +0000 (09:53 -0700)]
bt: Update libchrome APIS to r456626.

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

Change-Id: If5ea3659905f485fd0513c75e9d4f7c99b390c16

7 years agoMerge "test_vendor: Add base implementation"
Treehugger Robot [Sat, 22 Jul 2017 03:42:59 +0000 (03:42 +0000)]
Merge "test_vendor: Add base implementation"

7 years agoMerge "Remove static library from required modules list"
Treehugger Robot [Fri, 21 Jul 2017 22:57:44 +0000 (22:57 +0000)]
Merge "Remove static library from required modules list"

7 years agoMerge "test_vendor: Change assemble function parameters"
Treehugger Robot [Fri, 21 Jul 2017 20:18:14 +0000 (20:18 +0000)]
Merge "test_vendor: Change assemble function parameters"

7 years agotest_vendor: Add base implementation
Myles Watson [Wed, 17 May 2017 18:39:18 +0000 (11:39 -0700)]
test_vendor: Add base implementation

test_vendor: Add Device and Beacon classes
Device contains properties to be modeled.  Beacon
is a simple class that inherits from Device.

test_vendor: Add a Device factory
The device factory calls the constructors and initializes
the devices.  The controller uses the factory to instantiate
devices.

test_vendor: Add a Keyboard class
Add a connectable LE device.

test_vendor: Add BrokenAdv device
Generate random broken advertisements.

test_vendor: Add scanning and connections
Add a connection class to handle data transfer.
Add scanning and connections in the controller.

Test: Compiles
Change-Id: Id9f64308447c9de4e83a2a4fa9f59c30bede75ab

7 years agotest_vendor: Change assemble function parameters
jruthe [Mon, 17 Jul 2017 23:09:12 +0000 (16:09 -0700)]
test_vendor: Change assemble function parameters

Update L2cap::assemble to take a vector of unique_ptrs to L2capSdus rather than
a vector of L2capSdu objects.

Test: Passes assemble tests in test/l2cap_tests.cc
Change-Id: I909ccb9fde6d36a7dbeb6c6d7c3d8751fe58d5f0

7 years agoFix build by adding bt_types to bluetooth.h (1/2)
johnshamoon [Fri, 21 Jul 2017 17:18:58 +0000 (10:18 -0700)]
Fix build by adding bt_types to bluetooth.h (1/2)

Allow bt_types to be included as a shared or static library.

Test: Compiles
Change-Id: I24bc3dafaddd83405bd0bfa37fd5df5b4238f253

7 years agoMerge "Revert "Always restrict the AVDTP MTU for SBC codec to MAX_2MBPS_AVDTP_MTU...
Treehugger Robot [Fri, 21 Jul 2017 03:07:54 +0000 (03:07 +0000)]
Merge "Revert "Always restrict the AVDTP MTU for SBC codec to MAX_2MBPS_AVDTP_MTU(663)""

7 years agoMerge "Reduce error conditions which cause link key deletion on auth complete"
Treehugger Robot [Fri, 21 Jul 2017 02:37:11 +0000 (02:37 +0000)]
Merge "Reduce error conditions which cause link key deletion on auth complete"

7 years agoReduce error conditions which cause link key deletion on auth complete
Andre Eisenbach [Wed, 19 Jul 2017 22:33:07 +0000 (15:33 -0700)]
Reduce error conditions which cause link key deletion on auth complete

This inverts previous conditions which attempt to limit what error
conditions cause link key deletion and instead of excluding error codes
it provides a shorter list of codes which actually DO cause link key
deletion.

As a result, temporary failures caused by page timeouts, random
disconnects etc. should no longer cause link key deletion by accident.

Fixes: 63507123
Test: manual
Change-Id: I8d51403b8d233a3c335313b8f257a562c3d01109

7 years agoRevert "Always restrict the AVDTP MTU for SBC codec to MAX_2MBPS_AVDTP_MTU(663)"
Pavlin Radoslavov [Fri, 21 Jul 2017 00:51:07 +0000 (00:51 +0000)]
Revert "Always restrict the AVDTP MTU for SBC codec to MAX_2MBPS_AVDTP_MTU(663)"

This reverts commit 9eee3a772b3f23e5c33845422203f0dec07be234.

Not needed anymore - handled by the interoperability database.

Bug: 62394764
Bug: 34127145
Test: Audio streaming to headset that supports 3Mbps
Change-Id: I143c07c171e0fe9ef882c5e506545187f9e41498

7 years agoFix the interoperability mechanism for 2Mbps-only links for audio
Pavlin Radoslavov [Fri, 21 Jul 2017 00:00:36 +0000 (17:00 -0700)]
Fix the interoperability mechanism for 2Mbps-only links for audio

Also, added two new entries to the INTEROP_2MBPS_LINK_ONLY
interoperability database.

Bug: 62394764
Test: Audio streaming to headset that supports 3Mbps
Change-Id: Idaa25e18c0b017d8859aab723244fdc2613fc159

7 years agoAdd additional LE transport lookup in BTM_ReadRSSI for DUMO device
Jacky Cheung [Thu, 20 Jul 2017 00:21:13 +0000 (17:21 -0700)]
Add additional LE transport lookup in BTM_ReadRSSI for DUMO device

Bug: 63391975
Test: CTS Bluetooth LE Secure Client Test
Change-Id: Ibde19dcef9dbd4b344771835fe5521d1f83c638a

7 years agoMerge "test_vendor: Fragment tests"
Treehugger Robot [Wed, 19 Jul 2017 22:01:48 +0000 (22:01 +0000)]
Merge "test_vendor: Fragment tests"

7 years agotest_vendor: Move include to .cc file
Myles Watson [Tue, 7 Mar 2017 13:02:01 +0000 (05:02 -0800)]
test_vendor: Move include to .cc file

Test: compile
Change-Id: Ib13830f92c305bcd9d7e688d0d4dba78499b1f5b

7 years agoMerge "test_vendor: Implement L2CAP packet fragmentation"
Treehugger Robot [Wed, 19 Jul 2017 00:19:25 +0000 (00:19 +0000)]
Merge "test_vendor: Implement L2CAP packet fragmentation"

7 years agotest_vendor: Implement L2CAP packet fragmentation
jruthe [Thu, 8 Jun 2017 22:33:32 +0000 (15:33 -0700)]
test_vendor: Implement L2CAP packet fragmentation

Added functions to fragment an L2CAP packet into SDUs of variable size.

Test: Passes all of the tests in test/l2cap_test.cc
Change-Id: Id39042c32594c2e9f54e98def432f8d1655a3b41

7 years agotest_vendor: Fragment tests
jruthe [Fri, 7 Jul 2017 22:31:45 +0000 (15:31 -0700)]
test_vendor: Fragment tests

Test: compiles
Change-Id: I55c121b5ca97801b37315126164aa01ef3db45d0

7 years agoDo not delete pairing on HCI connection timeout
Andre Eisenbach [Tue, 18 Jul 2017 22:13:55 +0000 (15:13 -0700)]
Do not delete pairing on HCI connection timeout

Change-Id: I67121f3f6d34cd82e243af11ecd735684c4ca67d
Fixes: 63796670
Test: manual

7 years agotest_vendor: Add LOG_DEBUG to L2cap::assemble
jruthe [Mon, 17 Jul 2017 18:27:35 +0000 (11:27 -0700)]
test_vendor: Add LOG_DEBUG to L2cap::assemble

Test: compiles
Change-Id: I8753215d00610dfe3ef43a09108362f94402c941

7 years agotest_vendor: Move SDU checks to L2capSdu
jruthe [Thu, 13 Jul 2017 23:56:25 +0000 (16:56 -0700)]
test_vendor: Move SDU checks to L2capSdu

Move functions that check the Segmentation and Reassembly bits of the
control field of SDU packets into the L2capSdu class from the
L2capPacket class.

Test: compiles
Change-Id: I0afc60fcf30d29b5021ddd9afa1c7320fca64969

7 years agoMerge "Add LEN_UUID_128 type check while build UUID seq"
Treehugger Robot [Mon, 17 Jul 2017 16:31:23 +0000 (16:31 +0000)]
Merge "Add LEN_UUID_128 type check while build UUID seq"

7 years agoLinux build fix
Jakub Pawlowski [Sat, 15 Jul 2017 04:08:47 +0000 (21:08 -0700)]
Linux build fix

Test: build on linux using ninja
Change-Id: I3b0102814433ca88611fbc863271fe065d443c68

7 years agotest_vendor: Add L2cap and L2capSdu assemble tests
johnshamoon [Tue, 13 Jun 2017 22:33:55 +0000 (15:33 -0700)]
test_vendor: Add L2cap and L2capSdu assemble tests

Test: Run the unit tests:
out/host/linux-x86/nativetest64/test-vendor_test_host/\
test-vendor_test_host --gtest_filter=L2capTest.*
Change-Id: I89ff2e6bbcfb58c53d872bfef007e487c2f4e3ae

7 years agoMerge "Advertise data parser - allow zero padding at end of packet"
Treehugger Robot [Sat, 15 Jul 2017 00:23:48 +0000 (00:23 +0000)]
Merge "Advertise data parser - allow zero padding at end of packet"

7 years agoAdd LEN_UUID_128 type check while build UUID seq
liuchao [Wed, 12 Apr 2017 01:33:21 +0000 (09:33 +0800)]
Add LEN_UUID_128 type check while build UUID seq

Some devices send UUIDs of invalid lengths or the length is corrupted
because of other corruption and we should fail.

Test: mm -j8
Change-Id: I2fb808282b403be7a402228f01da43790997ad65

7 years agoAdvertise data parser - allow zero padding at end of packet
Jakub Pawlowski [Fri, 14 Jul 2017 22:37:57 +0000 (15:37 -0700)]
Advertise data parser - allow zero padding at end of packet

Test: AdvertiseDataParserTest
Bug: 63123881
Change-Id: I8be9e693de557951b1048840759b5658331e9b3b

7 years agotest_vendor: L2cap Assemble additional error check
jruthe [Tue, 11 Jul 2017 21:09:51 +0000 (14:09 -0700)]
test_vendor: L2cap Assemble additional error check

Assemble now properly checks the proposed length of a segmented SDU that
is given in the first packet of any segmented SDU in accordance with
Bluetooth Core Specification Version 4.2 Volume 3 Part A 3.3.2

Test: Passed in test/l2cap_test.cc
Change-Id: Idbbd1c014bac8928affab581118f73a7d9126824

7 years agotest_vendor: Rename L2cap class to L2capPacket
jruthe [Thu, 13 Jul 2017 23:09:59 +0000 (16:09 -0700)]
test_vendor: Rename L2cap class to L2capPacket

Test: Compiles
Change-Id: I851d2af8bfeb906cee754531e72e94a832413194

7 years agoMerge "bt: fix sdp service name by removing NULL char"
Treehugger Robot [Thu, 13 Jul 2017 00:09:27 +0000 (00:09 +0000)]
Merge "bt: fix sdp service name by removing NULL char"

7 years agobt: fix sdp service name by removing NULL char
Timm Korte [Mon, 15 May 2017 06:30:00 +0000 (08:30 +0200)]
bt: fix sdp service name by removing NULL char

The Bluedroid stack uses a C string with terminating NULL char as a
service name. Since in BT, strings are TLV encoded (type, length,
value), this doesn't make sense.

Simple fix is to copy the string without the trailing NULL by
removing the "+1" after the strlen call when passing the string as
uint8_t array to the lower level functions.
The current behaviour keeps some older devices from being able to
connect to an Android providing a Serial Port profile due to having
the wrong service name (that is, including a NULL at the end instead
of the correct string).

Test: Checked against Linux BlueZ, which does not include this extra
null character.

Change-Id: I6a43024ff89ac09e4b2d2e5cfb407b6e9323f0bd
Signed-off-by: Timm Korte <timm.korte@gmail.com>
7 years agoMake GATT server code more readable
Jakub Pawlowski [Tue, 11 Jul 2017 22:36:48 +0000 (15:36 -0700)]
Make GATT server code more readable

Test: compilation test
Change-Id: Ia176d7a89ccb9590c80e5b6b8af5a3495bf2ab16

7 years agoMerge "test_vendor: Implement packet assembly for SDUs"
Treehugger Robot [Tue, 11 Jul 2017 21:16:16 +0000 (21:16 +0000)]
Merge "test_vendor: Implement packet assembly for SDUs"

7 years agotest_vendor: Implement packet assembly for SDUs
jruthe [Thu, 8 Jun 2017 22:33:32 +0000 (15:33 -0700)]
test_vendor: Implement packet assembly for SDUs

Created l2cap.* and l2cap_sdu.* for assembling an L2CAP packet from a
stream of SDU packets.

Test: Passed all tests in l2cap_test.cc and l2cap_sdu_test.cc
Change-Id: I64487ee67170b1dd4eda9555321b1ecf7ed57040

7 years agoGATT: Expose opportunistic client API to Java
Jack He [Thu, 29 Jun 2017 20:58:47 +0000 (13:58 -0700)]
GATT: Expose opportunistic client API to Java

* Opportunistic GATT connection allows system service to subscribe to
  characteristic notifications without holding the BLE connection
* Exposing this flag to Java allows Android applications to use it

Bug: 35874078
Test: make, test on Android App
Change-Id: Ic470acd63bf45d1c33696abed1e93b30746fb7a2

7 years agoMerge "Mark libbluetooth-types as vendor_available"
Treehugger Robot [Fri, 7 Jul 2017 06:27:41 +0000 (06:27 +0000)]
Merge "Mark libbluetooth-types as vendor_available"

7 years agoDo not delete device record on HCI_ERR_KEY_MISSING
Jinguang Dong [Wed, 28 Jun 2017 01:50:37 +0000 (09:50 +0800)]
Do not delete device record on HCI_ERR_KEY_MISSING

If an auth_complete event is received with HCI_ERR_KEY_MISSING, the
p_dev_rec->sm4 flag will be set to "BTM_SM4_UNKNOWN" in the
BTM_SecClearSecurityFlags() function. This will prevent the
BTM_SM4_RETRY procedure from being executed, which can cause
pairing failures.

To reproduce:
 1. Two Phones, A: Android O, B: Android N.
 2. Enable B in Bluetooth visable mode
 3. A start discovery and create pairing with B successfully
 4. B cancel pairing with A by remove A from pairing device
    list of B.
 5. A create paring with B again by touch paired device in A,
    this first step will be failed.

Bug: 62615213
Test: manual
Change-Id: I514ba2f4d0fd2621c11bd83aeec24b8c6c6d2d5a
Signed-off-by: Yequan Song <songyequan@huawei.com>
7 years agoMark libbluetooth-types as vendor_available
Jiyong Park [Fri, 7 Jul 2017 04:29:16 +0000 (13:29 +0900)]
Mark libbluetooth-types as vendor_available

libbluetooty-types is used by a vendor module
android.hardware.bluetooth@1.0-service.sim, thus marking it as
vendor_available so that the lib is allowed for the HAL service when
building with BOARD_VNDK_VERSION.

Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j
android.hardware.bluetooth@1.0-service.sim

Change-Id: I39d071fc249ce6842e7175751abd6249b9367231

7 years agoMerge "Make RawAddress into a class (1/3)"
Treehugger Robot [Fri, 7 Jul 2017 01:29:30 +0000 (01:29 +0000)]
Merge "Make RawAddress into a class (1/3)"

7 years agoRemove static library from required modules list
Colin Cross [Thu, 6 Jul 2017 23:56:55 +0000 (16:56 -0700)]
Remove static library from required modules list

Requring an uninstallable module doesn't make sense.

Bug: 63400769
Test: builds
Change-Id: Idf452d8ee09c302d230c7a05b04d97f4bdfca98b

7 years agoMake RawAddress into a class (1/3)
Jakub Pawlowski [Mon, 3 Jul 2017 22:39:36 +0000 (15:39 -0700)]
Make RawAddress into a class (1/3)

* Add libbluetooth-types - library containing types implementation, that
is common between stystem/bt and packages/apps/Bluetooth. It must be
included in every project using btif interface.
* Put Raw Address implementation into libbluetooth-types
* Unify all "to/from string" helper methods into ToString and FromString
* bd_addr_empty -> RawAddress::kEmpty
* bd_addr_any -> RawAddress::kAny

Also fix leaks in jni str2addr by adding ReleaseStringUTFChars

Test: types_unittest
Change-Id: Ie0694843ad5fbd2a80b310c5f532e5e5a9548043
Merged-In: Ie0694843ad5fbd2a80b310c5f532e5e5a9548043

7 years agoRemove unused BDADDR definitions
Myles Watson [Wed, 28 Jun 2017 17:28:47 +0000 (10:28 -0700)]
Remove unused BDADDR definitions

The code that used these moved to the HAL.

Test: build
Change-Id: I4a25b525ff60c060143ea913c800c4dea8f676e1

7 years agoMerge "Remove bta_closure in favor of posting messages to a message loop"
Treehugger Robot [Thu, 6 Jul 2017 17:39:05 +0000 (17:39 +0000)]
Merge "Remove bta_closure in favor of posting messages to a message loop"

7 years agoMerge "Add missing lock protection when freeing RFCOMM port queues"
Treehugger Robot [Thu, 6 Jul 2017 17:19:53 +0000 (17:19 +0000)]
Merge "Add missing lock protection when freeing RFCOMM port queues"

7 years agoMerge "A2DP: Add mandatory elements for SBC SRC capabilities"
Treehugger Robot [Thu, 6 Jul 2017 01:47:24 +0000 (01:47 +0000)]
Merge "A2DP: Add mandatory elements for SBC SRC capabilities"

7 years agoMerge "Don't initiate role switch for blacklisted devices"
Treehugger Robot [Thu, 6 Jul 2017 00:19:02 +0000 (00:19 +0000)]
Merge "Don't initiate role switch for blacklisted devices"

7 years agoAdd missing lock protection when freeing RFCOMM port queues
Pavlin Radoslavov [Sat, 1 Jul 2017 04:25:15 +0000 (21:25 -0700)]
Add missing lock protection when freeing RFCOMM port queues

Bug: 63100223
Test: Code compilation
Change-Id: Ibbafb9586e9807688276c9eb2f6399cb3ee487c9

7 years agoMerge "Generic Bluetooth HAL for standard Linux hci interface"
Treehugger Robot [Wed, 5 Jul 2017 23:27:33 +0000 (23:27 +0000)]
Merge "Generic Bluetooth HAL for standard Linux hci interface"

7 years agoA2DP: Add mandatory elements for SBC SRC capabilities
koh.changseok [Mon, 3 Jul 2017 17:37:42 +0000 (02:37 +0900)]
A2DP: Add mandatory elements for SBC SRC capabilities

* The SBC items below are mandatory for SBC SRC capabilities
(see A2DP_SPEC_V13.pdf, Section 4.3.2):
 - Channel Mode - mono
 - Block Length - 4, 8, 12, 16
* Updated/fixed the corresponding unit tests

Bug: 63260735
Test: Manual - A2DP SBC streaming
Change-Id: I04c4f0b830411bc736d7c402b86006c182af02e7

7 years agoRemove bta_closure in favor of posting messages to a message loop
Ajay Panicker [Wed, 5 Jul 2017 20:20:53 +0000 (13:20 -0700)]
Remove bta_closure in favor of posting messages to a message loop

Test: Sanity test with Bluetooth
Change-Id: Ifda27a3bd88d82f884c4d8af6383f1c692b69e85

7 years agoGeneric Bluetooth HAL for standard Linux hci interface
Satish Patel [Wed, 28 Jun 2017 01:35:19 +0000 (18:35 -0700)]
Generic Bluetooth HAL for standard Linux hci interface

This acts as common interface for bluetooth devices (including
USB ones) using the standard Linux bluetooth hci interface.

Much of this code is pulled from hardware/interface/bluetooth
and system/bt/vendor_libs/linux.

Original code used from "system/bt/vendor_libs/linux" was from:
Samuel Ortiz <sameo@linux.intel.com>
Cristian Iorga <cristian.iorga@intel.com>
Pavlin Radoslavov <pavlin@google.com>
Jakub Pawlowski <jpawlowski@google.com>
Myles Watson <mylesgw@google.com>

Orginal code taken from hardware/interface/bluetooth was
contributed by:
Myles Watson <mylesgw@google.com>
Zach Johnson <zachoverflow@google.com>
Treehugger Robot <treehugger-gerrit@google.com>

Tested:
Hikey + on board bluetooth and Hikey + USB bluetooth dongle

Change-Id: I03da10cadfae6ffb298cfccc98e3337ab7db1967
Signed-off-by: Satish Patel <satish.patel@linaro.org>
[jstultz: Migrated code back to system/bt/vendor_libs/linux/.
 Included required sepolicy changes. Reworded and simplified
 commit message. ]
Signed-off-by: John Stultz <john.stultz@linaro.org>
7 years agoDon't initiate role switch for blacklisted devices
Srinu Jella [Wed, 7 Dec 2016 13:46:31 +0000 (19:16 +0530)]
Don't initiate role switch for blacklisted devices

Some devices always reject role switches and role switch
retries from the DUT may lead to A2DP glitches and LMP timeouts.

Test: manual
Bug: 33000157
Change-Id: I535a2c45ced0e14cf5530f78f3367569b306b1f4

7 years agoDynamic blacklist device for role switch
Srinu Jella [Thu, 8 Dec 2016 13:33:20 +0000 (19:03 +0530)]
Dynamic blacklist device for role switch

- Blacklist the device if it's rejected the role switch for
   max number of times. Same is added to the interop_database.

- Maximum number of failed (BTM_MAX_SW_ROLE_FAILED_ATTEMPTS)
  attempts set to 3 and it is configurable.

- Same blacklisted device is referred by the BTM module when
  any other module like profile is requesting for role switch
  and BTM module returns BTM_REPEATED_ATTEMPTS as the switch
  role status.

Test: Code compilation
Bug: 32999957
Change-Id: Ie999104a2c8ca507605ef3e1d454865cee98dcd2

7 years agoMerge "Add stdint.h for uint*_t types"
Treehugger Robot [Sun, 2 Jul 2017 03:38:39 +0000 (03:38 +0000)]
Merge "Add stdint.h for uint*_t types"

7 years agoRead the correct amount of attributes
Scott Bauer [Fri, 7 Apr 2017 00:35:40 +0000 (18:35 -0600)]
Read the correct amount of attributes

bta_gattc_cache_load currently attempts to read 0xFF attributes into an
allocation sized to num_attr attributes, which can be smaller than 0xFF.

There aren't more than num_attr bytes in correct data, but this breaks
with dynamic buffer overflow checking in CopperheadOS for the read
system call since fread ends up calling read, which obtains the size of
the allocation from the malloc implementation and then aborts due to the
(potential) overflow.

This would also fail with the default enabled _FORTIFY_SOURCE=2 feature
in the Android Open Source Project if osi_malloc was marked with the
alloc_size attribute. The way it wraps malloc loses that information so
fortify checks aren't done for calls like this.

Change-Id: I68bd170d5378c9d9d21cbda376083bc0b857e15c
Signed-off-by: Scott Bauer <sbauer@plzdonthack.me>
[migrated to C++ file, added 0xFFFF limit and wrote commit message]
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
7 years agoMerge changes from topic 'refactor_register'
Treehugger Robot [Fri, 30 Jun 2017 21:09:12 +0000 (21:09 +0000)]
Merge changes from topic 'refactor_register'

* changes:
  Refactor module registration
  gofmt -w build/fluoride.go

7 years agoAdd stdint.h for uint*_t types
Jiyong Park [Tue, 27 Jun 2017 11:51:53 +0000 (20:51 +0900)]
Add stdint.h for uint*_t types

Mising stdint.h causes problem when building with BOARD_VNDK_VERSION,
where global include path is not provided.

Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j libbt-vendor
Change-Id: I55786baed229a3c9b4282816081a503d18a5a6f0

7 years agoAllow full dev consolidation after pairing
Nitin Arora [Sat, 13 Aug 2016 00:48:11 +0000 (17:48 -0700)]
Allow full dev consolidation after pairing

When BR/EDR and LE RPA device records are present
in the device records and the same remote device is
paired on a new RPA, the device consolidation happens
after the IRK is received. The current consolidation
breaks out of the loop after consolidating one device
record. In such cases, BR dev record is left and when
BR link key is derived, it gets updated in a separate
device record. Since two device records are present at
the same time for the same remote, the keys and static
addresses get picked up from incorrect node and issues
such as "remove device from resolving list seen with {0}
static address" are seen.

The fix includes allowing the host to complete
the consolidation for all device records rather than
breaking at the fist match.

Change-Id: Ic8ea4b831a7ba971eb6a0f54573934a6079b45d5

7 years agoBluetooth - Add tracing for TX queue and LDAC ABR
Philip Cuadra [Fri, 9 Jun 2017 21:36:06 +0000 (14:36 -0700)]
Bluetooth - Add tracing for TX queue and LDAC ABR

For debugging, add tracing to show the length of the TX queue and the
LDAC ABR level.

Test:  Ran bluetooth, took a systrace

Change-Id: Ia23764d68f27ae8209e37c4a0836852d73cf6cbc

7 years agoRename bt_bdaddr_t into RawAddress (3/3)
Jakub Pawlowski [Sun, 25 Jun 2017 00:30:18 +0000 (17:30 -0700)]
Rename bt_bdaddr_t into RawAddress (3/3)

Test: compilation test
Change-Id: I4571721a0c6165a66450ee157a53d8d15bfc45d0

7 years agoMerge "Get rid of BD_ADDR (again)"
Treehugger Robot [Wed, 28 Jun 2017 21:36:09 +0000 (21:36 +0000)]
Merge "Get rid of BD_ADDR (again)"

7 years agoGet rid of BD_ADDR (again)
Jakub Pawlowski [Wed, 28 Jun 2017 19:04:53 +0000 (12:04 -0700)]
Get rid of BD_ADDR (again)

BD_ADDR and BD_ADDR_LEN were defined multiple times. Get rid of the
redefiniton.

Test: compilation test
Change-Id: Ib6e922ce88132045c13ddc28d681a0f673d87407

7 years agoSet the A2DP media channel as a high priority L2CAP link
Ben YoungTae Kim [Tue, 20 Jun 2017 13:56:08 +0000 (19:26 +0530)]
Set the A2DP media channel as a high priority L2CAP link

Use dynamic ACL buffer allocation for high priority links:
1. Ensure dedicated ACL buffers for high priority links
2. Adjust buffer allocation if the priority of the link changes

Test: Manually tested with 4 HID devices and A2DP streaming scenario
Bug: 30787081
Change-Id: Id3c4a76e360aee322e9f8073bd399807e7987990

7 years agoLE State simplification
Jakub Pawlowski [Tue, 27 Jun 2017 00:22:35 +0000 (17:22 -0700)]
LE State simplification

Test: sl4a GattReadTest
Change-Id: I53d9b9a25f39b06e3593311ed9af5b1df10637ed

7 years agoMerge "Fix a inappropriate return of local var address"
Marie Janssen [Tue, 27 Jun 2017 22:51:08 +0000 (22:51 +0000)]
Merge "Fix a inappropriate return of local var address"

7 years agoFix a inappropriate return of local var address
liuchao [Fri, 5 May 2017 03:04:33 +0000 (11:04 +0800)]
Fix a inappropriate return of local var address

Local variable address is returned through giving to
"p_db->p_attrs", which needs to be available after
returned from the function.

Test: mm -j8
Change-Id: I68744d0c925e3ea384a07ad6491fe831d59ee2fd

7 years agoHCI feature/command support check simplification
Jakub Pawlowski [Mon, 26 Jun 2017 20:06:17 +0000 (13:06 -0700)]
HCI feature/command support check simplification

Don't use one-time long constants
Test: compilation test

Change-Id: Iaab8039269215b44608193290de4d140e1399e66