OSDN Git Service

android-x86/system-bt.git
6 years agoRemove casts to unions to avoid unaligned accesses
Myles Watson [Tue, 19 Sep 2017 17:01:28 +0000 (10:01 -0700)]
Remove casts to unions to avoid unaligned accesses

Bug: 65392204
Test: sanity
Change-Id: I2886cc02289b68710e83147ba4d7715a32a4fc55

6 years agoRemove unnecesary BTA redefinitions for GATT part 4
Jakub Pawlowski [Tue, 26 Sep 2017 15:45:20 +0000 (08:45 -0700)]
Remove unnecesary BTA redefinitions for GATT part 4

Test: compilation test
Change-Id: Ibe37a1c6506d567b68497e8c7074d90cd73ddf00

6 years agoRemove unnecesary BTA redefinitions for GATT part 3
Jakub Pawlowski [Tue, 26 Sep 2017 01:47:54 +0000 (18:47 -0700)]
Remove unnecesary BTA redefinitions for GATT part 3

Test: compilation test
Change-Id: I8d4b8cfd35fcb5ccd7067f1e02dedd1a58efa3ad

6 years agoRemove unnecesary BTA redefinitions for GATT part 2
Jakub Pawlowski [Tue, 26 Sep 2017 00:41:21 +0000 (17:41 -0700)]
Remove unnecesary BTA redefinitions for GATT part 2

Test: compilation test
Change-Id: Iaf81188596c33b92f79f163dc95187ed5c6f52a4

6 years agoRemove unnecesary BTA redefinitions for GATT part 1
Jakub Pawlowski [Tue, 26 Sep 2017 00:24:46 +0000 (17:24 -0700)]
Remove unnecesary BTA redefinitions for GATT part 1

Test: compilation test
Change-Id: I98ab63a187684ae4ffbb0cb23e5c9e67994be468

6 years agoBuild fix after UUID refactor for stage branch
Jakub Pawlowski [Tue, 26 Sep 2017 05:19:01 +0000 (22:19 -0700)]
Build fix after UUID refactor for stage branch

Change-Id: Ia01fa17ba40d315a912c391211e101a951eab562

6 years agoUse one type for UUID (1/5)
Jakub Pawlowski [Mon, 10 Jul 2017 16:56:09 +0000 (09:56 -0700)]
Use one type for UUID (1/5)

Currently, we have few different representations for UUID in stack:
tBT_UUID, tSDP_UUID, bt_uuid_t, bluetooth:UUID, or uint8_t*.

Additionally, tBT_UUID and bt_uuid_t are used to hold UUID as 128bit
as Little Endian or Big Endian, depending on which part of stack (GATT
or SDP) is using it.

This patch is creating one type, bluetooth::Uuid, that will replace all
other types.

Bug: 66912853
Test: all sl4a tests for GATT and RFCOMM
Merged-In: Ia42d3233146db0488728ed6f878f99b368fe8838
Change-Id: Ia42d3233146db0488728ed6f878f99b368fe8838

6 years agoMerge "Get rid of unused _DYNAMIC_MEMORY"
Hansong Zhang [Fri, 22 Sep 2017 19:39:05 +0000 (19:39 +0000)]
Merge "Get rid of unused _DYNAMIC_MEMORY"

6 years agoMerge "btlinux: Fix sepolicy for split policy (Treble) builds"
Treehugger Robot [Fri, 22 Sep 2017 18:32:43 +0000 (18:32 +0000)]
Merge "btlinux: Fix sepolicy for split policy (Treble) builds"

6 years agoGet rid of unused _DYNAMIC_MEMORY
Hansong Zhang [Wed, 20 Sep 2017 16:31:32 +0000 (09:31 -0700)]
Get rid of unused _DYNAMIC_MEMORY

Removed the unused BTA_DYNAMIC_MEMORY and HID_DYNAMIC_LIBRARY

Bug: 27731905
Test: Manual
Change-Id: I6019584b165471c4058a2ec7ef8f278531153d18

6 years agoChange our AVRCP capabilities if the remote device only supports 1.3
Ajay Panicker [Wed, 6 Sep 2017 16:59:51 +0000 (09:59 -0700)]
Change our AVRCP capabilities if the remote device only supports 1.3

This prevents issues with devices that only support 1.3 but can not
handle forward compatability like some Alpine Carkits.

Bug: 37943083
Test: Connect to Alpine carkit that only supports 1.3 and see new features
      are used.

Change-Id: I6d041590dc51d7e8711b17fb1cb9c880b640052a
(cherry picked from commit f9f1c8b449efb9cb7894a64fe2977f875679ba52)

6 years agoBluetooth: Add AVRCP 1.3 as a developer option for AVRCP version (2/2)
Ajay Panicker [Fri, 1 Sep 2017 19:07:42 +0000 (12:07 -0700)]
Bluetooth: Add AVRCP 1.3 as a developer option for AVRCP version (2/2)

This is requied for the 2012 Mazda 3 carkit as the carkit refuses to send
AVRCP commands other than passthrough commands when the version is anything
else. AVRCP 1.3 is compatible with most carkits on the market and can be
used to get most carkits working at the cost of losing many features.

Bug: 37943083
Test: Set AVRCP 1.3 in developer options and see that SDP and the AVRCP
      capabilites have updated to reflect this.
      TestTracker: 105915/3975

Change-Id: Iffc7ed1dd91eecb699153125b25451de5826f202
(cherry picked from commit 2369a95e6ed0c16f61237fe9c1fc5a90d97129c1)

6 years agoDon't reject notifications and wait until new addressed player is ready (2/2)
Ajay Panicker [Wed, 30 Aug 2017 01:30:43 +0000 (18:30 -0700)]
Don't reject notifications and wait until new addressed player is ready (2/2)

There are some carkits like the ones found in the 2016 Honda CRZ and some
Audi's that do not follow the spec and do not honor reject pending notification
messages after switching players. This causes an issue whenever you switch
players, the metadata freezes due to the fact that the carkit never re-registers
for new track changed notifications. This patch removes the reject notification
and reorders the current notifications.

Bug: 64142363
Test: Test with Audi S7 and 2016 Honda CRZ and see that switching players works
      TestTracker: 105391/3975
Change-Id: Iaec70863594e13217916ab740d529f526d27c2d1
(cherry picked from commit dd535e70c767fe214c1634b46618d0fb5ed4385d)

6 years agoGet rid of libhardware dependency in native daemon
Jakub Pawlowski [Wed, 20 Sep 2017 20:52:11 +0000 (13:52 -0700)]
Get rid of libhardware dependency in native daemon

Test: compilation test
Bug: 66187274
Change-Id: I97ee33a55315f44dc03083d1a8da9a38d5619725

6 years agoLoosen libhardware dependency
Jakub Pawlowski [Wed, 20 Sep 2017 20:16:11 +0000 (13:16 -0700)]
Loosen libhardware dependency

In most places we don't really need the libhardware library, just the
headers.

Bug: 66187274
Test: compilation test
Change-Id: Ifa2f547165fcf8b34bc29ab80d2bd12ce02f4ae1

6 years agoEnable extra A2DP control log messages
Pavlin Radoslavov [Wed, 20 Sep 2017 03:29:33 +0000 (20:29 -0700)]
Enable extra A2DP control log messages

Also, fixed a log message when failed to accept the
corresponding socket socket.

Test: manual
Bug: 63949429
Change-Id: I6d9af32f61974a739d179c37da36c360aefcca79

6 years agoBLE Adv RPA is not updated on first timeout
Sunny Kapdi [Tue, 19 Sep 2017 01:14:13 +0000 (18:14 -0700)]
BLE Adv RPA is not updated on first timeout

BLE Advertisement RPA is getting updated with the
same RPA instead of the newly generated RPA on the
first timeout. Make sure to send the newly generated
RPA to the Controller.

CRs-Fixed: 2111232
Bug: 65857055
Change-Id: I4d8e95c26fe8e5944fdee32089b8fcaffa238367

6 years agobtlinux: Fix sepolicy for split policy (Treble) builds
Rob Herring [Mon, 18 Sep 2017 14:25:58 +0000 (09:25 -0500)]
btlinux: Fix sepolicy for split policy (Treble) builds

In full Treble builds, the btlinux HAL fails to build the sepolicy:

neverallow check failed at out/target/product/linaro_x86_64/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil:4518
from system/sepolicy/public/domain.te:673
  (neverallow base_typeattr_55 base_typeattr_56 (file (execute execute_no_trans entrypoint)))
    <root>
    allow at out/target/product/linaro_x86_64/obj/ETC/nonplat_sepolicy.cil_intermediates/nonplat_sepolicy.cil:6054
      (allow hal_bluetooth_btlinux hal_bluetooth_btlinux_exec (file (read getattr map execute entrypoint open)))

Test: Build completes successfully
Change-Id: Ibb8dbe7f2ca823c87ae4404c40cdc35656c8e0af
Signed-off-by: Rob Herring <robh@kernel.org>
6 years agoMerge "Clean-up BTIF profile queue on profile shutdown"
Treehugger Robot [Sat, 16 Sep 2017 06:24:09 +0000 (06:24 +0000)]
Merge "Clean-up BTIF profile queue on profile shutdown"

6 years agoClean-up BTIF profile queue on profile shutdown
Jack He [Fri, 15 Sep 2017 00:13:19 +0000 (17:13 -0700)]
Clean-up BTIF profile queue on profile shutdown

* Add btif_profile_cleanup(uuid) method to remove pending connection
  requests for individual UUIDs
* Call the above method in each profile's clean-up method
* Add unit tests for btif_profile_queue

Bug: 63790458
Test: make, unit tests, pair and connect car kits
Change-Id: I28288c295b7ca0259b2112c11b4e5a81d6f2e33c

6 years agoSetPreferredPhy/ReadPhy callback fix
Jakub Pawlowski [Fri, 15 Sep 2017 20:43:40 +0000 (13:43 -0700)]
SetPreferredPhy/ReadPhy callback fix

Bug: 65746728
Test: manual
Change-Id: Ifdd8e7051c953aa1c006abecd62d1af196619d98

6 years agoMerge "GAP: Set service_id before calling gap_release_ccb"
Treehugger Robot [Thu, 14 Sep 2017 23:45:01 +0000 (23:45 +0000)]
Merge "GAP: Set service_id before calling gap_release_ccb"

6 years agoGAP: Set service_id before calling gap_release_ccb
Myles Watson [Thu, 14 Sep 2017 21:13:44 +0000 (14:13 -0700)]
GAP: Set service_id before calling gap_release_ccb

Calling gap_release_ccb with a service_id == 0, which in turn
calls BTM_SecClrService with an ID of 0.

From the documentation for BTM_SecClrService:

  Service ID - Id of the service to remove. '0' removes all
               service records (except SDP).

Test: BLE connection and characteristic read
Change-Id: Icf309807f02e1faa273cf9bad9c09d9221a8bbfd

6 years agoFix included service parsing (1/3)
Jakub Pawlowski [Thu, 14 Sep 2017 18:40:32 +0000 (11:40 -0700)]
Fix included service parsing (1/3)

Bug: 65637368
Test: sl4a GattIncludedServiceTest
Change-Id: Icb882d411a75a91e3fea050f00c40e76de3539de

6 years agoAdd Suspend/Resume for advertising
Jakub Pawlowski [Mon, 28 Aug 2017 16:56:13 +0000 (09:56 -0700)]
Add Suspend/Resume for advertising

This is needed for resolving list handling.

Bug: 64846264
Test: updated unit tests
Change-Id: I3d9c7b90d3b69d459d33c4ca7a9849ca3a7abc40

6 years agoMerge "btm: Clear LINK_KEY_KNOWN flag for temporary connections"
Treehugger Robot [Tue, 12 Sep 2017 21:50:08 +0000 (21:50 +0000)]
Merge "btm: Clear LINK_KEY_KNOWN flag for temporary connections"

6 years agobtm: Clear LINK_KEY_KNOWN flag for temporary connections
Myles Watson [Tue, 12 Sep 2017 15:23:23 +0000 (08:23 -0700)]
btm: Clear LINK_KEY_KNOWN flag for temporary connections

Bug: 62561154
Test: Smart Setup, erase target, Smart Setup
Change-Id: Icba672a38772dc99a74f351301c81d66f37ee929

6 years agoFix ASAN crash inside btif_av_event_deep_copy()
Pavlin Radoslavov [Tue, 12 Sep 2017 19:08:49 +0000 (12:08 -0700)]
Fix ASAN crash inside btif_av_event_deep_copy()

Allocate sufficient data on the stack that can be safely copied inside
btif_av_event_deep_copy()

Bug: 65524264
Test: Run Bluetooth on ASAN enabled build
Change-Id: Ie6d4a28933302131c58eb4aee34161e435634377

6 years agoReturn the correct status when BTA_AV Open failed because of role switch
Pavlin Radoslavov [Tue, 12 Sep 2017 18:51:21 +0000 (11:51 -0700)]
Return the correct status when BTA_AV Open failed because of role switch

Bug: 65588660
Test: Code compilation
Change-Id: I705ec28c76f2342e18bece193005c962b9febac8

6 years agoFix MAC address byte ordering in the uniq field
Kim Low [Thu, 6 Apr 2017 01:01:34 +0000 (18:01 -0700)]
Fix MAC address byte ordering in the uniq field

The UNIQ field can be used in the driver to detect duplicate devices.
For example, if a controller is connected via both Bluetooth and USB,
the driver can use the UNIQ field, which typically contains the unique
MAC address to identify that it's the same device.

Test: Connect a Bluetooth device and check its MAC address using
      ioctl(EVIOCGUNIQ) call.
Change-Id: I458608e845fcb24c0d615f6aef8d92ccb08d08ec

6 years agostack: Fix btm_send_link_key_notif comment
Myles Watson [Tue, 12 Sep 2017 14:08:13 +0000 (07:08 -0700)]
stack: Fix btm_send_link_key_notif comment

Test: build
Change-Id: I212ac76af9fab7b11d02120cae5f6eeec14baf69

6 years agoFix alarms being posted on wrong thread
Jakub Pawlowski [Fri, 8 Sep 2017 18:26:25 +0000 (11:26 -0700)]
Fix alarms being posted on wrong thread

Alarms from btu_bta_alarm_queue and btu_generic_alarm_queue should be
processed on the main MessageLoop thread.
Replaced obsoleted alarm_set_on_queue() alarm API with the new
alarm_set_on_mloop() API

Test: manual
Bug: 65078753
Change-Id: I54b472b39b44a6c541dbdcdad7414056d0dd4163

6 years agoFix crash during derigister GATT server
Chao Quan [Mon, 24 Jul 2017 11:46:53 +0000 (19:46 +0800)]
Fix crash during derigister GATT server

When deregister a gatt server, GATT_deregister
will use a loop to stop service one by one and
call std::list::erase in GATTS_StopService to
remove service info. But erase makes iterator lose
efficacy. If the iterator is operated after that,
Bluetooth will crash.

Add the iterator before erase.

Test: manual
Change-Id: I10f9351a95ab4922553d8a77663a0212407607aa

6 years agoEnsure that services are cleaned from the GattServer HandleMap.
Jeremy Klein [Fri, 8 Sep 2017 21:04:39 +0000 (14:04 -0700)]
Ensure that services are cleaned from the GattServer HandleMap.

The incorrect service handle was being plumbed up to onServiceDeleted.
This was causing stale entries to stick around forever in the HandleMap,
which could later cause failures to find callback references in
ContextMap if the connection ID changed for a given device.

Bug: 65463237
Test: unit tests modified and run
Change-Id: I2e22858b447f4e6b5a4fbceee4c406191c84a67d

6 years agoUse strlcpy() instead of strncpy() to copy string property
Pavlin Radoslavov [Thu, 7 Sep 2017 23:22:53 +0000 (16:22 -0700)]
Use strlcpy() instead of strncpy() to copy string property

Also, allocate property with extra space for the null-termination string.

Test: Unit tests passing
Change-Id: I67452cb640cda752c3094c2b1a47eaa13c24e5c6

6 years agoRead the Tx Power level when flushing the A2DP Tx queue
Pavlin Radoslavov [Fri, 1 Sep 2017 23:40:59 +0000 (16:40 -0700)]
Read the Tx Power level when flushing the A2DP Tx queue

Also, minor renaming and cleanup (for consistency).

Test: Streaming A2DP headset and trigger audio stutter
Bug: 64038257
Change-Id: Id722342b596e0bf3c9c7664272b6d3e311bb82e9

6 years agoImplement HCI_Read_Automatic_Flush_Timeout mechanism
Pavlin Radoslavov [Fri, 1 Sep 2017 23:09:27 +0000 (16:09 -0700)]
Implement HCI_Read_Automatic_Flush_Timeout mechanism

Also, read the Automatic Flush Timeout when flushing the A2DP Tx queue

Test: Streaming A2DP headset and trigger audio stutter
Bug: 64038257
Change-Id: Ic49b5236328ddacde1d7f2aee131e35e317a14ef

6 years agoMerge "Fix GATT log spam"
Jakub Pawlowski [Thu, 7 Sep 2017 17:39:09 +0000 (17:39 +0000)]
Merge "Fix GATT log spam"

6 years agoAdd 'vendor.' prefix to a vendor HAL service name
Jaekyun Seok [Wed, 30 Aug 2017 02:17:08 +0000 (11:17 +0900)]
Add 'vendor.' prefix to a vendor HAL service name

To prevent property name collisions between properties of system and
vendor, 'vendor.' prefix must be added to a vendor HAL service name.
You can see the details in http://go/treble-sysprop-compatibility.

Test: succeeded building gce_x86_phone-userdebug and confirmed that
service names were renamed correctly.
Bug: 36796459
Change-Id: Iedcb3a01e00e80c58dc76653784a3c353f34ce0a

6 years agoFix stack-buffer-overflow in bluetooth service GATT client
Michael Spang [Wed, 6 Sep 2017 15:44:33 +0000 (11:44 -0400)]
Fix stack-buffer-overflow in bluetooth service GATT client

Use the tBTA_GATTC union for |notify| in bta_gattc_process_indicate() to
avoid a stack-buffer-overflow in btif_transfer_context.

==1410==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x0077c8c0c066 at pc 0x0077e50c9ae0 bp 0x0077c8c0bcd0 sp 0x0077c8c0b460

READ of size 616 at 0x0077c8c0c066 thread T38 (btu message loo)
    #0 0x77e50c9adf in __interceptor_memcpy external/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:701:5
    #1 0x77ca1e838f in memcpy(void*, void const* pass_object_size0, unsigned long) bionic/libc/include/string.h:173:12
    #2 0x77ca1e838f in btif_transfer_context(void (*)(unsigned short, char*), unsigned short, char*, int, void (*)(unsigned short, char*, char*)) system/bt/btif/src/btif_core.cc:208:0
    #3 0x77ca209853 in (anonymous namespace)::bta_gattc_cback(unsigned char, tBTA_GATTC*) system/bt/btif/src/btif_gatt_client.cc:204:7
    #4 0x77ca11455b in bta_gattc_process_indicate(unsigned short, unsigned char, tGATT_CL_COMPLETE*) system/bt/bta/gatt/bta_gattc_act.cc:1596:9
    #5 0x77ca40b4b7 in gatt_process_notification(tGATT_TCB&, unsigned char, unsigned short, unsigned char*) system/bt/stack/gatt/gatt_cl.cc:664:7
    #6 0x77ca40d78f in gatt_client_handle_server_rsp(tGATT_TCB&, unsigned char, unsigned short, unsigned char*) system/bt/stack/gatt/gatt_cl.cc:1119:9
    #7 0x77ca414447 in gatt_le_data_ind(unsigned short, unsigned char*, BT_HDR*) system/bt/stack/gatt/gatt_main.cc:576:7
    #8 0x77ca47665b in l2c_rcv_acl_data(BT_HDR*) system/bt/stack/l2cap/l2c_main.cc:211:9
    #9 0x77c9da50eb in base::Callback<void (), (base::internal::CopyMode)1>::Run() const external/libchrome/base/callback.h:389:12
    #10 0x77c9da50eb in base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask const&) external/libchrome/base/debug/task_annotator.cc:51:0
    #11 0x77c9df75e3 in base::MessageLoop::RunTask(base::PendingTask const&) external/libchrome/base/message_loop/message_loop.cc:494:19
    #12 0x77c9df80b7 in base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) external/libchrome/base/message_loop/message_loop.cc:503:5
    #13 0x77c9df8fb7 in base::MessageLoop::DoWork() external/libchrome/base/message_loop/message_loop.cc:627:13
    #14 0x77c9dfd33b in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) external/libchrome/base/message_loop/message_pump_default.cc:35:31
    #15 0x77c9e4e327 in base::RunLoop::Run() external/libchrome/base/run_loop.cc:35:10
    #16 0x77ca3e97ab in btu_message_loop_run(void*) system/bt/stack/btu/btu_task.cc:98:14
    #17 0x77ca52ad3b in work_queue_read_cb(void*) system/bt/osi/src/thread.cc:251:3
    #18 0x77ca52489b in run_reactor(reactor_t*, int) system/bt/osi/src/reactor.cc:282:11
    #19 0x77ca524413 in reactor_start(reactor_t*) system/bt/osi/src/reactor.cc:125:10
    #20 0x77ca529c6f in run_thread(void*) system/bt/osi/src/thread.cc:221:3
    #21 0x77eb40a31b in __pthread_start(void*) bionic/libc/bionic/pthread_create.cpp:214:18
    #22 0x77eb3c1dff in __start_thread bionic/libc/bionic/clone.cpp:47:16

002(bluetooth) btu message loo identical 2 lines

Address 0x0077c8c0c066 is located in stack of thread T38 (btu message loo)
 at offset 646 in frame

    #0 0x77ca114293 in bta_gattc_process_indicate(unsigned short, unsigned char, tGATT_CL_COMPLETE*) system/bt/bta/gatt/bta_gattc_act.cc:1538:0

002(bluetooth) btu message loo identical 1 line

  This frame has 4 object(s):

    [32, 646) 'notify' (line 1543)
    [784, 790) 'remote_bda' (line 1544) <== Memory access at offset 646 partially underflows this variable
    [816, 817) 'gatt_if' (line 1545) <== Memory access at offset 646 partially underflows this variable
    [832, 833) 'transport' (line 1546) <== Memory access at offset 646 partially underflows this variable

HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext

      (longjmp and C++ exceptions *are* supported)

Thread T38 (btu message loo) created by T37 (bt_workqueue) here:

    #0 0x77e50fd46f in __interceptor_pthread_create _asan_rtl_:3
    #1 0x77ca529727 in thread_new_sized(char const*, unsigned long) system/bt/osi/src/thread.cc:87:3
    #2 0x77ca3e9a73 in btu_task_start_up(void*) system/bt/stack/btu/btu_task.cc:127:26
    #3 0x77ca52ad3b in work_queue_read_cb(void*) system/bt/osi/src/thread.cc:251:3
    #4 0x77ca52489b in run_reactor(reactor_t*, int) system/bt/osi/src/reactor.cc:282:11
    #5 0x77ca524413 in reactor_start(reactor_t*) system/bt/osi/src/reactor.cc:125:10
    #6 0x77ca529c6f in run_thread(void*) system/bt/osi/src/thread.cc:221:3
    #7 0x77eb40a31b in __pthread_start(void*) bionic/libc/bionic/pthread_create.cpp:214:18
    #8 0x77eb3c1dff in __start_thread bionic/libc/bionic/clone.cpp:47:16

002(bluetooth) btu message loo identical 1 line

Thread T37 (bt_workqueue) created by T20 (stack_manager) here:

    #0 0x77e50fd46f in __interceptor_pthread_create _asan_rtl_:3
    #1 0x77ca529727 in thread_new_sized(char const*, unsigned long) system/bt/osi/src/thread.cc:87:3
    #2 0x77ca3e936f in BTU_StartUp() system/bt/stack/btu/btu_init.cc:129:25
    #3 0x77ca2a513b in event_start_up_stack(void*) system/bt/btif/src/stack_manager.cc:146:3
    #4 0x77ca52ad3b in work_queue_read_cb(void*) system/bt/osi/src/thread.cc:251:3
    #5 0x77ca52489b in run_reactor(reactor_t*, int) system/bt/osi/src/reactor.cc:282:11
    #6 0x77ca524413 in reactor_start(reactor_t*) system/bt/osi/src/reactor.cc:125:10
    #7 0x77ca529c6f in run_thread(void*) system/bt/osi/src/thread.cc:221:3
    #8 0x77eb40a31b in __pthread_start(void*) bionic/libc/bionic/pthread_create.cpp:214:18
    #9 0x77eb3c1dff in __start_thread bionic/libc/bionic/clone.cpp:47:16

002(bluetooth) btu message loo identical 1 line

Thread T20 (stack_manager) created by T0 (droid.bluetooth) here:

    #0 0x77e50fd46f in __interceptor_pthread_create _asan_rtl_:3
    #1 0x77ca529727 in thread_new_sized(char const*, unsigned long) system/bt/osi/src/thread.cc:87:3
    #2 0x77ca2a4e7f in ensure_manager_initialized() system/bt/btif/src/stack_manager.cc:238:23
    #3 0x77ca2a4e7f in stack_manager_get_interface() system/bt/btif/src/stack_manager.cc:251:0
    #4 0x77ca1b7927 in init(bt_callbacks_t*) system/bt/btif/src/bluetooth.cc:144:3
    #5 0x77ca9899fb in android::initNative(_JNIEnv*, _jobject*) packages/apps/Bluetooth/jni/com_android_bluetooth_btservice_AdapterService.cpp:663:13
    #6 0x77e1c87703 in art_quick_generic_jni_trampoline /proc/self/cwd/art/runtime/arch/arm64/quick_entrypoints_arm64.S:2329:0

    #6 0x37ab0579318381f  (<unknown module>)

002(bluetooth) btu message loo identical 1 line

SUMMARY: AddressSanitizer: stack-buffer-overflow (/system/lib64/libclang_rt.asan-aarch64-android.so+0x31adf)

Shadow bytes around the buggy address:
  0x001ef91817b0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x001ef91817c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x001ef91817d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x001ef91817e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x001ef91817f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x001ef9181800: 00 00 00 00 00 00 00 00 00 00 00 00[06]f2 f2 f2
  0x001ef9181810: f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 06 f2
  0x001ef9181820: f2 f2 01 f2 01 f3 f3 f3 00 00 00 00 00 00 00 00
  0x001ef9181830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x001ef9181840: f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00
  0x001ef9181850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb

==1410==ABORTING

Bug: 65381426

Change-Id: Ie632f131b622cc323ce68ec7be152caef23c95ec

6 years agoMerge "Extended Scan HCI definations as per BT 5.0 SIG "
Treehugger Robot [Wed, 6 Sep 2017 17:03:37 +0000 (17:03 +0000)]
Merge "Extended Scan HCI definations as per BT 5.0 SIG "

6 years agoFix GATT log spam
Jakub Pawlowski [Wed, 6 Sep 2017 15:41:46 +0000 (08:41 -0700)]
Fix GATT log spam

Bug: 65255942
Test: manual
Change-Id: I212bc93149dc514517f409edc36f74e1c2895d96

6 years agoStore a name string in property without violating string boundaries
Pavlin Radoslavov [Sun, 19 Mar 2017 02:35:06 +0000 (19:35 -0700)]
Store a name string in property without violating string boundaries

Don't copy data beyond end of string when storing it as BT_PROPERTY_BDNAME
in property.
Also, update an unit test to create a string by considering the property
name length.

Test: Running unit tests with ASAN enabled
Change-Id: Iaa586b4a0942f99ba469d1ed963729e7ad721503

6 years agoExtended Scan HCI definations as per BT 5.0 SIG
Sagayajayasheelan Thomas [Mon, 17 Jul 2017 09:50:01 +0000 (15:20 +0530)]
Extended Scan HCI definations as per BT 5.0 SIG

Added Ext Scan HCI defination for periodic scan.

Change-Id: Ic7dce5fb5207a22e4b193d84033d84126d780be5
Signed-off-by: Sagayajayasheelan Thomas <sagayajayasheelan.thomas@intel.com>
6 years agoClear IB_CFG_DONE on receiving peer config request when channel open
Srinu Jella [Thu, 17 Nov 2016 09:32:20 +0000 (15:02 +0530)]
Clear IB_CFG_DONE on receiving peer config request when channel open

Root Cause: Configure request fails in CST_OPEN state
after a configure request IB_CFG_DONE and OB_CFG_DONE both are
cleared. Some IOT devices try to configure again in the CST_OPEN
state which fails if OB_CFG_DONE is cleared.

Fix: Clear IB_CFG_DONE and keep OB_CFG_DONE unchanged on receiving
Peer config request when channel open.

Test: Tested with Geely Carkit.
Bug: 35082459

Change-Id: I8deca0c8ff73faafc3da94dcd9ea55e06bd8a31d

6 years agoAvoid lookup on NULL address
Martin Brabham [Wed, 3 May 2017 23:05:47 +0000 (16:05 -0700)]
Avoid lookup on NULL address

Test: Manually watch some debug logs during pairing and auth processes
Change-Id: I6410b8bc00587196392ae787a6aa1d85c0c71967

6 years agoImplement HCI_Read_Failed_Contact_Counter mechanism
Pavlin Radoslavov [Fri, 1 Sep 2017 05:06:11 +0000 (22:06 -0700)]
Implement HCI_Read_Failed_Contact_Counter mechanism

Also, read the Failed Contact Counter when flushing the A2DP Tx queue

Test: Streaming A2DP headset and trigger audio stutter
Bug: 64038257
Change-Id: I8ff72560e3840c5c22cfac9613c4be670b8a4cf1

6 years agoAdd / update log messages during stack startup / shutdown
Pavlin Radoslavov [Tue, 29 Aug 2017 17:00:21 +0000 (10:00 -0700)]
Add / update log messages during stack startup / shutdown

Test: manual
Bug: 64975965
Change-Id: I22ae7cad3b0ef3b7eb7ea2b7b6f93449a6363070

6 years agoMerge "BTIF: Add meaningful logging to btif_profile_queue"
Treehugger Robot [Thu, 31 Aug 2017 03:25:30 +0000 (03:25 +0000)]
Merge "BTIF: Add meaningful logging to btif_profile_queue"

6 years agoMerge "Limit the maximum number of entries in the remote bdaddr cache to 1024"
Treehugger Robot [Thu, 31 Aug 2017 02:09:22 +0000 (02:09 +0000)]
Merge "Limit the maximum number of entries in the remote bdaddr cache to 1024"

6 years agoLimit the maximum number of entries in the remote bdaddr cache to 1024
Pavlin Radoslavov [Tue, 29 Aug 2017 00:42:46 +0000 (17:42 -0700)]
Limit the maximum number of entries in the remote bdaddr cache to 1024

Also, renamed p_dev_cb to remote_bdaddr_cache.

Bug: 64975965
Test: BLE scanning
Change-Id: I518390c53c5ff2a24ac9f010464225d763b33228

6 years agoRFCOMM: Add more logging during port close
Jack He [Wed, 30 Aug 2017 19:00:41 +0000 (12:00 -0700)]
RFCOMM: Add more logging during port close

* Log MAC address and UUIDs of closed connections
* Log reasons for RFCOMM closure when generic CLOSE is used
  as reason

Bug: 65080465
Test: Use profiles that use RFCOMM
Change-Id: Iff9f7537989e51d7b98f7cf1241db3f196f501d7

6 years agoBTIF: Add meaningful logging to btif_profile_queue
Jack He [Wed, 30 Aug 2017 18:13:08 +0000 (11:13 -0700)]
BTIF: Add meaningful logging to btif_profile_queue

* Add INFO logging to add/advance/execute functions in
  btif_profile_queue
* Add ERROR logging to add failures

Bug: 65051171
Test: Try connection to multiple profiles
Change-Id: I058ad06a45eeceb4d160af472f317d08843ca6bf

6 years agoInline comparison operators for RawAddress
Pavlin Radoslavov [Wed, 30 Aug 2017 18:02:27 +0000 (11:02 -0700)]
Inline comparison operators for RawAddress

Test: Code compilation
Bug: 64975965

Change-Id: I5a7ab7e0cd270c2769a3a471a506fc78a0a94533

6 years agoAdd missing comparison operators for RawAddress
Pavlin Radoslavov [Tue, 29 Aug 2017 22:02:44 +0000 (15:02 -0700)]
Add missing comparison operators for RawAddress

Test: Unit tests added
Bug: 64975965
Change-Id: Id27f1ef7ec99f0761d6e2fb40bf38212ab8312a1

6 years agobtm: Finish renaming SMP_AUTH_<GEN_>BOND
Myles Watson [Thu, 4 May 2017 18:13:10 +0000 (11:13 -0700)]
btm: Finish renaming SMP_AUTH_<GEN_>BOND

Test: build, grep for SMP_AUTH_GEN_BOND
Change-Id: Ic9e1950282a60e1d644d79291d9c0822ac6c973e

6 years agoFix crashes in btm_consolidate_dev
Jakub Pawlowski [Tue, 22 Aug 2017 10:10:46 +0000 (03:10 -0700)]
Fix crashes in btm_consolidate_dev

It is not safe to do list_next after list_remove.

Test: sl4a BleStressTest:test_le_pairing
Bug: 31442085
Change-Id: Ib4cb02154684b39ebc652d20559e1b07eee2c357

6 years agoFix connection handle data type
Jakub Pawlowski [Fri, 18 Aug 2017 13:03:55 +0000 (13:03 +0000)]
Fix connection handle data type
am: 73af403370

Change-Id: Ic08764d124def613fcbb52fca68a487ded52390f

6 years agoFix connection handle data type
Jakub Pawlowski [Fri, 18 Aug 2017 11:14:22 +0000 (04:14 -0700)]
Fix connection handle data type

conn_handle should be uint16_t, not uint8_t.

Test: compilation test
Bug: 64232952
Change-Id: Ibce88e2cf2f74f402ea26f7471e5ac35aef6229b

6 years agoCleanup RawAddress usage
Jakub Pawlowski [Thu, 17 Aug 2017 23:53:48 +0000 (23:53 +0000)]
Cleanup RawAddress usage
am: 2e05f0dd4f

Change-Id: I76258df03bef16cf4a71f3dab2412b89750e0ab7

6 years agoCleanup RawAddress usage
Jakub Pawlowski [Wed, 16 Aug 2017 13:41:02 +0000 (06:41 -0700)]
Cleanup RawAddress usage

Use RawAddress::kLength instead of sizeof(RawAddress). When copying
value using memcpy, use "->address" instead of direct instance address.

Bug: 64726342
Change-Id: Iac7e5674f7e32b53162ab734c2251e65e9d4554c

6 years agoFix misc-macro-parentheses warnings in system/bt.
Chih-Hung Hsieh [Thu, 17 Aug 2017 00:09:12 +0000 (00:09 +0000)]
Fix misc-macro-parentheses warnings in system/bt.
am: fc25b19606

Change-Id: I7ef5175514d7f1483743c20c916854f1e4cce687

6 years agoFix misc-macro-parentheses warnings in system/bt.
Chih-Hung Hsieh [Tue, 1 Aug 2017 22:04:23 +0000 (15:04 -0700)]
Fix misc-macro-parentheses warnings in system/bt.

* Use NOLINT to suppress missing parentheses warnings around bitmask.

Bug: 28705665
Test: make with WITH_TIDY=1 WITH_TIDY_CHECKS=-*,misc-macro-* \
      WITH_TIDY_FLAGS=-header-filter=system/bt/.*

Change-Id: I4f095898d49eafdea9eb72f9ffc9eac87f68a4c8

6 years agoFix errors in handling RawAddresses
Jack He [Wed, 16 Aug 2017 00:23:04 +0000 (00:23 +0000)]
Fix errors in handling RawAddresses
am: 882aec320e

Change-Id: If23c7e9bf4231ec3398d0de21c0656a240935209

6 years agoFix errors in handling RawAddresses
Jack He [Tue, 15 Aug 2017 06:02:16 +0000 (23:02 -0700)]
Fix errors in handling RawAddresses

* In change I8d1bd6914aec55bb53495b1d0d5e3d37b86865e6
  memcmp(a, b, LEN) != 0 should be translated to
  A != B
* memcpy should not be applied to RawAddress objects.
  Assignment operator should be used instead.
* memset should not be applied to RawAddress objects.
  Assignment to RawAddress::kEmpty should be used.
* Fixed a crash in GATT

Bug: 64316340
Test: Unit test, pair with device and transmit
Change-Id: Iceefab821c1d45a88194d87a43a192afa5f263fd

6 years agoMerge "test_vendor: Add function to extract bytes from iterators"
johnshamoon [Fri, 11 Aug 2017 05:54:20 +0000 (05:54 +0000)]
Merge "test_vendor: Add function to extract bytes from iterators"
am: 9a7f50c041

Change-Id: I588d3a7fd6dce5c2eaf1aea9944e4d45663e3dd0

6 years agoMerge "test_vendor: Add function to extract bytes from iterators"
Treehugger Robot [Fri, 11 Aug 2017 05:46:08 +0000 (05:46 +0000)]
Merge "test_vendor: Add function to extract bytes from iterators"

6 years agotest_vendor: Add function to extract bytes from iterators
johnshamoon [Wed, 9 Aug 2017 03:38:28 +0000 (20:38 -0700)]
test_vendor: Add function to extract bytes from iterators

The extract function extracts a number of bytes from the type that the
iterator is pointing to. The iterator will be incremented to the value
after the last byte after extract is called.

Fixed the bounds of the for loop in the preIncrementTest so that it
does not try to dereference the sentinel after the last value.

Test: Passes unit tests in test/iterator_test.cc
Change-Id: I07944641b829c820bbe40d612d7f065e514516b3

6 years agoosi: Suppress length warning in config parsing
Ting-Yuan Huang [Thu, 10 Aug 2017 18:13:18 +0000 (18:13 +0000)]
osi: Suppress length warning in config parsing
am: 8b7968085b

Change-Id: I338ec794dcc5db22ee4615ef139500c44eb1cf2b

6 years agoosi: Suppress length warning in config parsing
Ting-Yuan Huang [Tue, 9 May 2017 23:35:46 +0000 (16:35 -0700)]
osi: Suppress length warning in config parsing

Bug: 38178471
Test: Built without seeing the warning at the line
Change-Id: I1f8a5fc58313456921891700a3039cad1715b4d0

6 years agoresolve merge conflicts of 0a5d9ebb0b15976b47eaff77bb66a257b8b114bb to stage-aosp...
Jakub Pawlowski [Wed, 9 Aug 2017 07:44:01 +0000 (00:44 -0700)]
resolve merge conflicts of 0a5d9ebb0b15976b47eaff77bb66a257b8b114bb to stage-aosp-master

Test: this fixes merge conflict that I skipped
Change-Id: Ie829182b01d01e5ae648165f30cfad7647a97db6
Merged-In: Ie829182b01d01e5ae648165f30cfad7647a97db5

6 years agoBluetooth: move AIDL files related to Bluetooth into system/bt (2/3)
Jakub Pawlowski [Wed, 9 Aug 2017 07:13:47 +0000 (07:13 +0000)]
Bluetooth: move AIDL files related to Bluetooth into system/bt (2/3)
am: 0a5d9ebb0b

Change-Id: I6a921b05aa32dbb9bf196635c17118de5d39d2b0

6 years agoBluetooth: move AIDL files related to Bluetooth into system/bt (2/3)
Jakub Pawlowski [Tue, 8 Aug 2017 11:00:13 +0000 (04:00 -0700)]
Bluetooth: move AIDL files related to Bluetooth into system/bt (2/3)

This patch moves *.aidl files from
frameworks/base/core/java/android/bluetooth into system/bt/binder. This
is in preparation to convert the Bluetooth deamon into native
implementation piece by piece.
In order to do that, one must have C++ header files, and paths to them
with AIDL files, and */java/* folder didn't seem as proper place for
that. Additionally, keeping AIDL files out of framework/base will not
require creating dependency on this huge project, which should help
keeping the compilation fast.

Test: compilation test
Change-Id: I4c992e6ee16eea3173a49b1d37e961af3d3c9ac6
Merged-In: I4c992e6ee16eea3173a49b1d37e961af3d3c9ac6
(cherry picked from commit 8a12de49177a341a118c95435177fba4f12fe412)

6 years agoMerge "Call bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE"
Bailey Forrest [Mon, 7 Aug 2017 22:58:14 +0000 (22:58 +0000)]
Merge "Call bta_dm_sp_cback if BTM_LOCAL_IO_CAPS == BTM_IO_CAP_NONE"
am: 9d098408ce

Change-Id: I0988507f1ed8bd3a9138ecb80171d7cfd18a4031

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 [Mon, 7 Aug 2017 18:09:44 +0000 (18:09 +0000)]
Use a mutex to protect the scheduling of tBTA_PM_TIMER
am: 9e702a6aef

Change-Id: I4f41eee8b9e5dd129b3aeffb287a6e8b9c7269c4

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"
johnshamoon [Mon, 7 Aug 2017 17:55:20 +0000 (17:55 +0000)]
Merge "test_vendor: Add Iterator tests"
am: c427c0bd30

Change-Id: I81d51453b88f707463b140861dfd0b6e0dcefb50

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 [Fri, 4 Aug 2017 21:56:01 +0000 (21:56 +0000)]
test_vendor: Use Custom Iterators in L2CAP Classes
am: 6f1401153f

Change-Id: Ie5fcdbe89d35ab391fd756f675b264d1dd2233ed

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"
johnshamoon [Fri, 4 Aug 2017 20:14:51 +0000 (20:14 +0000)]
Merge "test_vendor: Add HciPacket and Iterator classes"
am: 3e1a3d0ddc

Change-Id: Ide1490901c49ae9e38e69ba6315c69df92c7bb27

6 years agoProtect the btif config state with a lock during cleanup
Pavlin Radoslavov [Fri, 4 Aug 2017 20:14:24 +0000 (20:14 +0000)]
Protect the btif config state with a lock during cleanup
am: a4febd6d04

Change-Id: I47a3b5efc680954afc11e58f16c440284ba016a9

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 17:55:13 +0000 (17:55 +0000)]
Advertisement parsing fix for zero padding
am: 35a9ea352d

Change-Id: I59bf8524b2c95c5f8c7f4261166057078dd25b7c

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 06:02:00 +0000 (06:02 +0000)]
Added another entry to the INTEROP_2MBPS_LINK_ONLY interoperability database
am: 427da91563

Change-Id: I7412713b0c0104309b8e5fcffa7df2fde1eaa7f2

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 [Thu, 3 Aug 2017 10:40:13 +0000 (10:40 +0000)]
Don't reuse AVDTP internal state for different purposes
am: 8da87bea5e

Change-Id: I1b35a8e6ba0f3d109731a1128c4ccb6363a9404c

6 years agoAdd A2DP_DumpCodecInfo() API
Pavlin Radoslavov [Thu, 3 Aug 2017 10:40:09 +0000 (10:40 +0000)]
Add A2DP_DumpCodecInfo() API
am: 219b85f136

Change-Id: I1bc85fcf214ab75e130954245d585e3015b08bec

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 [Wed, 2 Aug 2017 22:02:51 +0000 (22:02 +0000)]
Workaround for Traxxas
am: 02d1ec171f

Change-Id: If547b412aabc0cf86194116c9a0641e700209336

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:47:11 +0000 (19:47 +0000)]
Merge "AVRCP Controller request metadata on playback."
am: 39b6c45264

Change-Id: Ia5000440315c0f8a1bc75142e4463606e9fc931c

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"
Sunny Kapdi [Wed, 2 Aug 2017 17:13:59 +0000 (17:13 +0000)]
Merge "AE: Set secondary adv max skip to zero"
am: b92d9f3530

Change-Id: I54710829a6ba81d69bbee4571c00492d4a612e32