OSDN Git Service

android-x86/system-bt.git
5 years agoAdd new hidden API to return SDP record's MapSupportedFeatures field. That field...
Vasu Nori [Tue, 25 Sep 2018 23:14:31 +0000 (16:14 -0700)]
Add new hidden API to return SDP record's MapSupportedFeatures field. That field is documented in Bluetooth MAP 1.4 spec, page 114. Spec is here: shortn/_zfoIrfbIzR
am: f2b03b49ac

Change-Id: I17d43783874233dca4e58965c5e446f60552ff1f

5 years agoAdd new hidden API to return SDP record's MapSupportedFeatures field.
Vasu Nori [Sat, 18 Aug 2018 00:28:11 +0000 (17:28 -0700)]
Add new hidden API to return SDP record's MapSupportedFeatures field.
That field is documented in Bluetooth MAP 1.4 spec, page 114.
Spec is here: http://shortn/_zfoIrfbIzR

Bug: 111614861
Test: tested w/ KitchenSink App
Change-Id: I89903c386d97934ec7b9c80333ecc6a6d560cbec

5 years agoMerge changes I737a864e,Idc41b2a5
Hansong Zhang [Tue, 25 Sep 2018 04:52:59 +0000 (21:52 -0700)]
Merge changes I737a864e,Idc41b2a5
am: af09b4eae2

Change-Id: Icdf4f89ec9d36f680f20d54633bd18d23b88c0fb

5 years agoMerge changes I737a864e,Idc41b2a5
Treehugger Robot [Tue, 25 Sep 2018 04:41:08 +0000 (04:41 +0000)]
Merge changes I737a864e,Idc41b2a5

* changes:
  Timer: Don't run new task at old timepoint
  Timer: Separate code path for single and periodic

5 years agoTimer: Don't run new task at old timepoint
Hansong Zhang [Thu, 20 Sep 2018 17:15:12 +0000 (10:15 -0700)]
Timer: Don't run new task at old timepoint

* Fix a race condition that the task is just finished but IsScheduled
  is true
* Fix a bug where cancelling the old task will make new task run at
  the previous task's scheduled timepoint
* Protect racing read/write to message_loop_thread_ in RunTask() and
  Cancel() by storing a local reference to message_loop_thread_ in
  RunTask()

Bug: 116081383
Test: Run bluetooth_test_common.TimerTest
      reschedule_task_dont_invoke_new_task_early
      schedule_task
      for multiple times
Change-Id: I737a864e1b061adbcd41245711e0d3e8adf448d4

5 years agoMerge "Send volume just once when starting the stream."
Jakub Pawlowski [Mon, 24 Sep 2018 20:43:23 +0000 (13:43 -0700)]
Merge "Send volume just once when starting the stream."
am: 029945f9f5

Change-Id: I8c64f2325849333c91010e0f0fdb5239d88187d0

5 years agoMerge "Send volume just once when starting the stream."
Treehugger Robot [Mon, 24 Sep 2018 20:33:51 +0000 (20:33 +0000)]
Merge "Send volume just once when starting the stream."

5 years agoSend volume just once when starting the stream.
Jakub Pawlowski [Mon, 24 Sep 2018 14:43:59 +0000 (16:43 +0200)]
Send volume just once when starting the stream.

The volume is in the Start command already, no need to send it in a
separate command.

Bug: 116145308
Test: play music, pause, adjust volume, start playing again, verify
      playing was re-started with proper volume level.
Change-Id: I2a900b03a35670de4a265184f333517db17497d8

5 years agoTimer: Separate code path for single and periodic
Hansong Zhang [Thu, 20 Sep 2018 17:15:12 +0000 (10:15 -0700)]
Timer: Separate code path for single and periodic

* Add helper RunSingleTask() and RunPeriodicTask() to handle two cases
  separately
* In RunTask(), check that it must run on specified message loop thread

Bug: 116081383
Test: Run bluetooth_test_common
Change-Id: Idc41b2a509f43dbe946b2e26f2afd775726514aa

5 years agoMerge "Add net_test_avrcp to general-tests suite"
Dan Shi [Wed, 19 Sep 2018 00:42:34 +0000 (17:42 -0700)]
Merge "Add net_test_avrcp to general-tests suite"
am: 425bca9026

Change-Id: Iedd9cfa3afce7d3aa0d5e5eafc03cc6cf269dc0b

5 years agoMerge "Add net_test_avrcp to general-tests suite"
Treehugger Robot [Wed, 19 Sep 2018 00:12:50 +0000 (00:12 +0000)]
Merge "Add net_test_avrcp to general-tests suite"

5 years agoFix clang-tidy performance warnings in system/bt.
Chih-Hung Hsieh [Tue, 18 Sep 2018 10:36:22 +0000 (03:36 -0700)]
Fix clang-tidy performance warnings in system/bt.
am: b78d2791de

Change-Id: I3c9d0768e73523dac093e00842d658ea25050dac

5 years agoFix clang-tidy performance warnings in system/bt.
Chih-Hung Hsieh [Mon, 17 Sep 2018 22:16:18 +0000 (15:16 -0700)]
Fix clang-tidy performance warnings in system/bt.

* Use more efficient overloaded string methods.

Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Iff759bf68ede3bb6bdd8e332b3490128eee3b5fe

5 years agoSuppress implicit-fallthrough warnings.
Chih-Hung Hsieh [Mon, 17 Sep 2018 19:40:21 +0000 (12:40 -0700)]
Suppress implicit-fallthrough warnings.
am: d464658a77

Change-Id: I98938affe622af4a82422cfe550cd8ef38afb8cb

5 years agoSuppress implicit-fallthrough warnings.
Chih-Hung Hsieh [Wed, 12 Sep 2018 22:20:43 +0000 (15:20 -0700)]
Suppress implicit-fallthrough warnings.

Add FALLTHROUGH_INTENDED for clang compiler.

Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: Iedf7e46445101a5e3358473e1200212d67cf58d1

5 years agoMerge "AVRCP Controller media session queue"
Joseph Pirozzo [Sat, 15 Sep 2018 00:18:53 +0000 (17:18 -0700)]
Merge "AVRCP Controller media session queue"
am: ad6183c330

Change-Id: I8ecc2b8214fa174ab7eec531965a8edb57323a4a

5 years agoMerge "AVRCP Controller media session queue"
Joseph Pirozzo [Fri, 14 Sep 2018 22:48:55 +0000 (22:48 +0000)]
Merge "AVRCP Controller media session queue"

5 years agoAdd Timer as an alternative to osi alarm
Hansong Zhang [Fri, 14 Sep 2018 18:08:31 +0000 (11:08 -0700)]
Add Timer as an alternative to osi alarm
am: 438b08c27d

Change-Id: I63c59ba8d40104220d0d8762ef41722e8f1d219f

5 years agoAdd net_test_avrcp to general-tests suite
Dan Shi [Fri, 14 Sep 2018 17:38:26 +0000 (10:38 -0700)]
Add net_test_avrcp to general-tests suite

This is the first step for it to run in lab. With this, the test binary
will be included in general-tests.zip (test_suite* target). From there,
we can kick off the test in the lab using TF, with the right options.

Bug: 111921389
Test: m -j net_test_avrcp
./host/linux-x86/testcases/net_test_avrcp/x86_64/net_test_avrcp

Change-Id: I4de9409b4a9d4c066a9024a33d6a980ecb451dc1

5 years agoAdd Timer as an alternative to osi alarm
Hansong Zhang [Tue, 14 Aug 2018 21:29:23 +0000 (14:29 -0700)]
Add Timer as an alternative to osi alarm

* Add a private method MessageLoopThread.DoInThreadDelayed to post a
  delayed task in message loop, as an alternative approach to osi alarm
  clock
* Add a unit test for MessageLoopThread to check ShutDown() waits until
  current task finishes
* Add Timer using MessageLoopThread.DoInThreadDelayed
* Timer provides similar API as osi alarm, and uses same OS clock (boot
  timer) as alarm
* Add benchmark and unit tests to ensure the performance is comparable
  to the existing osi alarm

Test: Run unit test and benchmark test
      ./test/run_unit_tests.sh bluetooth_test_common
      ./test/run_benchmarks.sh bluetooth_benchmark_timer_performance
      --benchmark_repetitions=10 --benchmark_report_aggregates_only=true
Bug: 110303473
Change-Id: I6f2e7ae2f80f9889fc5fe3c8cd6b9b2670938b46

5 years agoMerge "Add support for A2DP LDAC Sink function"
Chisato Kenmochi [Thu, 13 Sep 2018 02:33:47 +0000 (19:33 -0700)]
Merge "Add support for A2DP LDAC Sink function"
am: 58eac77949

Change-Id: Ic25017f7eb5186af86262d9215c9aab7f6b15eae

5 years agoMerge "Add support for A2DP LDAC Sink function"
Treehugger Robot [Thu, 13 Sep 2018 01:30:08 +0000 (01:30 +0000)]
Merge "Add support for A2DP LDAC Sink function"

5 years agoMerge "Add extractBE to the Bluetooth Packets Iterators"
Ajay Panicker [Wed, 12 Sep 2018 23:04:49 +0000 (16:04 -0700)]
Merge "Add extractBE to the Bluetooth Packets Iterators"
am: 7314f08016

Change-Id: Ib385dd3b0dd39f09f455d40e6ecbf195006954ff

5 years agoMerge "Add extractBE to the Bluetooth Packets Iterators"
Ajay Panicker [Wed, 12 Sep 2018 22:27:42 +0000 (22:27 +0000)]
Merge "Add extractBE to the Bluetooth Packets Iterators"

5 years agoAdd a check whether an A2DP codec is supported before including it
Pavlin Radoslavov [Wed, 12 Sep 2018 20:47:47 +0000 (13:47 -0700)]
Add a check whether an A2DP codec is supported before including it
am: 7240fe907d

Change-Id: Iea19097028e8d0e39ec36f069c201b556780986c

5 years agoAdd support for A2DP LDAC Sink function
Chisato Kenmochi [Fri, 10 Aug 2018 11:44:05 +0000 (20:44 +0900)]
Add support for A2DP LDAC Sink function

Note: The LDAC decoder source code is needed to run with this patch.

Bug: 112839060
Test: Manual
Change-Id: Idce0070dcce4d6b83cfd08213b846d957d694d26
Signed-off-by: Chisato Kenmochi <Chisato.Kenmochi@sony.com>
5 years agoAdd a check whether an A2DP codec is supported before including it
Pavlin Radoslavov [Tue, 11 Sep 2018 23:47:47 +0000 (16:47 -0700)]
Add a check whether an A2DP codec is supported before including it

Some of the A2DP SRC or SNK codecs might not be supported if the
corresponding shared library is not included.
Don't include such codecs when configuring and registering
the stream end points on the local device.

Bug: 112839060
Test: Manual - remove A2DP codec shared libraries and check the
      returned AVDTP Capabilities
Change-Id: Ia8fbdac915b208f9950ef7c9f50e3e0dc87e9111

5 years agoAdd extractBE to the Bluetooth Packets Iterators
Ajay Panicker [Mon, 10 Sep 2018 19:01:50 +0000 (12:01 -0700)]
Add extractBE to the Bluetooth Packets Iterators

ExtractBE allows data to be extracted from Bluetooth packets in a big
endian format.

Bug: 114751344
Test: run net_test_btpackets
Change-Id: Ib01d726893e106d34c11048acc09fee201d81c09

5 years agoMerge "Fix spacing in hearing aid dumpsys"
Hansong Zhang [Mon, 10 Sep 2018 23:53:05 +0000 (16:53 -0700)]
Merge "Fix spacing in hearing aid dumpsys"
am: 3ffd7b89f4

Change-Id: I191efc21cc16fdca30bf8801a58ab42bd53607a9

5 years agoMerge "Fix spacing in hearing aid dumpsys"
Treehugger Robot [Mon, 10 Sep 2018 23:40:29 +0000 (23:40 +0000)]
Merge "Fix spacing in hearing aid dumpsys"

5 years agoDisable absolute volume control for deepblue2 speaker
Pavlin Radoslavov [Mon, 10 Sep 2018 18:36:58 +0000 (11:36 -0700)]
Disable absolute volume control for deepblue2 speaker
am: a81834c826

Change-Id: Ibfa7c7315559eb333965cbefc537a948d2f8352a

5 years agoDisable absolute volume control for deepblue2 speaker
Pavlin Radoslavov [Sun, 9 Sep 2018 18:06:21 +0000 (11:06 -0700)]
Disable absolute volume control for deepblue2 speaker

The speaker does not accept the volume levels from the Phone.
It responds back with rounded down volume levels.

Bug: b/37834035
Test: Manual
Change-Id: Ie5575233c3cf31c087addd3cef1c12ad36b820b0

5 years agoFix spacing in hearing aid dumpsys
Hansong Zhang [Fri, 7 Sep 2018 16:39:22 +0000 (09:39 -0700)]
Fix spacing in hearing aid dumpsys

Bug: 114242876
Test: See dumpsys output for bluetooth_manager
Change-Id: Ifb0884ba4e90e2b925bafc52a15d3375c9aec288

5 years agoAllocate lcb when connection complete if can't find one
Chienyuan [Fri, 7 Sep 2018 04:43:11 +0000 (21:43 -0700)]
Allocate lcb when connection complete if can't find one
am: d53036302e

Change-Id: Ic79e372fd5f24ae9b82707b1ffe487047d51bdd0

5 years agoAllocate lcb when connection complete if can't find one
Chienyuan [Wed, 29 Aug 2018 05:38:19 +0000 (13:38 +0800)]
Allocate lcb when connection complete if can't find one

When BT stack sends create connection command and receive connection
request at the same time, connection request will reuse the link control
block created by create connection command. But the link control block
will be released before connection complete due to controller busy.

Bug:112818458
Test: manual - turn on BT and turn on Headset within little time gap
Change-Id: Ie30c655b933250f1709ba10c578ea5f30ea13139

5 years agoImplement A2DP source and AVRCP target binder servers
Bailey Forrest [Wed, 29 Aug 2018 23:29:33 +0000 (16:29 -0700)]
Implement A2DP source and AVRCP target binder servers
am: 780e29c219

Change-Id: I9cbeafd80df6fb0a2502418e51bb080b0595b946

5 years agoImplement A2DP source and AVRCP target binder servers
Bailey Forrest [Wed, 22 Aug 2018 00:20:29 +0000 (17:20 -0700)]
Implement A2DP source and AVRCP target binder servers

Bug: 64231556
Test: On device.
Change-Id: I57136d5550e8e52626a1e7eb26b7d8c02cd94eb5

5 years agoMerge "[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS"
Bailey Forrest [Wed, 29 Aug 2018 00:36:55 +0000 (17:36 -0700)]
Merge "[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS"
am: 91de25f4a5

Change-Id: Ied8af7dd57085e9fef09ee9850619f1b689018f2

5 years agoFix out-of-bounds reading in btm_ble_vendor_capability_vsc_cmpl_cback
Yamei Du [Wed, 29 Aug 2018 00:32:51 +0000 (17:32 -0700)]
Fix out-of-bounds reading in btm_ble_vendor_capability_vsc_cmpl_cback
am: 224eff1163

Change-Id: I43eb49485b08bc55eab808221b3915cc0df7da11

5 years agoMerge "[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS"
Treehugger Robot [Wed, 29 Aug 2018 00:32:15 +0000 (00:32 +0000)]
Merge "[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS"

5 years agoAVRCP Controller media session queue
Joseph Pirozzo [Tue, 28 Aug 2018 22:33:47 +0000 (15:33 -0700)]
AVRCP Controller media session queue

Add support for the Now Playing Content available through AVRCP to
receive proper notifications when it changes and expose it via media
session rather than a node in the browse tree.

Bug: 78598689
Test: Stream Music, change songs and playlist, verify media session
queue.

Change-Id: I46c32d05c5a674388c9e59830ec0596432cd78ef

5 years agoFix out-of-bounds reading in btm_ble_vendor_capability_vsc_cmpl_cback
Yamei Du [Mon, 11 Sep 2017 11:10:47 +0000 (19:10 +0800)]
Fix out-of-bounds reading in btm_ble_vendor_capability_vsc_cmpl_cback

8 bits parameters get 16 bits from buffer in btm_ble_vendor_
capability_vsc_cmpl_cback, which would cause out-of-bounds reading.
Correct STREAM_TO_UINT16 to STREAM_TO_UINT8

Test: manual
Bug: 112167084
Change-Id: Id2b71a8f74eee5d93f287d4705aadab449c55fce

5 years agoDon't add items to a response if a previous item fails to be added
Ajay Panicker [Tue, 28 Aug 2018 20:06:36 +0000 (13:06 -0700)]
Don't add items to a response if a previous item fails to be added
am: 7f29cc5ce2

Change-Id: I1b56c78e07e5bdf8f2f7b5f440be6c32aecbbc72

5 years agoDon't add items to a response if a previous item fails to be added
Ajay Panicker [Wed, 22 Aug 2018 23:24:03 +0000 (16:24 -0700)]
Don't add items to a response if a previous item fails to be added

Bug: 112164711
Test: Run native test net_test_avrcp
Change-Id: Iace287bb716b28eda62a8a0500deb99cc46ae485

5 years agoMerge "Set the AVRCP Browsing MTU for a device after browse open"
Ajay Panicker [Tue, 28 Aug 2018 19:22:18 +0000 (12:22 -0700)]
Merge "Set the AVRCP Browsing MTU for a device after browse open"
am: 6002df2ff2

Change-Id: I340a9f20348fb588fa9feac2cc327e1b8f649387

5 years agoMake thread names more meaningful
Jack He [Tue, 28 Aug 2018 19:01:37 +0000 (12:01 -0700)]
Make thread names more meaningful
am: 96d16e38ae

Change-Id: Ie00925ac157fc98280eb2e519f357ebc22b9f12b

5 years agoMerge "Set the AVRCP Browsing MTU for a device after browse open"
Treehugger Robot [Tue, 28 Aug 2018 18:38:17 +0000 (18:38 +0000)]
Merge "Set the AVRCP Browsing MTU for a device after browse open"

5 years agoSet the AVRCP Browsing MTU for a device after browse open
Ajay Panicker [Fri, 24 Aug 2018 17:32:07 +0000 (10:32 -0700)]
Set the AVRCP Browsing MTU for a device after browse open

Trying to get the Browsing MTU before the Browsing channel is opened
returns the minimum MTU. This leads to smaller browsing messages than
expected.

Bug: 113160447
Test: Connect to device and see that Avrcp Browse packets are the
correct size

Change-Id: Iefda855d0a777439a8a6829619bc4c5543b62eaf

5 years agoCommon: Replace ExecutionBarrier with std::promise and std::future
Jack He [Tue, 28 Aug 2018 01:29:05 +0000 (18:29 -0700)]
Common: Replace ExecutionBarrier with std::promise and std::future
am: f607f2d1a4

Change-Id: I9e48df80f044f702c8819d1f7ebe3e62a78f2655

5 years agoMake thread names more meaningful
Jack He [Mon, 27 Aug 2018 20:55:14 +0000 (13:55 -0700)]
Make thread names more meaningful

* Rename threads:
  - module_wrapper -> bt_module_lifecycle_thread
  - btif_a2dp_sink_worker_thread -> bt_a2dp_sink_worker_thread
  - btif_a2dp_source_thread -> bt_a2dp_source_worker_thread
  - bt_jni_workqueue -> bt_jni_thread
  - stack_manager -> bt_stack_manager_thread
  - hci_thread -> bt_hci_thread
  - bt_workqueue -> bt_startup_thread
  - btu_message_loop -> bt_main_thread
* Rename functions:
  - do_in_bta_thread -> do_in_main_thread
  - get_message_loop -> get_main_message_loop
  - post_to_hci_message_loop -> post_to_main_message_loop
* Refactored bta_sys_sendmsg

Bug: 110303473
Test: make, unit test, stream music
Change-Id: I3051f6ea2d33db37af8eebafba7db4d1e113f611

5 years agoCommon: Replace ExecutionBarrier with std::promise and std::future
Jack He [Sat, 25 Aug 2018 00:14:10 +0000 (17:14 -0700)]
Common: Replace ExecutionBarrier with std::promise and std::future

* std::promise and std::future are able to achieve the same
  functionalities of ExecutionBarrier with extra flexibility
* Replace "_barrier" with "_promise" in system/bt/common

Bug: 110303473
Fixes: 112159657
Test: mm -j40, unit test
Change-Id: I2a420bbf16bf92e4b3dd256d9f23480fc2be7be1

5 years agoRun the wakelock JNI callbacks on the JNI thread
Pavlin Radoslavov [Mon, 27 Aug 2018 20:42:57 +0000 (13:42 -0700)]
Run the wakelock JNI callbacks on the JNI thread
am: c788ad7038

Change-Id: I95f2f701a2ebb3c5f28e8f2bbae06e553a8dbd55

5 years agoMerge "Move metrics and time library to libbt-common"
Jack He [Mon, 27 Aug 2018 19:37:25 +0000 (12:37 -0700)]
Merge "Move metrics and time library to libbt-common"
am: 0cdc006666

Change-Id: I8aeac160d9b537ecdcd92836d7c36f1e26b215e1

5 years agoRun the wakelock JNI callbacks on the JNI thread
Pavlin Radoslavov [Sat, 25 Aug 2018 01:45:16 +0000 (18:45 -0700)]
Run the wakelock JNI callbacks on the JNI thread

All JNI callbacks must be on the JNI thread, otherwise this could
impact the threads' operation.

Bug: 111277984
Test: A2DP streaming
Change-Id: I94fa4500aea62a574c80749e904434e46eb4e942

5 years agoMerge "Move metrics and time library to libbt-common"
Treehugger Robot [Mon, 27 Aug 2018 19:03:21 +0000 (19:03 +0000)]
Merge "Move metrics and time library to libbt-common"

5 years agoMove metrics and time library to libbt-common
Jack He [Wed, 15 Aug 2018 19:38:37 +0000 (12:38 -0700)]
Move metrics and time library to libbt-common

* libbt-osi is being deprecated and libbt-common will replace it
* Move recently implemented metrics library to libbt-common
* Move time library from libbt-osi to libbt-common and renamed as time_util
  to avoid potention name collision with system time libraries
* Need to keep time library for now because we need to use
  CLOCK_BOOTTIME that include system suspension time for A2DP encoding
* Use libchrome logging methods in metrics library
* Put both metrics and time_util into bluetooth::common namespace
* Return uint64_t for time_get_os_boottime_ms and update various
  receiver types
* Remove tBTM_CB.max_collision_delay and use the constant
  BTM_SEC_MAX_COLLISION_DELAY instead

Bug: 111568640
Test: mm -j40, unit test, stream music
Change-Id: I8c384a810d592bb6b9eb322134e947d066489ba4

5 years agoFix V535 CWE-691: inner/outer for loop sharing variables
Ruchi Kandoi [Sun, 26 Aug 2018 20:58:35 +0000 (13:58 -0700)]
Fix V535 CWE-691: inner/outer for loop sharing variables
am: 7cedf6e5c7

Change-Id: I62c000ac87b56b2d59f4054e57c12126ad653abc

5 years agoFix V535 CWE-691: inner/outer for loop sharing variables
Ruchi Kandoi [Fri, 17 Aug 2018 20:30:06 +0000 (13:30 -0700)]
Fix V535 CWE-691: inner/outer for loop sharing variables

Test: compiles
Bug: 112146072
Change-Id: Ie9e10d727edc652865458298cb59a24ac5732c98

5 years ago[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS
Bailey Forrest [Sat, 25 Aug 2018 00:04:00 +0000 (17:04 -0700)]
[bluetoothtb] Fix bug processing BT_PROPERTY_UUIDS

BT_PROPERTY_UUIDS returns an array of UUID objects

Bug: None
Test: Manual
Change-Id: I9ace472b8bddb5823dc7309528d94faba3d0dfe2

5 years agoMerge "L2CAP: Handle no idle timeout (0xFFFF)"
Nitin Shivpure [Thu, 23 Aug 2018 23:03:57 +0000 (16:03 -0700)]
Merge "L2CAP: Handle no idle timeout (0xFFFF)"
am: 4e9717ed2d

Change-Id: Ia77d3021fc07af620abd706d9fdd83dbd3754424

5 years agoMerge "L2CAP: Handle no idle timeout (0xFFFF)"
Treehugger Robot [Thu, 23 Aug 2018 22:54:16 +0000 (22:54 +0000)]
Merge "L2CAP: Handle no idle timeout (0xFFFF)"

5 years agoClear connection update pending flag when disconnected
Stanley Tng [Thu, 23 Aug 2018 21:53:24 +0000 (14:53 -0700)]
Clear connection update pending flag when disconnected
am: 54e8b72a50

Change-Id: Ia60a75778714b48f038c2de77f239f16e3149255

5 years agoL2CAP: Handle no idle timeout (0xFFFF)
Nitin Shivpure [Mon, 30 Jul 2018 12:44:54 +0000 (18:14 +0530)]
L2CAP: Handle no idle timeout (0xFFFF)

Precondition:
1. DUT acts as GATT server.
2. Remote acts as Gatt Client

Use case:
1. Remote device starts BLE scan
2. Remote device connects to DUT
3. Remote device keeps on sending notifications to DUT

Expected result:
Connection should be active after 18 hours

Observed Result:
Connection is dropped after 18 hours due to l2c_link_timeout.

Root Cause:
L2CAP is not properly handling no idle timeout(0xFFFF) and 65535000 ms
timer gets started after BLE connection, leading to connection getting dropped
after 18 hours.

Fix:
If there is no L2CAP dynamic ccb and no idle timeout is configured for
GATT or any other fixed  channel, then cancel existing LCB timer.

Test: No BLE disconnection seen after 18 hours

Bug: 112249120
Change-Id: I58766564cf62efb7af0869035115459bae37c558

5 years agoClear connection update pending flag when disconnected
Stanley Tng [Wed, 22 Aug 2018 21:43:57 +0000 (14:43 -0700)]
Clear connection update pending flag when disconnected

For the hearing aid profile and when we get disconnection
while there is a pending connection update, then clear the flag so that
the next connection update can proceed.

Bug: 112050972
Test: Manual test to check for regressions
Change-Id: I54635a680cf276cf6c9f94520943c3efa97e77ec

5 years agoMerge "A2DP-SINK: Use MessageLoopThread for decoding"
Jack He [Wed, 22 Aug 2018 01:24:32 +0000 (18:24 -0700)]
Merge "A2DP-SINK: Use MessageLoopThread for decoding"
am: 376b8cf273

Change-Id: I5a76fcc2c44dabcb553fc52acf79f57c3885bce3

5 years agoMerge "A2DP-SINK: Use MessageLoopThread for decoding"
Treehugger Robot [Tue, 21 Aug 2018 23:47:01 +0000 (23:47 +0000)]
Merge "A2DP-SINK: Use MessageLoopThread for decoding"

5 years agoMerge "Fix "Disable Absolute Volume" Bluetooth developer option"
Ted Wang [Tue, 21 Aug 2018 03:32:28 +0000 (20:32 -0700)]
Merge "Fix "Disable Absolute Volume" Bluetooth developer option"
am: 4de73dae02

Change-Id: I8a1dd33fef1588126748a69ca57ab4e6839cc89a

5 years agoMerge "Fix "Disable Absolute Volume" Bluetooth developer option"
Ted Wang [Tue, 21 Aug 2018 02:32:49 +0000 (02:32 +0000)]
Merge "Fix "Disable Absolute Volume" Bluetooth developer option"

5 years agoDisable CFI verification for stack_rfcomm test that uses gtest+gmock
Jack He [Tue, 21 Aug 2018 01:23:24 +0000 (18:23 -0700)]
Disable CFI verification for stack_rfcomm test that uses gtest+gmock
am: baa8df4f57

Change-Id: Ibc40188504563046a945e0d0840b3b978c2d8f11

5 years agoDisable CFI verification for stack_rfcomm test that uses gtest+gmock
Jack He [Mon, 20 Aug 2018 22:46:24 +0000 (15:46 -0700)]
Disable CFI verification for stack_rfcomm test that uses gtest+gmock

Apparently, the CFI verification crashes unit tests that
are using gtest+gmock. Interestingly, those tests succeed for 32-bit
binaries, and fail for 64-bit binaries.

Bug: 71739588
Test: Running the 64-bit version of the unit tests in test/run_unit_tests.sh
Change-Id: Ic950087181a86d08af1b858272e946ef4125b78a

5 years agoA2DP-SINK: Use MessageLoopThread for decoding
Jack He [Thu, 16 Aug 2018 08:29:50 +0000 (01:29 -0700)]
A2DP-SINK: Use MessageLoopThread for decoding

* Instead of OSI thread, use MessageLoopThread for decoding
* Similar to A2DP source
* Change tBTIF_A2DP_SINK_CB into a proper class BtifA2dpSinkControlBlock
* Initialize variables in BtifA2dpSinkControlBlock's constructor
* Free un-freed variables in BtifA2dpSinkControlBlock::Reset() method

Bug: 110303473
Test: mm -j40, unit test, stream music
Change-Id: I21f5b0c9f88d2cadada6fc854070d31ac378244f

5 years agoFix "Disable Absolute Volume" Bluetooth developer option
Ted [Fri, 17 Aug 2018 10:49:37 +0000 (18:49 +0800)]
Fix "Disable Absolute Volume" Bluetooth developer option

Do not report device support absolute volume while
"Disable Absolute Volume" in developer option is enabled or
the remote device is listed in the interoperability database.

Test: manually adjust volume when Disable Absolute Volume is enabled
Bug: 112193362
Change-Id: Id63a22dba0d8a871035774fc86b66d32e9225b48

5 years agoA2DP Offload: Fix Max AVDTP MTU for Offload
Sunny Kapdi [Mon, 20 Aug 2018 06:01:28 +0000 (23:01 -0700)]
A2DP Offload: Fix Max AVDTP MTU for Offload
am: e42bc5bb99

Change-Id: I91c9db05409352fe64f2c47f7b3608959760d0c2

5 years agoA2DP Offload: Fix Max AVDTP MTU for Offload
Sunny Kapdi [Thu, 5 Jul 2018 21:31:21 +0000 (14:31 -0700)]
A2DP Offload: Fix Max AVDTP MTU for Offload

Fix the max AVDTP MTU for Offload to what
can fit in a 3DH5 packet after accounting
for AVDTP and L2CAP header.

Also:
 - Moved MAX_2MBPS_AVDTP_MTU and MAX_3MBPS_AVDTP_MTU to the common
   avdt_api.h so it can be used by the rest of the code
 - Removed previously incorrect value of BTA_AV_MAX_A2DP_MTU and
   replace it with the new (correct) value of MAX_3MBPS_AVDTP_MTU
 - Removed duplicate define of MAX_2MBPS_AVDTP_MTU and use
   the one from avdt_api.h

Bug: 78907438
Test: A2DP Streaming
Change-Id: I2c60c34c33e4164c9f7e2e7362bbb600482dec97

5 years agoMerge "Implement A2DP sink and AVRCP controller binder server"
Bailey Forrest [Sat, 18 Aug 2018 20:25:10 +0000 (13:25 -0700)]
Merge "Implement A2DP sink and AVRCP controller binder server"
am: bb216d2135

Change-Id: Ic620184565246aa4a3b2f20df4bfcc39f5a3e395

5 years agoMerge "Implement A2DP sink and AVRCP controller binder server"
Treehugger Robot [Sat, 18 Aug 2018 20:18:39 +0000 (20:18 +0000)]
Merge "Implement A2DP sink and AVRCP controller binder server"

5 years agoImplement A2DP sink and AVRCP controller binder server
Bailey Forrest [Tue, 31 Jan 2017 01:38:58 +0000 (17:38 -0800)]
Implement A2DP sink and AVRCP controller binder server

Also added bonded device management because this is needed for A2DP to
work with most devices.

Bug: 32657860
Test: Run on device, modified tests pass.
Change-Id: I862e41b6594b7cec9f61094d300577574cc8bbc6

5 years agoMerge "Replace period_ms_t with uint64_t"
Jack He [Sat, 18 Aug 2018 02:08:11 +0000 (19:08 -0700)]
Merge "Replace period_ms_t with uint64_t"
am: e0fc57522f

Change-Id: Ia0e930e8efe1a6c14f3073d65eb130b68de48db2

5 years agoMerge "Replace period_ms_t with uint64_t"
Treehugger Robot [Sat, 18 Aug 2018 00:30:46 +0000 (00:30 +0000)]
Merge "Replace period_ms_t with uint64_t"

5 years agoReplace period_ms_t with uint64_t
Jack He [Thu, 16 Aug 2018 05:17:23 +0000 (22:17 -0700)]
Replace period_ms_t with uint64_t

* There is no need to define a unit for millisecond in our system since
  uint64_t is the largest integer that is supported
* period_ms_t results in many unnecessary dependency on
  osi/include/time.h
* Used text editor to do the directory wise replacement, basically
    sed -i 's/period_ms_t/uint64_t/g' *
* Need to modify several method and variable names to indicate that they
  are using millisecond as time unit

Bug: 110303473
Test: build, no functional change as period_ms_t was a typedef of
      uint64_t

Change-Id: I497c9a146a97bab7c7477b358847dad958b92034

5 years agoMerge "HID: Remove device from database in error case"
Hemant Gupta [Thu, 16 Aug 2018 23:52:28 +0000 (16:52 -0700)]
Merge "HID: Remove device from database in error case"
am: 8a227452d1

Change-Id: I307b1671a86485b4f17dd254f49cdc91ad96bf34

5 years agoMerge "HID: Remove device from database in error case"
Treehugger Robot [Thu, 16 Aug 2018 18:27:34 +0000 (18:27 +0000)]
Merge "HID: Remove device from database in error case"

5 years agoMerge "Enable SNIFF mode for HFP"
Ugo Yu [Wed, 15 Aug 2018 03:21:36 +0000 (20:21 -0700)]
Merge "Enable SNIFF mode for HFP"
am: 156fefcad7

Change-Id: I8d6dfc2e34d6eccec2738d279d9bbfedff1656df

5 years agoMerge "Fix reliable write."
Qiyu Hu [Wed, 15 Aug 2018 03:21:01 +0000 (20:21 -0700)]
Merge "Fix reliable write."
am: 8f19e1179e

Change-Id: Id51e49f4bbf7029386be917215cf79e03529ddfa

5 years agoMerge "HFP: Only active BT device can hung up call"
minle.zuo [Wed, 15 Aug 2018 03:16:11 +0000 (20:16 -0700)]
Merge "HFP: Only active BT device can hung up call"
am: 340eb06e41

Change-Id: I6cd4885aaa2dc893f8b8541abf4bac89d8b3af41

5 years agoMerge "Check startup_future before using it"
Bailey Forrest [Wed, 15 Aug 2018 03:09:55 +0000 (20:09 -0700)]
Merge "Check startup_future before using it"
am: ee0c0d8b0d

Change-Id: I10282a2c31f19c211e8c0890b7b3a0de005b1ed6

5 years agoMerge "Enable SNIFF mode for HFP"
Treehugger Robot [Wed, 15 Aug 2018 02:41:17 +0000 (02:41 +0000)]
Merge "Enable SNIFF mode for HFP"

5 years agoMerge "Fix reliable write."
Treehugger Robot [Wed, 15 Aug 2018 00:11:21 +0000 (00:11 +0000)]
Merge "Fix reliable write."

5 years agoMerge "HFP: Only active BT device can hung up call"
Treehugger Robot [Tue, 14 Aug 2018 23:27:34 +0000 (23:27 +0000)]
Merge "HFP: Only active BT device can hung up call"

5 years agoMerge "Check startup_future before using it"
Treehugger Robot [Tue, 14 Aug 2018 23:21:53 +0000 (23:21 +0000)]
Merge "Check startup_future before using it"

5 years agoFix reliable write.
Qiyu Hu [Wed, 13 Jun 2018 15:08:17 +0000 (08:08 -0700)]
Fix reliable write.

We cannot simply assume the write is terminated in reliable write. When
the reliable write value is longer than MTU allows, the current
implementation can only send whatever MTU allows and naively set the
status to GATT_SUCCESS, in the name of "application should verify handle
offset and value are matched or not". That's why MTU negotiation is a
workaround as people mention in b/37031096, which just fits all the write
value into a single request.

This also blocks our test on CtsVerifier.

Bug: 37031096
Test: Manual test and confirm that we don't simply send partial value
Change-Id: I907877608f4672f24c002e630e58bf9133937a5e

5 years agoHID: Remove device from database in error case
Hemant Gupta [Tue, 19 Sep 2017 10:00:56 +0000 (15:30 +0530)]
HID: Remove device from database in error case

Usecase:
1) Pair and connect with remote hid device.
2) Disconnect with remote hid device.
3) Unpair DUT from remote hid device.
4) Send connect request from hid device by pressing any button.
5) Try to pair and connect DUT with remote hid device.

Expected Result
1) Connection should fail after step 4 if remote device does not initaite pairing.
2) Connection should succeed with remote device and hid device should be added to
paired list and hid operations should work properly.

Observed Result
HID operations from remote device starts working without device added to paired list
and UI stucked at pairing.

Root Cause:
After step 4, device should be removed from database when incoming connection is
rejected.

Fix:
Perform virtual unplug for device when connection request for hid is received from
unpaired device.

Test: Issue is not reproducible after stress testing with above change

Bug: 68176469
Change-Id: I9bc72ccc7a849c0d6acf3230a75e1fe95949b3fe

5 years agoEnable SNIFF mode for HFP
Ugo Yu [Tue, 7 Aug 2018 01:55:11 +0000 (09:55 +0800)]
Enable SNIFF mode for HFP

Bug: 112285337
Test: Manual
Change-Id: Ibb019d11cf93051a198df4efb7bd79f31c15a9c0

5 years agoHFP: Only active BT device can hung up call
minle.zuo [Wed, 25 Jul 2018 09:02:51 +0000 (17:02 +0800)]
HFP: Only active BT device can hung up call

Some inactive devices can't send hung up key to host when
HFP connected and active call exist.
And other inactive devices can send hung up call by
sending hung up command.

Solution: To keep consistency of this behavior,
only allow active BT device to hung up call.

Test: Active device can hung up call and inactive can't hung up

Change-Id: Iec1ae689f1d40c15199707e9e925814f71ded619

5 years agoCheck startup_future before using it
Bailey Forrest [Thu, 2 Aug 2018 22:10:46 +0000 (15:10 -0700)]
Check startup_future before using it

event_finish_startup and startup_timer_expired can race, leading one of
them to try to use startup_future when it is NULL.

Check startup_future still exists before using it.

Bug: 112114060
Test: Use Bluetooth
Change-Id: I018d45f070b3f931c1114abf0471b6ea1d524f2a

5 years agoMerge "Merge stage-dr1-aosp-master into stage-aosp-master" into stage-aosp-master
Xin Li [Mon, 13 Aug 2018 23:42:29 +0000 (23:42 +0000)]
Merge "Merge stage-dr1-aosp-master into stage-aosp-master" into stage-aosp-master

5 years agoRe-enable LE advertising after disconnect, on controllers not supporting advertising...
yunhanw [Mon, 13 Aug 2018 22:05:35 +0000 (15:05 -0700)]
Re-enable LE advertising after disconnect, on controllers not supporting advertising when connected
am: dedbd07ba8

Change-Id: Ibdb35f7beec68db11af02fa992a3a6576056887f

5 years agoRe-enable LE advertising after disconnect, on controllers not supporting advertising...
yunhanw [Mon, 13 Aug 2018 18:47:47 +0000 (11:47 -0700)]
Re-enable LE advertising after disconnect, on controllers not supporting advertising when connected

Bug: 112451773
Test: compiled and local device test

Change-Id: Ia39f46b3b9667cba34465e3ff310df85a765c3e1

5 years agoMerge stage-dr1-aosp-master into stage-aosp-master
Xin Li [Mon, 13 Aug 2018 20:01:24 +0000 (13:01 -0700)]
Merge stage-dr1-aosp-master into stage-aosp-master

Bug: 112535855
Change-Id: Id58d10687225831374a0cb0b350d3711c7569cd4

5 years agoFix wrong UUID mask when doing BLE filter scan am: 0443337239
Ugo Yu [Mon, 13 Aug 2018 07:06:39 +0000 (00:06 -0700)]
Fix wrong UUID mask when doing BLE filter scan am: 0443337239
am: be2dad6cc0

Change-Id: If227eac7619e89a2cd2cf172e2e2817ae5f66c4f