OSDN Git Service

android-x86/system-bt.git
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 agoFix wrong UUID mask when doing BLE filter scan
Ugo Yu [Mon, 13 Aug 2018 07:02:06 +0000 (00:02 -0700)]
Fix wrong UUID mask when doing BLE filter scan
am: 0443337239

Change-Id: I34f2ec2aee8b68f9b2b33c06629960f2f5ab6a5f

5 years agoFix wrong UUID mask when doing BLE filter scan
Ugo Yu [Mon, 13 Aug 2018 02:12:40 +0000 (10:12 +0800)]
Fix wrong UUID mask when doing BLE filter scan

bug: 112350218
Test: manual
Change-Id: I9e4297b936e7a7db164e7ff3bf680c43600c5bda

5 years agoMerge "Get rid of meaningles GATT client error log"
Jakub Pawlowski [Thu, 9 Aug 2018 20:10:52 +0000 (13:10 -0700)]
Merge "Get rid of meaningles GATT client error log"
am: 783293824c

Change-Id: I88469907c05719ca895a1d2bd1345b15b9adad47

5 years agoMerge "Get rid of meaningles GATT client error log"
Treehugger Robot [Thu, 9 Aug 2018 20:00:19 +0000 (20:00 +0000)]
Merge "Get rid of meaningles GATT client error log"

5 years agoGet rid of meaningles GATT client error log
Jakub Pawlowski [Thu, 9 Aug 2018 07:24:41 +0000 (09:24 +0200)]
Get rid of meaningles GATT client error log

Right now we often get this error in logs:

E bt_btif_gattc: btif_gattc_upstreams_evt: Unhandled event (7)!

This is often misinterpreted during log analysis as error, where this
really means just uninteresting event we don't want to handle.

Change-Id: Ia7804b2e1802a117198a31e025d05a80f973e896

5 years agoMerge changes from topic "avrcp_controller_timer"
Joseph Pirozzo [Wed, 8 Aug 2018 23:16:21 +0000 (16:16 -0700)]
Merge changes from topic "avrcp_controller_timer"
am: f257e0f212

Change-Id: If45454464420f71d0c62eb3a9ac84befdee87cd8

5 years agoAVRCP Controller metadata feature
Joseph Pirozzo [Wed, 8 Aug 2018 23:15:54 +0000 (16:15 -0700)]
AVRCP Controller metadata feature
am: c5232a8bf7

Change-Id: I01b9e396a7e81a325487b98e1be79a68101e4898

5 years agoMerge changes from topic "avrcp_controller_timer"
Joseph Pirozzo [Wed, 8 Aug 2018 23:01:21 +0000 (23:01 +0000)]
Merge changes from topic "avrcp_controller_timer"

* changes:
  Reduce Media State change callbacks
  AVRCP Controller metadata feature

5 years agoReorder static libs to appease ld.gold linker
Pirama Arumuga Nainar [Wed, 8 Aug 2018 17:37:25 +0000 (10:37 -0700)]
Reorder static libs to appease ld.gold linker
am: 9f8b1301ad

Change-Id: I704fd5b499564a35daf588724aaec8845b9370f3

5 years agoReduce Media State change callbacks
Joseph Pirozzo [Fri, 3 Aug 2018 15:25:19 +0000 (08:25 -0700)]
Reduce Media State change callbacks

Eliminate the 2 second timer and only update media state when it
changes.

Bug: 28917369
Test: Play music, pause and change its position observe status is
correct.

Change-Id: Iaf17e8cde570651706c55603b01c5100d4c60aa4

5 years agoMerge Android Pie into master
Xin Li [Tue, 7 Aug 2018 22:38:31 +0000 (15:38 -0700)]
Merge Android Pie into master
am: 187c80870b

Change-Id: I47c453e8c8551c66c27dbbf9d4922c31b8d8552a

5 years agoReorder static libs to appease ld.gold linker
Pirama Arumuga Nainar [Tue, 7 Aug 2018 21:43:20 +0000 (14:43 -0700)]
Reorder static libs to appease ld.gold linker

Bug: http://b/112277682
Bug: http://b/79419131

Lld, which is the default linker for the platform, is able to resolve
symbols across libraries irrespective of the order they appear in the
command line.  This was not the case for ld.gold and other linkers.
Unfortunately, there are some targets that still rely on ld.gold
(pgo-taimen-config1 in internal release branch being one of
them).

With http://aosp/721652, libbt-stack should be added before libbt-common
so MessageLoopThread::~MessageLoopThread is resolved correctly.  If not,
the following error is reported by gold:

system/bt/stack/btu/btu_init.cc:41: error: undefined reference to
'bluetooth::common::MessageLoopThread::MessageLoopThread(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&)'

Test: m USE_CLANG_LLD=false
Change-Id: I9c8208218ffb4bb027ad75b51bcd484e9bb37368

5 years agoAVRCP Controller metadata feature
Joseph Pirozzo [Tue, 7 Aug 2018 19:28:40 +0000 (12:28 -0700)]
AVRCP Controller metadata feature

Process the METADATA feature flag separately from the VENDOR feature
flag to ensure it doesn't get overwritten.

Bug: 110039732
Test: connect avrcp from phone verify getCapabilities events supported
is sent.

Change-Id: Ib5d54c13d6c912904f20e8760f1632fa5737b98f

5 years agoMerge Android Pie into master
Xin Li [Mon, 6 Aug 2018 23:52:40 +0000 (16:52 -0700)]
Merge Android Pie into master

Bug: 112104996
Change-Id: I242b3c68bcb25f29f8e979487f507a0585f1a8ae

5 years agoFix bad constructor usage in HearingDevice
Jakub Pawlowski [Mon, 6 Aug 2018 18:00:14 +0000 (11:00 -0700)]
Fix bad constructor usage in HearingDevice
am: 897a734a47

Change-Id: I859ce7751ee787fcbf9b5e46f07690a28fa91a1f

5 years agoFix bad constructor usage in HearingDevice
Jakub Pawlowski [Mon, 6 Aug 2018 13:48:57 +0000 (15:48 +0200)]
Fix bad constructor usage in HearingDevice

Bug: 112135987
Test: compilation
Change-Id: Ifaf0189f512ef2abdc7179bda5d6ff1e291fde54

5 years agoBuild: Disable host_supported for cc_benchmark
Jack He [Fri, 3 Aug 2018 08:34:36 +0000 (01:34 -0700)]
Build: Disable host_supported for cc_benchmark
am: 58b49f8c5d

Change-Id: I1614d74f1f6980623ef38f00be4a1024a7f8e306

5 years agoBuild: Disable host_supported for cc_benchmark
Jack He [Fri, 3 Aug 2018 07:40:56 +0000 (00:40 -0700)]
Build: Disable host_supported for cc_benchmark

* host_supported is broken in cc_benchmark on Mac

Bug: 77585931
Test: make
Change-Id: I2d2b4d52a108f90e3ce2d9c8c9f5510918f1fcff

5 years agoUse MessageLoopThread in A2DP source, JNI, BTA, HCI and module bring-up
Jack He [Thu, 2 Aug 2018 21:24:47 +0000 (14:24 -0700)]
Use MessageLoopThread in A2DP source, JNI, BTA, HCI and module bring-up
am: 6d110527c8

Change-Id: I1093576b83d19cac3a11ff4d81173d97604d2a4d

5 years agoAdd MessageLoopThread, ExecutionBarrier, and performance tests
Jack He [Thu, 2 Aug 2018 21:24:00 +0000 (14:24 -0700)]
Add MessageLoopThread, ExecutionBarrier, and performance tests
am: c27d25789b

Change-Id: I040d328e642b351420f9a1f4eb35e6c0dc09a74e

5 years agoUse MessageLoopThread in A2DP source, JNI, BTA, HCI and module bring-up
Jack He [Thu, 26 Jul 2018 04:43:01 +0000 (21:43 -0700)]
Use MessageLoopThread in A2DP source, JNI, BTA, HCI and module bring-up

* Replace OSI thread with MessageLoopThread in
  - btif_a2dp_source (A2DP encoding thread)
  - btif_core (JNI thread)
  - btu_init (BTA thread)
  - hci_layer (HCI thread)
  - module (module bring up thread)
  - various unit test threads
* Code that uses reactor from OSI thread is not replaced in this change
  because they need to move from using reactor to message loop first
* Main difference:
  - HCI layer no longer has access to mutex protecting message loop
    set up and tear down. Messages posted to thread after ShutDown()
    is called become no-op
  - In all cases QuitClosure() is used instead of QuitWhenIdleClosure().
    This means that we will never force kill a thread. An infinite loop
    will delay the shutdown of Bluetooth stack.
* do_in_hci_thread is actually do_in_bta_thread
* Move the definition of do_in_bta_thread from bta to btu since btu is
  where the thread actually lives
* Remove bta_closure_api.h and replace it with stack/include/btu.h
* Remove header inclusion in bta_sys.h and include stack/include/btu.h
  in individual compilation units
* Fixed a bug in btif_cleanup_bluetooth where btif_jni_disassociate()
  was not called on the JNI thread
* Make setting real time priority a requirement
* Crash during the following scenario:
  - When btif_profile_queue cleanup failed to be scheduled on JNI thread
  - When A2DP encoder thread failed to gain real time priority
  - When BTA thread failed to start up
  - When BTA thread failed to gain real time priority
  - When BTA thread failed to schedule its first callback
* Turn off Bluetooth in the following scenario:
  - When HCI thread failed to gain real time priority
  - When bt_workqueue thread failed to gain real time priority

Bug: 110303473
Test: make, native and Java unit tests,
      Connect to headset and listen to music through A2DP,
      testplans/details/184455/3975
Change-Id: Ib448992fc0ba5af82c2d117dd65f1abd45d2acb6

5 years agoAdd MessageLoopThread, ExecutionBarrier, and performance tests
Jack He [Wed, 25 Jul 2018 19:02:22 +0000 (12:02 -0700)]
Add MessageLoopThread, ExecutionBarrier, and performance tests

* Add MessageLoopThread to abstract thread implementation to our code
* Add ExecutionBarrier utility class to help with thread synchronization
* Add more performance tests and performance benchmarks to evaluate
  execution efficiency in both batch and sequential usages, for various
  thread implementations including:
  - libosi reactor on pthread
  - MessageLoop on libosi reactor on pthread
  - MessageLoop on STL std::thread
  - MessageLoop on Posix pthread
  - MessageLoop on libchrome base::Thread
  - MessageLoop on MessageLoopThread

Bug: 110303473
Test: make, native and Java unit tests,
      test/run_benchmarks.sh net_benchmark_thread_performance,
      test/run_unit_tests.sh net_test_performance,
      test/run_unit_tests.sh bluetooth_test_common,
      testplans/details/184455/3975
Change-Id: I5b4ce2ee910a0f1d2edf95e0296916dea04d3f89

5 years agoMerge "Add security handling for LE connection oriented channels"
Venkata Jagadeesh [Wed, 1 Aug 2018 18:53:41 +0000 (11:53 -0700)]
Merge "Add security handling for LE connection oriented channels"
am: fc53a1fcba

Change-Id: Ibba4bdb0f337d743a7148d49a1ad23eb2f8a8b5e

5 years agoMerge "Add security handling for LE connection oriented channels"
Treehugger Robot [Wed, 1 Aug 2018 18:38:10 +0000 (18:38 +0000)]
Merge "Add security handling for LE connection oriented channels"

5 years agoFix for Bluetooth device name is resetting to default name after reboot
Aiswarya Cyriac [Tue, 31 Jul 2018 23:32:00 +0000 (16:32 -0700)]
Fix for Bluetooth device name is resetting to default name after reboot
am: f589e45a3c

Change-Id: I313af6b96913b72fc140c7873c1952f24b75c12a

5 years agoAdd security handling for LE connection oriented channels
Venkata Jagadeesh [Fri, 18 Mar 2016 06:34:30 +0000 (12:04 +0530)]
Add security handling for LE connection oriented channels

Use case:
Run PTS test cases TP/LE/CFC/BV-10-C to BV-16-C

Steps:
1. These test cases executed with two DUT as PTS support not available
2. Set desired security level on DUT and Remote with tool
3. Initiate LE COC connection request from DUT

Failure:
LE COC connection accepted though even remote security are not met.

Fix:
Added security handling for COC connection

Test: Ran sl4a test for BleCocTest
Change-Id: I5f6385d462698582e701b5a07953c0ccb932bbbf

5 years agoFix for Bluetooth device name is resetting to default name after reboot
Aiswarya Cyriac [Mon, 23 Jul 2018 09:47:48 +0000 (15:17 +0530)]
Fix for Bluetooth device name is resetting to default name after reboot

Reason: When the BT device name is updated is getting saved to the
config data pointer but not to the persistent data (i.e. bt_config.conf).
So, when the reboot is happening it is not able to get the updated device
name from the persistent data (i.e. bt_config.conf) as during reboot
bt_config_flush is not called.

Fix: Saving the BT Device name to persistent data using btif_config_flush
once it is set.

Test: Manual Reboot test
Bug: 110301897
Change-Id: Ie329b475eaaf208ed667f27e271a00e230e4b95c
Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@intel.com>
Signed-off-by: Gaganpreet kaur <gaganpreetx.kaur@intel.com>
5 years agoMerge "Set Browsed Player memory allocation"
Joseph Pirozzo [Mon, 30 Jul 2018 20:42:22 +0000 (13:42 -0700)]
Merge "Set Browsed Player memory allocation"
am: 0b610a13c2

Change-Id: I7e432dd8dcc8e389807998e2f07d368414412dd1

5 years agoMerge "Set Browsed Player memory allocation"
Joseph Pirozzo [Mon, 30 Jul 2018 20:31:00 +0000 (20:31 +0000)]
Merge "Set Browsed Player memory allocation"

6 years agoAdd additional checks for AVDTP Codec Capabilities
Pavlin Radoslavov [Fri, 27 Jul 2018 23:54:27 +0000 (16:54 -0700)]
Add additional checks for AVDTP Codec Capabilities
am: 3c5cef21d3

Change-Id: If9ab310626b5acb2364a2403ba831de3021b5ce2

6 years agoSet Browsed Player memory allocation
Joseph Pirozzo [Fri, 27 Jul 2018 18:08:17 +0000 (11:08 -0700)]
Set Browsed Player memory allocation

When setting a browsed player memory for folder depth was incorrectly
allocated based on folder item count not depth.

Bug: 111370532
Test: Set a browsed player that has a depth greater than item count.
Change-Id: I6984c5852f623e7e9478429bdab3dcbcf57196e0

6 years agoAdd additional checks for AVDTP Codec Capabilities
Pavlin Radoslavov [Thu, 26 Jul 2018 02:03:09 +0000 (19:03 -0700)]
Add additional checks for AVDTP Codec Capabilities

Reject AVDTP Codec Capabilities that contain invalid fields

Bug: 110918549
Test: Manual - connect to a device that sends invalid codec capability
Change-Id: Ib697cc9ad13ed666fbafa9219447592fe3f56684

6 years agoMerge "Swap order of registered/status in RegisterForNotificationCallback"
Bailey Forrest [Wed, 25 Jul 2018 00:55:15 +0000 (17:55 -0700)]
Merge "Swap order of registered/status in RegisterForNotificationCallback"
am: 95d0798e7f

Change-Id: Ibe4f75b8eb8b50dd9aaa105bdbafe766bedb8ed4

6 years agoMerge "Swap order of registered/status in RegisterForNotificationCallback"
Treehugger Robot [Wed, 25 Jul 2018 00:45:53 +0000 (00:45 +0000)]
Merge "Swap order of registered/status in RegisterForNotificationCallback"

6 years agoMerge "Enable 2-EV3 packets for Wide Band HFP client"
Joseph Pirozzo [Wed, 25 Jul 2018 00:40:58 +0000 (17:40 -0700)]
Merge "Enable 2-EV3 packets for Wide Band HFP client"
am: 503067b5f8

Change-Id: Ib1e98cd9888ec9e5ff2da8a8114a6c24d4813cfc

6 years agoMerge "Use appropriate Tx time in BLE Set Data length command"
Subramanian Srinivasan [Wed, 25 Jul 2018 00:40:34 +0000 (17:40 -0700)]
Merge "Use appropriate Tx time in BLE Set Data length command"
am: 135c7bc70c

Change-Id: Iafa186226b9ca38f71958de68055fe594bfac557

6 years agoMerge "Enable 2-EV3 packets for Wide Band HFP client"
Joseph Pirozzo [Wed, 25 Jul 2018 00:38:12 +0000 (00:38 +0000)]
Merge "Enable 2-EV3 packets for Wide Band HFP client"

6 years agoMerge "Use appropriate Tx time in BLE Set Data length command"
Treehugger Robot [Wed, 25 Jul 2018 00:33:00 +0000 (00:33 +0000)]
Merge "Use appropriate Tx time in BLE Set Data length command"

6 years agoMake PROPERTY_PRODUCT_MODEL device configurable
Fen Wang [Wed, 25 Jul 2018 00:12:23 +0000 (17:12 -0700)]
Make PROPERTY_PRODUCT_MODEL device configurable
am: 19e728b9d2

Change-Id: I5f25b8a07749e3c3eb7fed3fd4415fac3490c7b5

6 years agoSwap order of registered/status in RegisterForNotificationCallback
Bailey Forrest [Wed, 1 Mar 2017 19:27:05 +0000 (11:27 -0800)]
Swap order of registered/status in RegisterForNotificationCallback

It's confusing how the order is inconsistent with the one defined in
hardware/libhardware/include/hardware/bt_gatt_client.h

Test: Build. Right now no code uses these functions.

Change-Id: I04b93ba74555455fd981a3809ea3e0bfffca4696

6 years agoUse appropriate Tx time in BLE Set Data length command
Subramanian Srinivasan [Thu, 15 Mar 2018 22:58:20 +0000 (15:58 -0700)]
Use appropriate Tx time in BLE Set Data length command

Fixes Tx time parameter in HCI LE set data length command
depending on HCI versions supported by controller.

Bug: 110373079
Change-Id: I83cc4c41ca4c2b6470ec30057717946b1d7fe329

6 years agoMake PROPERTY_PRODUCT_MODEL device configurable
Fen Wang [Tue, 10 Apr 2018 03:41:34 +0000 (12:41 +0900)]
Make PROPERTY_PRODUCT_MODEL device configurable

Make it possible to set PROPERTY_PRODUCT_MODEL in device configuration.

Bug:
Change-Id: I4d34d4ec368f7eb8bd50e2d5431bb120a284f4e3

6 years agoMerge "Ignore SDP failure while bonding if SDP was not attempted"
Cheney Ni [Tue, 24 Jul 2018 04:31:32 +0000 (21:31 -0700)]
Merge "Ignore SDP failure while bonding if SDP was not attempted"
am: 62fee1a223

Change-Id: Iae385d9feca203640c00ab93a8199d3dc3f85fa1

6 years agoMerge "Ignore SDP failure while bonding if SDP was not attempted"
Treehugger Robot [Tue, 24 Jul 2018 04:21:40 +0000 (04:21 +0000)]
Merge "Ignore SDP failure while bonding if SDP was not attempted"

6 years agoClean up style in BLE White List code
Hansong Zhang [Wed, 18 Jul 2018 22:34:06 +0000 (15:34 -0700)]
Clean up style in BLE White List code
am: efb54f7d37

Change-Id: Ia4cee8a5437c430dc75fbf16db9cc381ed4f2e1c

6 years agoClean up style in BLE White List code
Hansong Zhang [Tue, 17 Jul 2018 00:57:17 +0000 (17:57 -0700)]
Clean up style in BLE White List code

* Remove unused code
* Update BgConnHash to return size_t for hashcode
* Change BLE scan_int and scan_win to uint16_t according to spec

Bug: 111562702
Test: SL4A BLE test and manual with BLE mouse
Change-Id: Ieff3acbfaa95b7d804e57021d562218d9fbe42cc

6 years agoIgnore SDP failure while bonding if SDP was not attempted
Cheney Ni [Tue, 17 Jul 2018 11:27:59 +0000 (19:27 +0800)]
Ignore SDP failure while bonding if SDP was not attempted

When bonding, there is an ACL_UP event to the upper layers and some apps
may want to fetch SDP in return. This can break pairing. In cases SDP fails,
it causes the procedure to be finished before the LinkKey is generated.
And thus the LinkKey is not committed to NVRAM and the device is not paired.

Bug: 111189110
Test: : Pair / Unpair BT accessories manually
Change-Id: Iaefbe8b6c1fc3e78f0f120220992df84699a2eb8

6 years agoMerge "Metrics: Add python script to dump metrics into ASCII format"
Jack He [Tue, 17 Jul 2018 23:59:50 +0000 (16:59 -0700)]
Merge "Metrics: Add python script to dump metrics into ASCII format"
am: 85cce9b01f

Change-Id: Ib882d2a6fc9d430cb7d0bf55e0e7c551b7b2d05a

6 years agoMerge "Metrics: Add python script to dump metrics into ASCII format"
Treehugger Robot [Tue, 17 Jul 2018 23:50:34 +0000 (23:50 +0000)]
Merge "Metrics: Add python script to dump metrics into ASCII format"

6 years agoMetrics: Add python script to dump metrics into ASCII format
Jack He [Fri, 13 Jul 2018 21:54:38 +0000 (14:54 -0700)]
Metrics: Add python script to dump metrics into ASCII format

Test: make,
      ./dump_metrics_ascii.py proto/bluetooth/metrics/bluetooth.proto
Change-Id: Ie671fa2c2ceb9f93ed62495b592a2cf9d69ff41b

6 years agoIncrease DM connection size for multiple links
Ben YoungTae Kim [Tue, 17 Jul 2018 03:49:06 +0000 (20:49 -0700)]
Increase DM connection size for multiple links
am: d12993c4f6

Change-Id: I0a0d4cc4a0e8f32d3b3407c370389260f864a3e7

6 years agoIncrease DM connection size for multiple links
Ben YoungTae Kim [Tue, 10 Jul 2018 00:58:12 +0000 (17:58 -0700)]
Increase DM connection size for multiple links

For multiple headset connections, it will be increased to support
multiple services(HFP/AV/CT) for each links.

Test: Connect to 4 or more headsets and play music
Bug: 110972513
Change-Id: I56f69e12fb1a4a614c69fa383e9c53675a189fc9

6 years agoMerge "HFP: Reset BTA SCO control block when bta_ag_create_sco failed"
Benson Li [Fri, 13 Jul 2018 20:10:16 +0000 (13:10 -0700)]
Merge "HFP: Reset BTA SCO control block when bta_ag_create_sco failed"
am: 44e0158c80

Change-Id: I9f87fd712572e9495b5bceac2f7b96985c963a58

6 years agoMerge "SCO: Allocate 6 BTM SCO control blocks for Multi-HFP support"
Jack He [Fri, 13 Jul 2018 20:09:18 +0000 (13:09 -0700)]
Merge "SCO: Allocate 6 BTM SCO control blocks for Multi-HFP support"
am: ef3927a23e

Change-Id: Ic87f2bca46c7f3313e7ec9c838ba49fbac0441e5

6 years agoMerge "HFP: Reset BTA SCO control block when bta_ag_create_sco failed"
Treehugger Robot [Fri, 13 Jul 2018 19:59:10 +0000 (19:59 +0000)]
Merge "HFP: Reset BTA SCO control block when bta_ag_create_sco failed"

6 years agoMerge "SCO: Allocate 6 BTM SCO control blocks for Multi-HFP support"
Treehugger Robot [Fri, 13 Jul 2018 19:58:46 +0000 (19:58 +0000)]
Merge "SCO: Allocate 6 BTM SCO control blocks for Multi-HFP support"

6 years agoHFP: Reset BTA SCO control block when bta_ag_create_sco failed
Benson Li [Wed, 4 Jul 2018 12:41:58 +0000 (20:41 +0800)]
HFP: Reset BTA SCO control block when bta_ag_create_sco failed

* When trying to connect SCO to non-active and active device back to
  back, the first connection to non-active device must fail gracefully
* Otherwise, BTA SCO state machine may stuck in a irrecoverable state
* Schedule to send AUDIO_CONNECTING state before starting SCO connection
  to avoid race condition between connecting state and connection
  failure

Bug: 111101075
Test: Manual test, make a call and switch path A->speaker->B on phone UI
Change-Id: I9bfa389e04863944d88f2bca49d27f1247fa072b

6 years agoSCO: Allocate 6 BTM SCO control blocks for Multi-HFP support
Jack He [Fri, 13 Jul 2018 00:48:36 +0000 (17:48 -0700)]
SCO: Allocate 6 BTM SCO control blocks for Multi-HFP support

Bug: 110818719
Test: connect 5 devices, switch to speaker using dialer, switch to
      Bluetooth device using settings, repeat for all devices

Change-Id: I68d8a892c99e106250245c4f56327555a13543ae

6 years agoMerge "AVRCP: Reject when CT sends invalid RegisterNotification"
Hansong Zhang [Thu, 12 Jul 2018 05:11:07 +0000 (22:11 -0700)]
Merge "AVRCP: Reject when CT sends invalid RegisterNotification"
am: ce46ce7b71

Change-Id: Ica7758b35c6739c8c881cb7c1cd0370bd35d9b40

6 years agoMerge "AVRCP: Reject when CT sends invalid RegisterNotification"
Treehugger Robot [Thu, 12 Jul 2018 01:45:05 +0000 (01:45 +0000)]
Merge "AVRCP: Reject when CT sends invalid RegisterNotification"

6 years agoAVRCP: Reject when CT sends invalid RegisterNotification
Hansong Zhang [Tue, 10 Jul 2018 19:37:58 +0000 (12:37 -0700)]
AVRCP: Reject when CT sends invalid RegisterNotification

Check whether the RegisterNotification request from CT is valid, and
safely reject invalid request

Bug: 111260441
Test: manually test with RIVA WAND speaker
Change-Id: Ia2edd94e50fa7cb5b61be54f297adf971060a924

6 years agoMerge "Fix stack not acking status to audio when A2DP start failed"
Ugo Yu [Tue, 10 Jul 2018 10:10:43 +0000 (03:10 -0700)]
Merge "Fix stack not acking status to audio when A2DP start failed"
am: c02707122e

Change-Id: I650b690029c133db6dcde8a29238e7cc360cdcbf

6 years agoMerge "Fix stack not acking status to audio when A2DP start failed"
Treehugger Robot [Tue, 10 Jul 2018 10:03:07 +0000 (10:03 +0000)]
Merge "Fix stack not acking status to audio when A2DP start failed"

6 years agoRegister for Service Changed notification after encryption
Jakub Pawlowski [Tue, 10 Jul 2018 09:26:30 +0000 (02:26 -0700)]
Register for Service Changed notification after encryption
am: dc46396273

Change-Id: I63fa3d67eb96f3e50396bff5d844a9e4b4336cc3

6 years agoGet rid of warning when connecting LE device
Jakub Pawlowski [Tue, 10 Jul 2018 08:55:30 +0000 (01:55 -0700)]
Get rid of warning when connecting LE device
am: 5e77625fbc

Change-Id: I293dc741e31950adeebf2f65c49f7449f74db17e

6 years agoRegister for Service Changed notification after encryption
Jakub Pawlowski [Wed, 4 Jul 2018 14:11:52 +0000 (07:11 -0700)]
Register for Service Changed notification after encryption

This fixes issue introduced in commit 645ee14ce2327fff61f54d208763eca1c143063e
Registration for Service Changed notifications was
disabled, because there was no good way back then to have
"opportunistic" app. Since opportunistic apps were introduced, and the
code in GATT_ConfigServiceChangeCCC is already marking connection as
opportunistic, reenable notification registration.

Test: manual verification, that Service Changed descriptor is set
Change-Id: Iefaec3914829fa4a4a60dc3c3790c3daa9f4f4d8

6 years agoGet rid of warning when connecting LE device
Jakub Pawlowski [Wed, 4 Jul 2018 16:26:05 +0000 (09:26 -0700)]
Get rid of warning when connecting LE device

We are sending LE fixed channel notification to classic callback. Stop
doing that. This triggers following warning in log output on every
LE connection:
W bt_smp  : smp_br_connect_callback is called on unexpected transport 2

Test: manual with phone, verify warning is gone when connecting over LE
Change-Id: I47597fa03744fb1bff03d287f790ea32fa033cc7

6 years agoFix stack not acking status to audio when A2DP start failed
Ugo Yu [Mon, 9 Jul 2018 05:49:44 +0000 (13:49 +0800)]
Fix stack not acking status to audio when A2DP start failed

Add a missing ack in A2DP start failed case when A2DP offload is
enabled.

Bug: 111207927
Test: Manual

Change-Id: I96a7ad322ea7ce6da5084a48fdd3dec980ce57b8

6 years agoDon't trigger AVDTP Suspend in response to AVDTP Suspend+Start from remote
Pavlin Radoslavov [Mon, 2 Jul 2018 21:18:08 +0000 (14:18 -0700)]
Don't trigger AVDTP Suspend in response to AVDTP Suspend+Start from remote
am: 7e425cef6d

Change-Id: Ibdb89a81251633762771e55c00b2f1f492b14094

6 years agoDon't trigger AVDTP Suspend in response to AVDTP Suspend+Start from remote
Pavlin Radoslavov [Fri, 29 Jun 2018 03:10:36 +0000 (20:10 -0700)]
Don't trigger AVDTP Suspend in response to AVDTP Suspend+Start from remote

If the remote device sent us AVDTP Suspend, and then AVDTP Start, don't
trigger AVDTP Suspend from the local device in response to the AVDTP Start.

Also:
 * Add a call btif_av_stream_start_offload() inside btif_a2dp_on_started()
   if we were started remotely.
 * Fix the order of calling btif_a2dp_on_started() and triggering
   an internal BTIF_AV_SUSPEND_STREAM_REQ_EVT event. Otherwise,
   BTA Suspend might be called before btif_av_stream_start_offload()

Bug: 110015851
Bug: 110186160
Test: Manual
Change-Id: I908d19f8caf5130b96a64153ff39bd4b52879713

6 years agoMerge "Fix double close in btif.cc's dump."
Josh Gao [Fri, 29 Jun 2018 19:02:11 +0000 (12:02 -0700)]
Merge "Fix double close in btif.cc's dump."
am: 84c04a03d1

Change-Id: I62a4c95c968ae3476052ae555efa0ad078cf32cf

6 years agoMerge "Fix double close in btif.cc's dump."
Treehugger Robot [Fri, 29 Jun 2018 18:55:56 +0000 (18:55 +0000)]
Merge "Fix double close in btif.cc's dump."

6 years agoEnable 2-EV3 packets for Wide Band HFP client
Joseph Pirozzo [Fri, 29 Jun 2018 12:57:47 +0000 (05:57 -0700)]
Enable 2-EV3 packets for Wide Band HFP client

The previous code defaulted to the failsafe settings rather than the
prefered settings when accepting an eSCO connection for Wide Band
Speech, this change will enable the T2 (2-EV3) packets.

Bug: 110227849
Test: Connect to phone, place call, verify 2-EV3 packets via HCI logs.
Change-Id: I0c215249b16cfcd4d79137fa80b0d9cc1992c9da

6 years agoAVRCP: Reject SetAddressedPlayer command only if remote set invalid player ID
Benson Li [Thu, 28 Jun 2018 19:49:16 +0000 (12:49 -0700)]
AVRCP: Reject SetAddressedPlayer command only if remote set invalid player ID
am: 97c8fb61ae

Change-Id: I71515bfc27707b0659846965148c66b9d535745b

6 years agoAVRCP: Reject SetAddressedPlayer command only if remote set invalid player ID
Benson Li [Mon, 25 Jun 2018 06:11:20 +0000 (14:11 +0800)]
AVRCP: Reject SetAddressedPlayer command only if remote set invalid player ID

Implement HandleSetAddressedPlayer() to check if remote set valid
player ID and properly respond to remote.

Bug: 110632860
Test: PTS Test AVRCP/TG/MPS/BI-01-C AVRCP/TG/MPS/BV-02-C
Change-Id: Ice13e7ea97cdac369c4d021171a24bf9d96c9da8

6 years agoMerge "Move sepolicy files to system/sepolicy"
Myles Watson [Thu, 28 Jun 2018 02:21:48 +0000 (19:21 -0700)]
Merge "Move sepolicy files to system/sepolicy"
am: 70328c44e4

Change-Id: Ie853b1c2c21848fa6da57c3db8b0dd59229725a5

6 years agoMerge "Move sepolicy files to system/sepolicy"
Treehugger Robot [Thu, 28 Jun 2018 00:31:05 +0000 (00:31 +0000)]
Merge "Move sepolicy files to system/sepolicy"

6 years agoMove sepolicy files to system/sepolicy
Myles Watson [Tue, 26 Jun 2018 00:09:27 +0000 (17:09 -0700)]
Move sepolicy files to system/sepolicy

Test: Toggle Bluetooth, ls -alZ /vendor/bin/hw/*blue*
Change-Id: Ibf72f8bacc2f4975d06f4892e3b33ef6fb08aab7
Merged-In: Ibf72f8bacc2f4975d06f4892e3b33ef6fb08aab7

6 years agoIf command_timed_out() is triggered don't get blocked by a deadlock
Pavlin Radoslavov [Tue, 26 Jun 2018 22:51:43 +0000 (15:51 -0700)]
If command_timed_out() is triggered don't get blocked by a deadlock
am: 2838b32ce4

Change-Id: I62b171d4f71ca81e36c06312f93b817482ecf615

6 years agoFix double close in btif.cc's dump.
Josh Gao [Tue, 26 Jun 2018 21:01:06 +0000 (14:01 -0700)]
Fix double close in btif.cc's dump.

dump closes a file descriptor that is still owned by a
ParcelFileDescriptor which leads eventually to a double close.

Test: treehugger
Change-Id: Id351b5429cb17b48e37313850a363d739d78c4a1

6 years agoIf command_timed_out() is triggered don't get blocked by a deadlock
Pavlin Radoslavov [Thu, 21 Jun 2018 01:28:33 +0000 (18:28 -0700)]
If command_timed_out() is triggered don't get blocked by a deadlock

If command_timed_out() is triggered and we cannot acquire the
commands_pending_response_mutex to print the debug info, then proceed
with the rest of the operations until the process aborts.

Similarly, if startup_timer_expired() is triggered and we are blocked
by a deadlock, just abort() because there is no way to recover.

Bug: 110441099
Test: Code compilation
Change-Id: I367332bbbd9c1d887bd2bc829b9f617114fc96fc

6 years agoMerge "resolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage...
TreeHugger Robot [Tue, 26 Jun 2018 12:11:13 +0000 (12:11 +0000)]
Merge "resolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage-aosp-master" into stage-aosp-master

6 years agoresolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage-aosp...
Florian Mayer [Tue, 26 Jun 2018 09:18:31 +0000 (10:18 +0100)]
resolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage-aosp-master

Change-Id: I9ef67219c4a054aa9c2905ba96e6f5e2afb9a493

6 years agoresolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage-aosp...
Jakub Pawlowski [Tue, 26 Jun 2018 09:11:52 +0000 (02:11 -0700)]
resolve merge conflicts of 430e59d86077cfbbe4421e395ca116768ea02afa to stage-aosp-master

Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Id88890e2e87d94d4bd2a55ac3812d1b11a78b26b

6 years agoMove crypto related functions into crypto_toolbox
Jakub Pawlowski [Thu, 21 Jun 2018 12:23:47 +0000 (14:23 +0200)]
Move crypto related functions into  crypto_toolbox

Also clean up the code:
* remove spurious logging, or replace with DVLOG
* use std::copy and std::reverse_copy instead of ARRAY_TO_STREAM and
  REVERSE_ARRAY_TO_STREAM

Test: CryptoToolboxTest already cover all those functions
Change-Id: I3221d0966d2dd6ca229adf441ceb75dd37a54d7c
Merged-In: I3221d0966d2dd6ca229adf441ceb75dd37a54d7c

6 years agoMerge "Reset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands"
Pavlin Radoslavov [Tue, 26 Jun 2018 03:09:18 +0000 (20:09 -0700)]
Merge "Reset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands"
am: 96e84672e8

Change-Id: I12094731788806e14e0cc57af3b239415e69770e

6 years agoMerge "Reset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands"
Treehugger Robot [Tue, 26 Jun 2018 03:02:47 +0000 (03:02 +0000)]
Merge "Reset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands"

6 years agoMerge "Add missing btif_a2dp_audio_interface_end_session() call during disconnect"
Pavlin Radoslavov [Tue, 26 Jun 2018 02:57:36 +0000 (19:57 -0700)]
Merge "Add missing btif_a2dp_audio_interface_end_session() call during disconnect"
am: 80241319d9

Change-Id: I0531174e25223961caaeaa62b45e1ef53142eace

6 years agoMerge "Add missing btif_a2dp_audio_interface_end_session() call during disconnect"
Treehugger Robot [Tue, 26 Jun 2018 02:50:44 +0000 (02:50 +0000)]
Merge "Add missing btif_a2dp_audio_interface_end_session() call during disconnect"

6 years agoMerge "a2dp_vendor_ldac: add missing break"
Tom Yan [Tue, 26 Jun 2018 02:16:06 +0000 (19:16 -0700)]
Merge "a2dp_vendor_ldac: add missing break"
am: 61966a4045

Change-Id: I91be0419a5de60d40ca9cc22fedf74573cb2db59

6 years agoMerge "a2dp_vendor_ldac: add missing break"
Treehugger Robot [Tue, 26 Jun 2018 02:07:46 +0000 (02:07 +0000)]
Merge "a2dp_vendor_ldac: add missing break"

6 years agoReset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands
Pavlin Radoslavov [Mon, 25 Jun 2018 22:22:13 +0000 (15:22 -0700)]
Reset a2dp_cmd_pending as appropriate for A2DP HW offload HAL commands

Previously, the a2dp_cmd_pending was set to the last pending command,
but was never reset to A2DP_CTRL_CMD_NONE after the command processing
was completed.

Bug: 110712574
Test: Manual: Pair with two headsets, start/suspend/stop/switch active
      device
Change-Id: I464e6e9d41a221df44eba21e538b499a9ac1dcfb

6 years agoAdd missing btif_a2dp_audio_interface_end_session() call during disconnect
Pavlin Radoslavov [Mon, 25 Jun 2018 23:34:17 +0000 (16:34 -0700)]
Add missing btif_a2dp_audio_interface_end_session() call during disconnect

Update the logic inside btif_a2dp_source_end_session_delayed() to make
sure that btif_a2dp_audio_interface_end_session() is called when device
is disconnected.

Also, update existing log messages to make it easier to identify similar
issues in the future.

Bug: 110176990
Test: Manual: Pair with two headsets, start/suspend/stop/switch active
      device
Change-Id: I248e5c3e2c4cf0ad820cef34ba859e9adc8dec8e

6 years agoa2dp_vendor_ldac: add missing break
Tom Yan [Wed, 20 Jun 2018 04:10:45 +0000 (12:10 +0800)]
a2dp_vendor_ldac: add missing break

Bug: 110800823
Test: Code compilation
Change-Id: I9b40f63d176031087cb2ab2f2b5400b4d326cf8f
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
6 years agoLinux build fix
Jakub Pawlowski [Fri, 22 Jun 2018 12:22:50 +0000 (05:22 -0700)]
Linux build fix
am: 55faa9e962

Change-Id: Id8a1d0a02c60f86d7232394ad60af56b96a05b4e

6 years agoLinux build fix
Jakub Pawlowski [Thu, 21 Jun 2018 07:03:45 +0000 (09:03 +0200)]
Linux build fix

Add empty android_errorWriteLog implementation for Linux
Add missing license headers
Fix BUILD.gn files

Test: compile using ninja
Change-Id: I9be297d5847b4c0856786738eac2c30424593919

6 years agoMerge "HFP: Don't use mSBC for HF devices not supporting Codec Negotiation"
weichinweng [Fri, 22 Jun 2018 05:32:35 +0000 (22:32 -0700)]
Merge "HFP: Don't use mSBC for HF devices not supporting Codec Negotiation"
am: f7c320273a

Change-Id: Ic17dcbc95f5fc000f7225eafc7cc7c803c871738

6 years agoMerge "HFP: Don't use mSBC for HF devices not supporting Codec Negotiation"
Treehugger Robot [Fri, 22 Jun 2018 05:26:17 +0000 (05:26 +0000)]
Merge "HFP: Don't use mSBC for HF devices not supporting Codec Negotiation"