OSDN Git Service

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

7 years agoRefactor module registration
Colin Cross [Tue, 27 Jun 2017 18:05:21 +0000 (11:05 -0700)]
Refactor module registration

Refactor module registration so that it doesn't need to separately
track properties.

Test: builds, no change to out/soong/build.ninja
Change-Id: I4215b710a37f53ea1d5664bb0f7abbd42d25a3e9

7 years agogofmt -w build/fluoride.go
Colin Cross [Tue, 27 Jun 2017 18:15:25 +0000 (11:15 -0700)]
gofmt -w build/fluoride.go

Test: builds
Change-Id: I158eff9274c97eb59e4e3a63a39d0d5df501cee4

7 years agoDon't send the LE Set Privacy Mode command if it's not supported
Jakub Pawlowski [Mon, 26 Jun 2017 18:26:46 +0000 (11:26 -0700)]
Don't send the LE Set Privacy Mode command if it's not supported

LE Set Privacy Mode is currently guarded by LE Privacy feature, which is
enabled on some 4.x controllers, that don't support LE Set Privcay Mode
that was added in 5.0 spec.

Bug: 62809491
Test: Turn Bluetooth on/off with Angler (4.x) and check for
      Set Privacy Mode
Change-Id: Ie9a164d98558db2e1fe76d90eb6ab93e4cec89d0

7 years agobtif: Pass UIDs changed up to the Java layer
Marie Janssen [Fri, 23 Jun 2017 00:21:10 +0000 (17:21 -0700)]
btif: Pass UIDs changed up to the Java layer

Previously we were simply responding with an INTERIM response and
leaving it at that.

Test: connect to BMW kit and check that interim is sent from Java
Bug: 62775732
Change-Id: Idb7de4417438f0c9697ee5c838b511cdd2223e80

7 years agobluetoothtbd common library reconfiguration
Jakub Pawlowski [Sat, 24 Jun 2017 22:25:07 +0000 (15:25 -0700)]
bluetoothtbd common library reconfiguration

This patch change how code in service/common directory is compiled. Up
till now, .cc files were generated from .aidl, and the .cc files were
build for each target that used them. From now on, static lib is build
from .aidl and .cc files, and it is included into all targets that
require them.

This reduces build steps from around 1240 to 849.

Test: compilation test
Change-Id: Iebaf0c75497bc435dcc013be09a1f82e75547aa3

7 years agoFix crashes on stack shutdown
Jakub Pawlowski [Thu, 22 Jun 2017 19:45:30 +0000 (12:45 -0700)]
Fix crashes on stack shutdown

During stack shutdown, Unregister would sometimes get called after the
stack is already cleaned up, and the AdvertiseManager::Get would crash
on null check assertion. Ensure that stack is initialized before
Unregister call.

Bug: 37888261
Test: none
Change-Id: I7a4bbcd24ec7d24d21d04fe842985baaac899321

7 years agoFix BLE remote address resolution
Jacky Cheung [Wed, 21 Jun 2017 16:44:23 +0000 (09:44 -0700)]
Fix BLE remote address resolution

The hash segment of the resolvable device address needs to be extracted
for comparison.

Bug: 62589903
Test: manual
Change-Id: I979a8ad3074b692503b0c882bd90041ba4fbfb4d

7 years agoUse references in GATT client/server API (2/3)
Jakub Pawlowski [Wed, 21 Jun 2017 07:00:18 +0000 (00:00 -0700)]
Use references in GATT client/server API (2/3)

This allows to get rid of some unnecessary null checks, and guarantee
proper values are passed.

Test: compilation test
Change-Id: I1b790dba0cfc3ab02984c3911d83a6f413a1e7e6

7 years agoFix peer address type in LE extended create connection command
Subramanian Srinivasan [Fri, 9 Jun 2017 00:19:05 +0000 (17:19 -0700)]
Fix peer address type in LE extended create connection command

As per BT Spec 5.0, peer address type in LE extended create
connection command can have only either 0x00 or 0x01 as valid
values. This change fixes setting of incorrect peer address
type values in extended create connection command.

Bug: 62578331
Bug: 62358300
Change-Id: I792d48be7637fc571727e7e51de1fc397158b4d5

7 years agoMerge "Make GATT client and server assumption about addres type in open identical"
Jakub Pawlowski [Wed, 21 Jun 2017 14:24:54 +0000 (14:24 +0000)]
Merge "Make GATT client and server assumption about addres type in open identical"

7 years agoMake GATT client and server assumption about addres type in open identical
Jakub Pawlowski [Tue, 20 Jun 2017 18:40:36 +0000 (11:40 -0700)]
Make GATT client and server assumption about addres type in open identical

When attempting to open GATT server to device of unknown type, it should
make same assumption about the type as GATT client, which is LE device.

Test: compilation test
Bug: 62827460
Change-Id: Ic96de97445a843ef3c482fd5b54098b325fb0f9c

7 years agoUnify the empty and any address usage
Jakub Pawlowski [Mon, 19 Jun 2017 18:35:07 +0000 (11:35 -0700)]
Unify the empty and any address usage

Test: compilation test
Change-Id: Ic7fae4aa6c6c32e08fbca257dd3629f4f8df92f0

7 years agoMerge "Disable 48.0kHz sampling rate for AAC - update the unit test"
Treehugger Robot [Tue, 20 Jun 2017 16:19:38 +0000 (16:19 +0000)]
Merge "Disable 48.0kHz sampling rate for AAC - update the unit test"

7 years agoDisable 48.0kHz sampling rate for AAC - update the unit test
Pavlin Radoslavov [Tue, 20 Jun 2017 04:12:37 +0000 (21:12 -0700)]
Disable 48.0kHz sampling rate for AAC - update the unit test

Some carkits have issues playing A2DP audio using AAC with 48.0kHz
sampling rate, while playing AAC with 44.1kHz sampling rate is fine.

Bug: 38443632
Bug: 62301376
Test: manual
Change-Id: I5a8b72e86fb1a2cbf92f85e7a6c340cee58dadb5

7 years agoGet rid of BD_ADDR
Jakub Pawlowski [Fri, 16 Jun 2017 22:16:15 +0000 (15:16 -0700)]
Get rid of BD_ADDR

Test: compilation test
Change-Id: I8493485873a81f897fbaef1504076ef18274a8a5

7 years agoGet rid of bdcpy, bdcmp and other BD_ADDR helpers
Jakub Pawlowski [Fri, 16 Jun 2017 20:55:52 +0000 (13:55 -0700)]
Get rid of bdcpy, bdcmp and other BD_ADDR helpers

Test: compilation test
Change-Id: I37f17bfb3826b59797373645691c61bfbaefdbfd

7 years agoReplace BT_ADDR with bd_addr_t in bta_sys related code
Jakub Pawlowski [Fri, 16 Jun 2017 19:52:23 +0000 (12:52 -0700)]
Replace BT_ADDR with bd_addr_t in bta_sys related code

Test: compilation test
Change-Id: Idab6e9c03621c5540b4a3a7fa537dff71a25ce3f

7 years agoReplace BD_ADDR with bt_addr_t in MCE related code
Jakub Pawlowski [Fri, 16 Jun 2017 17:54:34 +0000 (10:54 -0700)]
Replace BD_ADDR with bt_addr_t in MCE related code

Test: compilation test
Change-Id: Icfb69cafa55bcd0f4e0146577deb05bb881672cd

7 years agoBuild fix for AOSP
Jakub Pawlowski [Tue, 20 Jun 2017 02:41:06 +0000 (19:41 -0700)]
Build fix for AOSP

Test: compilation test
Change-Id: I66a4854834f0528fad2cf76b5b1d0a48a9038948

7 years agoReplace BD_ADDR with bt_bdaddr_t in RFCOMM related code
Jakub Pawlowski [Fri, 16 Jun 2017 17:46:47 +0000 (10:46 -0700)]
Replace BD_ADDR with bt_bdaddr_t in RFCOMM related code

Test: compilation test
Change-Id: I591049f0f4ea9fa60b1b9f0271e1a906a2a06f30

7 years agoReplace BD_ADDR with bt_bdaddr_t in SDP and A2DP related code
Jakub Pawlowski [Fri, 16 Jun 2017 17:00:46 +0000 (10:00 -0700)]
Replace BD_ADDR with bt_bdaddr_t in SDP and A2DP related code

Test: compilation test
Change-Id: I59a69d56377d38f349def6b24aa5c7d5a3d4f859

7 years agoReplace BD_ADDR with bt_bdaddr_t in hf client related code
Jakub Pawlowski [Fri, 16 Jun 2017 16:35:52 +0000 (09:35 -0700)]
Replace BD_ADDR with bt_bdaddr_t in hf client related code

Test: compilation test
Change-Id: Iee6b07b6a919e5d061a04cb3d919166661e673e8

7 years agoReplace BD_ADDR with bt_bdaddr_t in JV related code
Jakub Pawlowski [Fri, 16 Jun 2017 15:42:05 +0000 (08:42 -0700)]
Replace BD_ADDR with bt_bdaddr_t in JV related code

Test: compilation test
Change-Id: Ie0cf491506ebb898ba968586048d2b58248ba112

7 years agouse bt_bdaddr_t instead of BD_ADDR in PAN related code
Jakub Pawlowski [Thu, 15 Jun 2017 18:53:33 +0000 (11:53 -0700)]
use bt_bdaddr_t instead of BD_ADDR in PAN related code

Test: compilation test
Change-Id: I1fced7529f3d91bf429c179cf4eba5157b35c8fd

7 years agoReplace BD_ADDR with bt_bdaddr_t in HL related code
Jakub Pawlowski [Thu, 15 Jun 2017 18:10:08 +0000 (11:10 -0700)]
Replace BD_ADDR with bt_bdaddr_t in HL related code

Test: compilation test
Change-Id: Ife04e0839a4a6f61b77a60f49bf44ab5bdacc874

7 years agoUse bt_bdaddr_t instead of BD_ADDR in AVDT related code
Jakub Pawlowski [Wed, 14 Jun 2017 00:53:54 +0000 (17:53 -0700)]
Use bt_bdaddr_t instead of BD_ADDR in AVDT related code

Test: compilation test
Change-Id: Ibdfd79972d2270303cf1d2e0da26b23d8d5d62d5

7 years agoGet rid of no longer necessary bt_bdaddr_t helpers
Jakub Pawlowski [Thu, 15 Jun 2017 14:16:16 +0000 (07:16 -0700)]
Get rid of no longer necessary bt_bdaddr_t helpers

This are now implemented by the "==" and copy operator

Test: compilation test

Change-Id: I4438c54a9238ad9f3083f7f8a8159d1b7f0f9b32

7 years agoAdd a mechanism to avoid using AVDTP RECONFIGURE for blacklisted devices
Pavlin Radoslavov [Mon, 19 Jun 2017 19:44:11 +0000 (12:44 -0700)]
Add a mechanism to avoid using AVDTP RECONFIGURE for blacklisted devices

Some carkits report SUCCESS for AVDTP RECONFIGURE commands when
changing A2DP codec configuration. However, there is no audio coming
from the carkit.

Bug: 37625892
Test: Manual - A2DP Codec reconfiguration while streaming audio
Change-Id: I01f37a2514e490986a20e96ace78c92463403396

7 years agoGet rid of last mentions of BD_ADDR from btif.
Jakub Pawlowski [Thu, 15 Jun 2017 21:48:35 +0000 (14:48 -0700)]
Get rid of last mentions of BD_ADDR from btif.

Test: compilation test
Change-Id: I22f6b01b1a69eca96b05319692a2eb82ecc186a8

7 years agoMerge "Bluetooth 5: Update LE2M implementation through DM (3/3)"
Treehugger Robot [Thu, 15 Jun 2017 17:50:28 +0000 (17:50 +0000)]
Merge "Bluetooth 5: Update LE2M implementation through DM (3/3)"

7 years agoBluetooth 5: Update LE2M implementation through DM (3/3)
Avish Shah [Thu, 13 Apr 2017 11:45:20 +0000 (17:15 +0530)]
Bluetooth 5: Update LE2M implementation through DM (3/3)

This patch moves LE2M implementation to the DM instead of tied to GATT.

Below are the reasons to make this change:
1) Per link setting usually be done under DM, such as link policy etc.
2) In the future, if LECOC is coming to use in more profile/apps,
   we can not rely on GATT API for these. Separate API should be required.
3) we could have multiple logical GATT user on top of the same link.
4) Also this will avoid duplicating all the APIs on GATTC and GATTS.

Bug: 37586939
Test: sl4a PhyTest passed
Change-Id: I7330be85d1bb98a4cc66b69462b01c23c9375362

7 years agoFix btm_ble_get_acl_remote_addr
Jakub Pawlowski [Thu, 15 Jun 2017 15:32:56 +0000 (08:32 -0700)]
Fix btm_ble_get_acl_remote_addr

Second parameter, conn_addr, should be assigned the value. Right now we
only modify the place in memory where the pointer points to.
This bug was introduced in commit
c2276b06572ab6fc1f900fbb1f41087e77d47e2a

Test: compilation test
Change-Id: If52a6b02f4ad0d88a6461a4d76e4f8317dcaac9f

7 years agoFix bad comparison in btm_ble_refresh_local_resolvable_private_addr
Jakub Pawlowski [Thu, 15 Jun 2017 15:22:24 +0000 (08:22 -0700)]
Fix bad comparison in btm_ble_refresh_local_resolvable_private_addr

This issue was introduced while switching from BD_ADDR to bt_bdaddr_t

Test: Pairing with BLE mouse
Change-Id: I6f6e2386cbd8449bd38d65d1d9c1c5a0032f2156

7 years agoFix build breakage from change I8d1bd6914aec55bb53495b1d0d5e3d37b86865e6
Ivan Podogov [Wed, 14 Jun 2017 10:40:36 +0000 (11:40 +0100)]
Fix build breakage from change I8d1bd6914aec55bb53495b1d0d5e3d37b86865e6

Test: manual build
Change-Id: I7d37ee188d2258e3a52c700c7748b53804cb1c0a

7 years agoUse bt_bdaddr_t instead of BD_ADDR in HID related code
Jakub Pawlowski [Fri, 9 Jun 2017 23:00:25 +0000 (16:00 -0700)]
Use bt_bdaddr_t instead of BD_ADDR in HID related code

Test: compilation test, sl4a GattReadTest
Change-Id: I4e91375746fbd966608a830ff71de79be2b99e6c

7 years agoFix HID crashing on no descriptor
Jakub Pawlowski [Tue, 13 Jun 2017 21:16:57 +0000 (14:16 -0700)]
Fix HID crashing on no descriptor

Bug: 62461796
Test: compilation test
Change-Id: Ic7b1fcc4b6f3c8680f1810679ed609f2691fa4aa

7 years agoFix for fugu build
Jakub Pawlowski [Tue, 13 Jun 2017 23:41:45 +0000 (16:41 -0700)]
Fix for fugu build

Test: compilation with BLE_PRIVACY_SPT=TRUE
Change-Id: I1765ad009368077bb4c0be9673a27a9df428f41f

7 years agoUse bt_bdaddr_t instead of BD_ADDR
Jakub Pawlowski [Fri, 9 Jun 2017 23:00:25 +0000 (16:00 -0700)]
Use bt_bdaddr_t instead of BD_ADDR

Test: compilation test, sl4a GattReadTest
Change-Id: I8d1bd6914aec55bb53495b1d0d5e3d37b86865e6

7 years agoMerge "Fix some includes"
Treehugger Robot [Tue, 13 Jun 2017 20:36:18 +0000 (20:36 +0000)]
Merge "Fix some includes"

7 years agoFix some includes
Bailey Forrest [Mon, 12 Jun 2017 23:48:02 +0000 (16:48 -0700)]
Fix some includes

- include fcntl.h for O_WRONLY,O_CREAT,O_TRUNC
- Change sys/stat.h, sys/types.h to use <>

Bug: None
Test: Build
Change-Id: I4ce1ceeba8ffdc6ff8b47ae43fcd8764d259f067

7 years agoMove bt_bdaddr_t operator to global header file
Jakub Pawlowski [Fri, 9 Jun 2017 21:02:03 +0000 (14:02 -0700)]
Move bt_bdaddr_t operator to global header file

This is to simplify bt_bdaddr_t handling

Test: compilation
Change-Id: I06ac6c2f0402ed13a2c04f86494d3c4fd0165963

7 years agoMerge "smp: Fix long SMP_Trace_* log messages"
Treehugger Robot [Fri, 9 Jun 2017 22:00:10 +0000 (22:00 +0000)]
Merge "smp: Fix long SMP_Trace_* log messages"

7 years agoMerge "bta: Update APPL_TRACE_* logs and call parameter"
Treehugger Robot [Fri, 9 Jun 2017 21:59:05 +0000 (21:59 +0000)]
Merge "bta: Update APPL_TRACE_* logs and call parameter"

7 years agobta: Update APPL_TRACE_* logs and call parameter
jruthe [Wed, 31 May 2017 20:55:42 +0000 (13:55 -0700)]
bta: Update APPL_TRACE_* logs and call parameter

Also update messages to use __func__ rather than hard-coding
function names in log messages.

Test: Pair two devices
Change-Id: I8d3a9e293c71775caee420b8da6bc3e4385a46dd

7 years agosmp: Fix long SMP_Trace_* log messages
johnshamoon [Wed, 31 May 2017 18:32:24 +0000 (11:32 -0700)]
smp: Fix long SMP_Trace_* log messages

Test: Manually pair two devices
Change-Id: Iebf43688220922563c0e1028d9e75a4cae2fc1bd