OSDN Git Service
Pavlin Radoslavov [Tue, 27 Feb 2018 07:16:43 +0000 (23:16 -0800)]
Removed redundant alarm_free() call on the wrong thread
Bug:
73741079
Bug:
73892830
Test: Manual - A2DP connect/disconnect; audio streaming
Change-Id: I3e553245ef5ac10835d08b78e52a3fbd945914ee
Pavlin Radoslavov [Tue, 27 Feb 2018 06:44:30 +0000 (22:44 -0800)]
Perform all codec-related init operations on the same thread
Renamed btif_a2dp_source_encoder_init_event() to
btif_a2dp_source_setup_codec_delayed() and moved the
peer parameter fetching from btif_a2dp_source_setup_codec()
to btif_a2dp_source_setup_codec_delayed()
Test: Manual - A2DP connect/disconnect; audio streaming
Change-Id: Ib29dd6b2bef3045be3727122e1f8608780921d98
Pavlin Radoslavov [Tue, 27 Feb 2018 03:16:05 +0000 (19:16 -0800)]
Initialize max number of connected A2DP devices in the native stack via JNI
Pass the maximum number of connected A2DP devices from Java to the
native stack as a parameter to the init() call.
Bug:
72351654
Test: Manual: Connect to multiple A2DP devices, check the log messages
Change-Id: I0647c36fe7c6a2df2c42a60b53b5cf505160b1e6
Treehugger Robot [Tue, 27 Feb 2018 01:02:21 +0000 (01:02 +0000)]
Merge "Add/update the BTIF A2DP log messages"
Myles Watson [Sat, 24 Feb 2018 01:28:23 +0000 (17:28 -0800)]
HCI: Set a timer to abort after a timeout
Add code to clean up the timer and close the file whether
abort gets called or not.
Bug:
72719600
Bug:
72474659
Test: Cause an HCI timeout and wait for the firmware dump
Change-Id: I713f440d77bfad4c9f17dfc57f98ba5bada37fff
Pavlin Radoslavov [Mon, 26 Feb 2018 20:08:22 +0000 (12:08 -0800)]
Add/update the BTIF A2DP log messages
* Added new log messages where needed
* Updated existing log messages so the message format is more aligned
with the rest of the messages
Test: Manual: A2DP streaming
Change-Id: I9f953c43df1ff415379bb7d7fb61f0d33760df30
Jakub Pawlowski [Thu, 22 Feb 2018 23:02:25 +0000 (15:02 -0800)]
Use assigned UUID for Hearing Aid Service
Test: manual
Bug:
64038649
Change-Id: Ie5b39d74d245373142be31027cccb5f51f8586bf
Treehugger Robot [Sat, 24 Feb 2018 04:49:57 +0000 (04:49 +0000)]
Merge "Add explicit init/cleanup steps for A2DP Source and Sink"
Pavlin Radoslavov [Fri, 23 Feb 2018 17:04:57 +0000 (09:04 -0800)]
Add explicit init/cleanup steps for A2DP Source and Sink
The startup/shutdown steps for A2DP Source and Sink
are done when setting/resetting the Active device, and this
implies the device has been connected.
The operations that must be done before the remote device
is connected are moved to init (and cleanup for the reverse operations)
Bug:
73832547
Test: Manual - Connect/disconnect/play A2DP to Headset
Change-Id: Iaa55c2d27443646111f07a53d2c5163bca9e256d
Manoj Babulal [Thu, 13 Jul 2017 07:04:09 +0000 (12:34 +0530)]
L2CAP: Discard pending requests on link disconnect
Scenario: A connection request packet is admitted to link tx queue in
L2CAP but before it could be transmitted (host busy), ACL link can get
disconnected (idle timeout) and the link tx queue is not flushed during
link disconnect handling. In such scenario, subsequent connection
attempt by host is seen to fail. This is because host is found to send
multiple connection requests (one connect request packet from the queue
and a new connection request packet per new request). Remote accepts old
connection request packet and waits for connection response from host.
For next connection request seen by remote, remote responds with 'No
PSM' resource error (as it already admitted one connection request and
it is in progress). Here when the connection response arrives from
remote, host ignores it because it sees packet id mismatch (host had
sent old connection request first and later information request/response
packets were exchanged. Remote had sent connection response copying
stale packet id picked from old connection request).
Drop queued packets as part of link disconnection handling.
This was already done in BLE transport case and is now being done
unconditionally.
Fixes:
73050475
Test: back-to-back PAN connect-disconnect iterations amidst ongoing
OPP file transfer and AV streaming
Change-Id: I42cc7ae90cc1152f1781282698529fe50f0ebf89
Ajay Panicker [Wed, 21 Dec 2016 23:37:34 +0000 (15:37 -0800)]
Uprev to AVDTP 1.3 and Implement AVDTP delay reports
Implement receiving the delay report message which requires AVDTP 1.3.
Also start keeping track of total number of audio bytes sent over the
air. We now will report both of these values to the audio HAL so that
they can adjust audio playback using these values.
Bug:
32755225
Test: Manual test with a device that supports delay reporting
Testtracker: 145280
Change-Id: I22c1c6401e4912efab06fa56fb582faae4b38eaf
Treehugger Robot [Fri, 23 Feb 2018 18:32:54 +0000 (18:32 +0000)]
Merge "Remove unreachable code"
Pavlin Radoslavov [Fri, 23 Feb 2018 11:35:37 +0000 (03:35 -0800)]
Free the A2DP Source media alarm on the A2DP Source worker thread
Move the alarm_free() for the A2DP Source media alarm from
btif_a2dp_source_shutdown() to btif_a2dp_source_shutdown_delayed().
The latter is executed on the btif_a2dp_source_thread.
This avoids a race condition with btif_a2dp_source_audio_tx_stop_event()
that also might attempt to free the same alarm.
Test: Manual - unpair A2DP device while A2DP streaming.
Bug:
73741079
Change-Id: Ia871fcbeaae7c351878228e7605e65307a3d1583
Pavlin Radoslavov [Sat, 10 Feb 2018 23:23:49 +0000 (15:23 -0800)]
Correct the value for BT_RC_NUM_APP for Multi-A2DP / Multi-AVRCP
The original value of BT_RC_NUM_APP was incorrectly increased from
1 to 12 for the purpose of supporting up to 6 AVRCP connected devices.
The new BT_RC_NUM_APP value is corrected to 6:
BT_RC_NUM_APP -> 1 -> 12 -> 6 (AVRCP-related - MaxDevices)
Test: Manual - connected to multiple headsets and selected each
headset to play audio.
Bug:
70350399
Change-Id: I53e350c2bf1717b1f031a7a265adf3417cf3c513
Ajay Panicker [Sun, 26 Nov 2017 00:27:33 +0000 (16:27 -0800)]
Replace AVRC callback function pointers with base::Callback
Replace function pointers with base::Callback for AVRCP to make
interfacing with the new AVRCP service easier.
Bug:
68812037
Test: Connect headset and see that Absolute volume and passthrough
commands still work.
Change-Id: I2ab20b7b59186aea413a736f43e926e17915a139
Andre Eisenbach [Wed, 21 Feb 2018 02:38:52 +0000 (02:38 +0000)]
Revert "Remove A2DP Source/Sink startup calls during A2DP initialization"
This reverts commit
83255478b0457f291d6a78795444ff3b895d4a90.
Reason for revert:
Prevents audio routing due to stale active device record if
Bluetooth is toggled without the process stopping completely
(ex. LE-only mode).
Bug:
72701090
Change-Id: Ifa798e63df14855b5bf0bd45e1557315cd51034d
Fixes:
73601288
Ajay Panicker [Sat, 17 Feb 2018 19:22:48 +0000 (11:22 -0800)]
Add packet classes needed for AVRCP Absolute Volume
Add the Register Notification Request packet as well as the
packets Set Absolute Volume packet.
Bug:
68854188
Test: run host native test net_test_packets
Change-Id: Ie0d1f1fb23254c1353b6a73529ca93e92f231ed5
Yi Kong [Tue, 20 Feb 2018 17:48:09 +0000 (12:48 -0500)]
Remove unreachable code
The conditionals can never be true, as they are outside of the bounds of
their data types. Fixes tautological-constant-compare warning.
Bug:
72331526
Test: m
Change-Id: I74063fe19b319ee32e4c1c8b3a5fc7ed612586e3
Myles Watson [Fri, 16 Feb 2018 21:11:04 +0000 (13:11 -0800)]
OSI: Protect cutils/properties.h from direct calls
Bug: None
Test: compile, no calls to property_get outside of libosi
change PROPERTY_VALUE_MAX in osi/include/properties.h
-> doesn't compile
Change-Id: I18c7b861782b1df4878da032ae3f0340dffdecab
Jakub Pawlowski [Fri, 16 Feb 2018 21:21:58 +0000 (13:21 -0800)]
Get rid of BTA_HOST_INTERLEAVE_SEARCH
Test: compilation
Change-Id: I6f91cd783fc1dd46cda55d3456a67eb78ba4c7ae
Treehugger Robot [Fri, 16 Feb 2018 05:49:15 +0000 (05:49 +0000)]
Merge "Make STREAM_TO_UINT64 globally available"
Treehugger Robot [Fri, 16 Feb 2018 04:49:38 +0000 (04:49 +0000)]
Merge "Add btif_config_(get/set)_uint64"
Jakub Pawlowski [Thu, 15 Feb 2018 18:09:03 +0000 (10:09 -0800)]
Add btif_config_(get/set)_uint64
Bug:
69623109
Test: added ConfigTest.config_get_uint64
Change-Id: Id2285a6f961f72d28912defad66663ddd05fb741
Jakub Pawlowski [Thu, 15 Feb 2018 23:38:39 +0000 (15:38 -0800)]
Reduce spammy error log in gatt_attr.cc, plus minor logging improvements
Test: compilation, observe colored log output on startup
Change-Id: I6671f5a900f15a57cc9b38b01aaec296002ad233
Jakub Pawlowski [Thu, 15 Feb 2018 18:18:29 +0000 (10:18 -0800)]
Make STREAM_TO_UINT64 globally available
Bug:
69623109
Change-Id: I38958dc16d42ab2396d3acd7605b63ec6a6c2dd8
Treehugger Robot [Thu, 15 Feb 2018 04:14:43 +0000 (04:14 +0000)]
Merge "Final IBluetoothHearingAid.aidl improvements"
Jakub Pawlowski [Wed, 14 Feb 2018 22:04:56 +0000 (14:04 -0800)]
Final IBluetoothHearingAid.aidl improvements
Use HiSyncId instead of CustomerId for unique hearing aid id, use proper
data type for it (64bit).
Make setVolume, adjustVolume return void, like for AVRCP.
Bug:
69623109
Test: compliance with the spec
Change-Id: I5fd51514793052d4ee2c3f9029eb75491145cc25
Pavlin Radoslavov [Wed, 14 Feb 2018 18:26:13 +0000 (10:26 -0800)]
Remove A2DP Source/Sink startup calls during A2DP initialization
Don't call btif_a2dp_source_startup() / btif_a2dp_sink_startup()
inside BtifAvSource::Init() / BtifAvSink::Init() .
Those calls are already happening at the right time later during
BtifAvSource::SetActivePeer() / BtifAvSink::SetActivePeer()
Bug:
72701090
Test: Manual with multiple headsets
Change-Id: I634a2c90a7758891565c97e86b83335608ffab69
Pavlin Radoslavov [Wed, 14 Feb 2018 12:12:54 +0000 (04:12 -0800)]
Use correct call btif_a2dp_sink_startup() for Sink peers
Replaced an incorrect call to btif_a2dp_source_startup() with
btif_a2dp_sink_startup() inside BtifAvSink::SetActivePeer()
Also, minor cleanup: fix log messages, add missing description for
some of the methods.
Bug:
72701090
Test: Manual with Headet
Change-Id: I0620833b02bd9012fea63ce2ce5e3c4c74d27bf7
Hansong Zhang [Fri, 2 Feb 2018 02:02:53 +0000 (18:02 -0800)]
A2DP: Cleanup UIPC when no active device
* Modified UIPC to support multiple users
* A2DP now calls UIPC_Close() when it has no active device, and calls
UIPC_Init() when it has an active device
Bug:
72701090
Test: Carkits with A2DP
Change-Id: Ic1b4b1be2aa01c9896883e3cb2a668d7a43316f9
Treehugger Robot [Wed, 14 Feb 2018 03:48:51 +0000 (03:48 +0000)]
Merge "Add AVRCP Browse packets to the completed packets."
Treehugger Robot [Wed, 14 Feb 2018 03:06:38 +0000 (03:06 +0000)]
Merge "btif: Remove unused synchronization in event_cleanup_stack"
Treehugger Robot [Wed, 14 Feb 2018 02:13:41 +0000 (02:13 +0000)]
Merge "IBluetoothHearingAid.aidl"
Ajay Panicker [Tue, 30 Jan 2018 18:36:45 +0000 (10:36 -0800)]
Add AVRCP Browse packets to the completed packets.
Also add class representations for the following packet types:
AVRCP Browse Packet
AVRCP Change Path
AVRCP Get Folder Items
AVRCP Get Item Attributes
AVRCP Set Browsed Player
AVRCP Get Total Number of Items
AVRCP Play Item
Bug:
68854188
Test: run host native test net_test_packets
Change-Id: I0bc682b11ec9181cfe1ed92678bb869ff3ef5740
Treehugger Robot [Wed, 14 Feb 2018 01:20:48 +0000 (01:20 +0000)]
Merge "Adjust buffer length to fit in sdp_copy_raw_data()"
Manu Viswanadhan [Fri, 14 Oct 2016 11:35:35 +0000 (17:05 +0530)]
btif: Remove unused synchronization in event_cleanup_stack
Use Case: Repeated BT ON/OFF
Failure: FD leak is observed with ON/OFF stress test
which eventually leads to crash due to unavailability
of FDs.
Steps:
BT ON/OFF
Root Cause: During stack cleanup an unused future
structure is created which is not freed, leading to FD
leak.
Fix: Remove the creation of the future structure
Test: BT ON/OFF
Fixes:
36019324
Change-Id: Id5945da87f00eb7ab77a5f217c95cc43f0136e06
Jakub Pawlowski [Tue, 13 Feb 2018 18:12:00 +0000 (10:12 -0800)]
IBluetoothHearingAid.aidl
Bug:
69623109
Test: Spec was reviewed, tests will be included with client/server implementation
Change-Id: I8c972ac0e4aa908a14893c957ae07dd2244abbfe
Venkata Jagadeesh Garaga [Thu, 15 Sep 2016 10:21:40 +0000 (15:51 +0530)]
Adjust buffer length to fit in sdp_copy_raw_data()
Align copy length with source buffer offset so that copy length will be
in boundary of the allocated buffer size
Test: Manual tested with DECK speaker.
Fixes:
35864526
Change-Id: If1a49e46e2948346226fbc96d7c2b56244cd60cc
Myles Watson [Tue, 13 Feb 2018 18:33:54 +0000 (10:33 -0800)]
Factor out libchrome_support_defaults
Disable Mac support for host binaries in one place, since
the dependency is based on libchrome support.
Test: build
Change-Id: I6641e18deffdff5205da181ad97e8b2892073a8f
Treehugger Robot [Tue, 13 Feb 2018 17:34:05 +0000 (17:34 +0000)]
Merge "Remove libbluetooth-system requirement."
Stanley Tng [Thu, 8 Feb 2018 20:26:51 +0000 (12:26 -0800)]
Add more details in native Bluetooth debug logs
As part of debugging a security/pairing issue, these logs are modified
to give better debug information.
Test: compiled
Bug:
71364658
Change-Id: I742cc7dda0afc6350e881c22d03bdc1c69d37d88
Jakub Pawlowski [Mon, 12 Feb 2018 21:18:33 +0000 (13:18 -0800)]
Make loghex properly count numer length
Test: manual logs observation
Change-Id: I7ea8d4afa5ea980f11067a8dd920a1735cf28993
Steven Moreland [Mon, 12 Feb 2018 22:40:07 +0000 (14:40 -0800)]
Remove libbluetooth-system requirement.
This module doesn't exist and it being missing was
silently ignored.
Bug:
7456955
Test: no longer receive an error for this.
Change-Id: Ib84b592d25e19b2c6b0d20466015553fe57f5bf8
Ajay Panicker [Sat, 10 Feb 2018 02:42:56 +0000 (18:42 -0800)]
AVRCP: Don't fail in set_volume on disconnected devices
Test: Change the volume on a headset with absolute volume
Bug:
72987704
Change-Id: Ia1acd28c51707e7b71e47140aaded0298ba4e8aa
Treehugger Robot [Sat, 10 Feb 2018 00:28:54 +0000 (00:28 +0000)]
Merge "Build: Remove DCHECK_ALWAYS_ON flag"
Treehugger Robot [Fri, 9 Feb 2018 22:14:27 +0000 (22:14 +0000)]
Merge "A2DP: Construct BtWorkerThread's message loop on designated thread"
Jack He [Fri, 9 Feb 2018 11:02:46 +0000 (03:02 -0800)]
Build: Remove DCHECK_ALWAYS_ON flag
* According to libchrome documentation, DCHECK_ALWAYS_ON must be set or
unset on both our library and libchrome. Flag mis-match may cause
hard-to-debug segfaults which we experience when using base::Thread
Change-Id: If3740196340b02d2d0bb41e08f0b551d47f49864
Fixes:
73147157
Test: make
Jack He [Thu, 8 Feb 2018 01:33:16 +0000 (17:33 -0800)]
A2DP: Construct BtWorkerThread's message loop on designated thread
* Moves BtWorkerThread's message_loop_'s construction to the
Run() method run by the designated message_loop_thread_ so that
message_loop_'s construction and execution are on the same thread
* Makes BtWorkerThread::StartUp() blocking until message_loop_
starts running using std:condition_variable
* Modify BtWorkerThread::DoInThread() to return boolean
Detail:
Before this CL, BtWorkerThread.message_loop_ is created on Java main
thread and run on message_loop_thread_. During clean-up, A2DP shutdown
message_loop_thread_, rendering the posted_from field in current_pending_task_
invalid. However, although the runner thread is killed, the owner
thread, the Java main thread, is still active. Therefore, we we try to
PostTask() from Java main thread after message_loop_thread_ is killed,
we will try to access an invalid Location object. This results in a
SEGV_MAPPER SEGFAULT. Thus, the fix would be creating and running the
message loop on the same thread so that Java main thread won't have an
invalid message loop after the worker thread is killed.
This can be detected earlier through adding "-DDCHECK_ALWAYS_ON" in both
libchrome and libbluetooth and libchrome will validate the thread for
us.
Fixes:
72831931
Test: Test with DCHECK_ALWAYS_ON in both libbluetooth and libchrome
ProfileServiceTest stress tests
Change-Id: I7b196b8c1113c2758c2b82ddf4d13c46352bb620
Treehugger Robot [Fri, 9 Feb 2018 04:19:31 +0000 (04:19 +0000)]
Merge "Prevent spurious connect failures callback"
Jakub Pawlowski [Thu, 8 Feb 2018 18:26:35 +0000 (10:26 -0800)]
btif_rc - make set_volume easier to comprehend
Test: compilation
Change-Id: I73c01cb5e3a2da1cdb9acc3b7fe3114f4af7373e
Stanley Tng [Thu, 8 Feb 2018 01:59:04 +0000 (17:59 -0800)]
Prevent spurious connect failures callback
Send connection failures only if the event's mac address matches the
currently bonding device.
Test: Run SL4A "BleCocTest:test_coc_secured_connection_throughput"
Bug:
71364658
Change-Id: I64243996ae37dd376ed36363a7d749b4b5ab36b2
Treehugger Robot [Thu, 8 Feb 2018 05:02:48 +0000 (05:02 +0000)]
Merge "Make sure task_runner is valid when we call PostTask on it"
Jakub Pawlowski [Wed, 7 Feb 2018 19:37:18 +0000 (11:37 -0800)]
Call BTA_GATTS_AddService on correct thread
Right now BTA_GATTS_AddService is incorrectly called on btif thread.
This might lead to situations where it is executed while bta thread is
already cleaning up, and deleted the control blocks, resulting in crashes.
From now on, execute it on bta thread. This ensures that it is executed
before control blocks are freed.
Test: sl4a GattClientTest
Bug:
73054849
Change-Id: Ie2bf80414bceba2590c21d3825c78fbb58449520
Jakub Pawlowski [Wed, 7 Feb 2018 02:50:10 +0000 (18:50 -0800)]
Make sure task_runner is valid when we call PostTask on it
Test: runtest -j32 bluetooth -c com.android.bluetooth.btservice.ProfileServiceTest
Change-Id: I89426f7eb1204af9def0fa927dfeef1d5aec689f
Srinu Jella [Fri, 24 Feb 2017 04:31:32 +0000 (10:01 +0530)]
HBS1098 Paring failure after connection with Car-Audio
Use Case: HBS1100 Paring failure after connection with Car-Audio
Steps:
1. Establish connection with Volkswagen CK, and then playback music
2. Try to pair with HBS-1100
Failure: DUT going for temporary pairing with HBS1100 when request received
while remote name is not present
Root Cause: As auth_req is not handled properly in bta_dm_pinname_cback during
RNR, auth_req variable got reset and DUT is going for temporary pairing.
Fix: local and remote auth_req and local and remote IO capabilities stored and
retained in call backs properly.
Test: Manually tested
Fixes:
35735338
Change-Id: I83382aac9fc1197d7fb31feedbd0fe3b35de87e8
Stanley Tng [Tue, 6 Feb 2018 01:02:33 +0000 (01:02 +0000)]
Merge changes from topic "coc-test-increase-data-len"
* changes:
Add function to change LE Tx Data Length
LE Read Maximum Data Length during startup
Stanley Tng [Tue, 23 Jan 2018 01:08:03 +0000 (17:08 -0800)]
Add function to change LE Tx Data Length
As part of new SL4A tests for LE CoC to measure data throughput, this
commit adds a function to modify the LE Tx Data Length parameter to its
maximum.
Test: Ran the new ACTS Tests for LE CoC; BtCocTest and BtCoc2ConnTest
Bug:
70683224
Change-Id: I06d3f95a339dcdc310a18bcf17fbca8623f849d6
Jakub Pawlowski [Sat, 3 Feb 2018 06:05:11 +0000 (22:05 -0800)]
LE Read Maximum Data Length during startup
Test: verified in sl4a test for LE CoC throughput
Bug:
68359837
Change-Id: Ie424fef50f6f355d2919d9304bd062e4604c3341
Jakub Pawlowski [Fri, 2 Feb 2018 19:47:09 +0000 (11:47 -0800)]
Unify logging in btif_sock_l2cap.cc
Test: compilation
Bug:
68359837
Change-Id: I71edd3d04734471b6cd586c323aa6b335f903fae
Hidehiko Abe [Wed, 31 Jan 2018 07:59:18 +0000 (16:59 +0900)]
Remove Mac host libraries build depending on libchrome.
Libchrome will drop the support for Mac host.
This is the preparation.
Bug:
72618679
Test: Built on Mac.
Change-Id: I37982210a1da74d56c1da3227c5887685cd8b6cb
Stanley Tng [Sat, 3 Feb 2018 01:36:03 +0000 (01:36 +0000)]
Merge "Add function to update LE connection parameters"
Stanley Tng [Thu, 4 Jan 2018 23:49:35 +0000 (15:49 -0800)]
Add function to update LE connection parameters
As part of new SL4A tests for LE CoC to measure data throughput
performance, this commit will add a function to enable the CoC Facade
to modify the LE Connection Parameters especially the Connection
Intervals. Also, add some debug logs.
Test: Ran the new ACTS Tests for LE CoC
Bug:
70683224
Change-Id: If7665cf70a18756a58556c60cb9ce2a587ae691f
Jakub Pawlowski [Tue, 30 Jan 2018 23:40:03 +0000 (15:40 -0800)]
Maximize L2CAP socket MTU
Introduce L2CAP_SDU_LENGTH_LE_MAX constant, and use it for LE CoC
sockets, while still keeping the old value for Classic sockets.
This also require change in how we send the rx_mtu up the stack - it
must be read from the socket property.
Additionally in this patch, l2cap_socket.mtu is renamed to tx_mtu to
distinguish it from rx_mtu. Assignment of this variable is also added
when we receive it from the remote.
Bug:
68359837
Test: tranfer file using OPP, do obex, run LE CoC tests. Run tests
between device with this patch, and older android phones.
Change-Id: Iffa20a6c6a93d5787bada7bf28655e9880d8c1a0
Jakub Pawlowski [Wed, 31 Jan 2018 06:35:11 +0000 (22:35 -0800)]
BTA_JvL2capConnect simplification
Test: manual
Change-Id: I18ac5ac451490e0d3c0c9fc5daa9f8d64ff19bd5
Jakub Pawlowski [Wed, 31 Jan 2018 05:46:08 +0000 (21:46 -0800)]
Simplify btSock_start_l2cap_server_l
Test: run OPP, chekc LE CoC
Change-Id: I4091ea8065ba913966fcd14495b90b2c565fdba3
Treehugger Robot [Fri, 2 Feb 2018 05:00:19 +0000 (05:00 +0000)]
Merge changes I00560443,I2e39bd31
* changes:
Stricter check of the MTU size in the BTIF L2CAP socket
Fix naming error in btif l2cap MPS -> MTU
Treehugger Robot [Fri, 2 Feb 2018 01:41:53 +0000 (01:41 +0000)]
Merge "Add more checks to LE Connection Parameters"
Treehugger Robot [Fri, 2 Feb 2018 00:23:42 +0000 (00:23 +0000)]
Merge "Metrics: Dump native metrics to Java as std:string"
Jakub Pawlowski [Wed, 31 Jan 2018 03:45:35 +0000 (19:45 -0800)]
Stricter check of the MTU size in the BTIF L2CAP socket
Test: manual
Bug:
68359837
Change-Id: I0056044388f8886f704a9ff2f30db09b3110d143
Jakub Pawlowski [Wed, 31 Jan 2018 03:39:52 +0000 (19:39 -0800)]
Fix naming error in btif l2cap MPS -> MTU
BTIF layer uses only MTU, maximum size of SDU, to do computations around
sizes. This error was introduced earlier during refactor.
Test: compilation
Bug:
68359837
Change-Id: I2e39bd31ce712d22f43e3059b6e1c73ef7b0fee7
Stanley Tng [Thu, 1 Feb 2018 21:21:24 +0000 (13:21 -0800)]
Add more checks to LE Connection Parameters
This part of code is missing the necessary LE Connection Parameters
checks.
Test: Tested on R.A.T. LE mouse
Bug:
70683224
Change-Id: I966a3dd4fd2fa9dc54109872df3d4c43d34f0156
Treehugger Robot [Thu, 1 Feb 2018 21:19:47 +0000 (21:19 +0000)]
Merge "Minimize amount of Flow Control packets for L2CAP CoC"
Treehugger Robot [Thu, 1 Feb 2018 20:02:05 +0000 (20:02 +0000)]
Merge "PDU data lengty computation fix"
Jack He [Thu, 1 Feb 2018 00:51:26 +0000 (16:51 -0800)]
Metrics: Dump native metrics to Java as std:string
* Dump metrics to Java layer as std::string instead of going through a
file descriptor so that Java layer can process metrics data directly
* Add new method dumpMetrics(std::string*)
Bug:
33693818
Test: adb shell dumpsys bluetooth_manager --proto-bin
SL4A metrics tests: BtMetricsTest, BtFunhausMetricsTest
Change-Id: I67883c1371862d7e4ff33cec01d710d2d8f274c9
Jakub Pawlowski [Thu, 1 Feb 2018 18:03:37 +0000 (10:03 -0800)]
PDU data lengty computation fix
PDU data must also account for PDU length and Channel ID fields.
Otherwise each PDU is split into 2 BB packets, decreasing the link
speed.
Test: manual data transimssion test.
Change-Id: I026bf0e32c58eec620b5c55d748ecd81fa3ea67b
Treehugger Robot [Wed, 31 Jan 2018 22:49:28 +0000 (22:49 +0000)]
Merge "Set pending_discovery when doing GATT over BR/EDR"
Jakub Pawlowski [Thu, 4 Jan 2018 13:06:21 +0000 (05:06 -0800)]
Minimize amount of Flow Control packets for L2CAP CoC
In order to not waste bandwidth on Flow Control packets with credits:
1. Set Initial Credits in the connect request/response to the maximum value
2. Send credits only when the remote has less than 64 of them left,
increasing the value back to maximum.
Bug:
68359837
Test: observe data flow in btsnoop log
Change-Id: I34e1fecc55422b34df0b1e82bb2b402eb06620bd
Jack He [Wed, 31 Jan 2018 21:02:12 +0000 (13:02 -0800)]
BUILD: Fix broken build for test-vendor_test_host
* Disable darwin build for test-vendor_test_host explicitly as
it does not use "fluoride_defaults" in its build configuration.
Bug:
72618679
Test: make
Change-Id: Ia81bf705ad248e129df69c14e385ced118c6df58
Treehugger Robot [Wed, 31 Jan 2018 20:01:39 +0000 (20:01 +0000)]
Merge "BUILD: Disable build for mac-host target"
Jack He [Tue, 30 Jan 2018 22:35:20 +0000 (14:35 -0800)]
BUILD: Disable build for mac-host target
* Move disable darwin (mac) options to "fluoride_defaults".
* mac-host target is disabled across fluoride, but developer can still
build for non-mac targets on a mac host.
* Remove vendor_libs/Android.mk that is no longer used.
Bug:
72618679
Test: make
Change-Id: Ibad9fad3df169e9c4e418a4511c42066fcb10fdc
Jakub Pawlowski [Wed, 31 Jan 2018 19:49:59 +0000 (11:49 -0800)]
Set pending_discovery when doing GATT over BR/EDR
SDP discovery can return services before LE discovery, or after LE
discovery is already done. In both cases, pending_discover is not a
valid pointer, and must be set before call to bta_gattc_explore_srvc
Test: sl4a GattOverBrEdr
Change-Id: I2b43d2348edfa641c56a8085a92b6367b146030d
Jakub Pawlowski [Mon, 29 Jan 2018 21:54:24 +0000 (13:54 -0800)]
Get rid of L2CAP_MAX_BUF_SIZE, use variable-size buffers instead
This is step towards increasing L2CAP_MAX_SDU_LENGTH value.
Test: transfer file using OPP, send data using CoC
Bug:
68359837
Change-Id: Ia4fb6b2325cb92db9c90c6a4d2ab17f271640ea8
Myles Watson [Tue, 30 Jan 2018 17:15:16 +0000 (09:15 -0800)]
Packet: Disable host tests for Mac
Bug:
72618679
Test: Build on Mac
Change-Id: I85c1412b86a1fbbab01491a755be9bc2b8241d50
Treehugger Robot [Tue, 30 Jan 2018 15:37:46 +0000 (15:37 +0000)]
Merge "Drops unittest build on Mac host."
Ajay Panicker [Wed, 3 Jan 2018 22:23:44 +0000 (14:23 -0800)]
Add Packet class as alternative to BT_HDR
Adds Packets, Iterators, and Packet Builders to Bluetooth to be used as
an alternative to BT_HDR.
- Packet is a base class used to pass around data. It is intended to be
immutable after creation and subclasses will implement all required
functions and their own accessor methods to retrieve data.
- Iterator provides a convienent way to traverse packet data.
- PacketBuilder is used to construct Packets. This class is should be
the only way to mutate packet objects.
Also add class representations for the following packet types:
AVRCP (Base Packet)
AVRCP Vendor Packet
AVRCP Get Capabilities Packet
AVRCP Get Element Attributes Packet
AVRCP Register Notification Packet
AVRCP Get Play Status Packet
AVRCP Reject Packet
AVRCP Pass Through Packet
Adds net_test_btpackets to run_host_unit_tests.py for pre-submit
Bug:
68854188
Test: run host native test net_test_packets
Change-Id: I0d385710178e5feb2d5089847580754ad6308709
Hidehiko Abe [Mon, 29 Jan 2018 06:43:47 +0000 (15:43 +0900)]
Drops unittest build on Mac host.
Bug:
72618679
Test: Built on Mac.
Change-Id: If6e2f8cf39cd80e80a419fbbed0ce34931ede915
Jakub Pawlowski [Sat, 27 Jan 2018 01:18:52 +0000 (17:18 -0800)]
Report LE CoC credits to GAP clients
Test: manual with HA
Change-Id: Ic4552b05b6e6c7dad5311e0b893da3166bf1895c
Treehugger Robot [Sat, 27 Jan 2018 04:08:05 +0000 (04:08 +0000)]
Merge "Report credit count change, when credits are received for LE CoC"
Treehugger Robot [Sat, 27 Jan 2018 03:44:34 +0000 (03:44 +0000)]
Merge "HFP: Fix NPE in error logging for voice recognition events"
Jakub Pawlowski [Sun, 21 Jan 2018 00:07:10 +0000 (16:07 -0800)]
Report credit count change, when credits are received for LE CoC
Test: manual with HA
Bug:
69623109
Change-Id: I1c6f240eaf08d876bb285f3ffa737365f392925e
Jack He [Sat, 27 Jan 2018 01:39:23 +0000 (17:39 -0800)]
HFP: Fix NPE in error logging for voice recognition events
Bug:
72506800
Test: make and test with VREC events
Change-Id: I126b75d9e991b312e795ed38672b0153ca03dcea
Pavlin Radoslavov [Thu, 25 Jan 2018 13:15:38 +0000 (05:15 -0800)]
Disable host compilation on Darwin for net_test_btif_state_machine
The net_test_btif_state_machine unit test depends on libosi,
and that library itself is disabled for Darwin.
Test: Code compilation on Linux
Change-Id: I143015370988657e2903f86175244308c01d5162
(cherry picked from commit
8fb98a5350f8b5893b9fc160fa030fd7dbae06a9)
Pavlin Radoslavov [Tue, 16 Jan 2018 18:48:13 +0000 (10:48 -0800)]
Add a workaround for A2DP devices that request Role Change
Certain A2DP devices request Role Change after connection,
and typically the Phone grants it - as a result the Phone is the Slave.
However, with Multi-A2DP, follow-up A2DP connections require that the
Phone becomes the Master: within the existing stack we have function
bta_av_switch_if_needed() that checks whether the Phone needs to request
Role Change and become again the Master.
Some A2DP devices will refuse the Phone to become the Master again, and
this prevents/blocks the Phone from having multiple A2DP connections
that are open.
Test: Manual
Bug:
72122792
Bug:
70350399
Change-Id: I749c73a38e3fb10262143ba6b41a7d65309ddf49
(cherry picked from commit
0f82fe7b83dc765d245a8996ed758359643d5b0b)
Pavlin Radoslavov [Sat, 25 Nov 2017 03:12:11 +0000 (19:12 -0800)]
Add support for Multi-A2DP state machines per device
* Reimplement most of the BTIF AV state machinery in C++
- Separate the BTIF AV Source from BTIF AV Sink state:
btif_av_source and btif_av_sink
- Remove the single btif_av_cb control block instance
- Add C++ based BtifStateMachine and remove the older C-based
btif_sm state machine
- Introduce C++ class BtifAvPeer to keep state per peer, and use
a single state machine instance per peer
- Update BTA_AvStart() and BTA_AvStop() to take tBTA_AV_HNDL handle
argument
- Register the BTA handles when enabling the Source/Sink service.
This needs to be done in advance during service startup, otherwise
a connection to a remote device will fail.
- Move local event_handler functions inside C++ ProcessEvent methods,
and pocess the BTIF, BTA AV and BTA AVRCP events per state machine
instance
- Cleanup callbacks and use do_in_jni_thread() to schedule the processing
- Add BTIF AV API that needs to be called by the AVRCP module for certain
AVRCP events: btif_av_avrcp_event_open(), btif_av_avrcp_event_close()
btif_av_avrcp_event_remote_play()
- Add a mechanism to set the active device
- Add BluetoothDevice argument to the codec-related internal Binder
APIs: getCodecStatus(), enableOptionalCodecs(),
disableOptionalCodecs(), setCodecConfigPreference()
- Rename btif_av_move_idle() to btif_av_acl_disconnected() and
refactor the processing to happen within each state machine on the
correct thread.
- Process cleanup_src and cleanup_sink on the JNI thread
- Add a mechanism to track the maximum number of connected devices.
- Add unit tests for the new BtifStateMachine class
* Redesign some of the AVDTP internals so it can handle multiple connected
devices
- Change some of the AVDTP struct entries to C++ classes.
This simplifies significantly the design fixes
- Reorganize the AvdtpScb entries: for each connection the
corresponding SEP entries are within the corresponding AvdtpCcb entry.
- Pass peer address as argument to the API functions inside bta_av_co.cc,
and update the peer address inside the corresponding peer entry in
bta_av_co.cc
- Add various log mesages
- Store precomputed BTA AV SCB index in the AvdtpCcb entry and use it as
appropriate.
- Fix the TCID computation and handling for the AvdtpAdaptationLayer
- Fix the computed value for AVDT_NUM_RT_TBL
- Remove video-related code inside AVDTP
- Refactor/cleanup hard-coded callbacks that depend on the BTA_AV_NUM_STRS
value.
- Update various #define values to support a larger number of connected
devices:
- Maximum number of streams:
BTA_AV_NUM_STRS: 2 -> 6
- BT_RC_NUM_APP: 1 -> 12 (AVRCP-related - 2 * MaxDevices)
- MAX_L2CAP_LINKS: 7 -> 13
- MAX_L2CAP_CHANNELS: 16 -> 32
- AVDT_NUM_LINKS: 2 -> 6
- AVDT_NUM_SEPS: (6 * AVDT_NUM_LINKS) -> 6
Now the value is used for the maximum number of SEPs per device
- AVDT_NUM_TC_TBL: 6 -> (AVDT_NUM_SEPS + AVDT_NUM_LINKS)
- AVCT_NUM_LINKS: 2 -> 6
- AVCT_NUM_CONN: 3 -> 14 (2 * MaxDevices + 2)
Also:
- Update the JNI codec-related calls to use const reference
instead of a pointer
- Update the implementation of bta_av_chk_2nd_start() so it is aligned
with bta_av_chk_start() and cleaned up both functions.
- Rename btif_dispatch_sm_event() to btif_av_dispatch_sm_event() and
btif_report_source_codec_state() to btif_av_report_source_codec_state()
for consistency with the rest of the BTIF AV API.
- Add new function btif_rc_is_connected_peer() and remove
btif_rc_get_connected_peer()
- Add new AVRCP header file btif/include/btif_rc.h
and move the AVRCP "extern" declarations from btif_av.cc there.
- Rename btif_av_execute_service() to btif_av_source_execute_service()
- Cleanup the btif_av.h API descriptions
- Print the BTIF AV state in the "dumpsys bluetooth_manager" output
- Print the BTA AV state in the "dumpsys bluetooth_manager" output
- Print the AVDTP state in the "dumpsys bluetooth_manager" output
- Refactor btif_a2dp_source_cb into a class with internal state.
- Refactor A2DP Source worker thread handling and replace it with
libchrome message handler
- Refactor BtaAvCo component (bta_av_co.cc)
- C++ classes and state
- Rename bta_av_co_audio_src_data_path to
bta_av_co_audio_source_data_path
- Remove most BTA_AV_CO_CP_SCMS_T checks
- Replace mutex_global_lock() usage with local mutex
- Keep codec-specific state per peer
- Keep state about the active peer - the first connected peer is the
default active peer
- Report source codec state only for valid peers; i.e., don't report
source codec state for empty RawAddress
- Keep the contect_protect_active flag per peer
- Print the BTA AV CO state in the dumpsys bluetooth_manager" output
- Misc cleanup in BTA AV
- Add ToString() method to struct btav_a2dp_codec_config_t
- Additional cleanup
Bug:
70350399
Test: Manual and unit tests
Change-Id: Icecd7fd44a222d939b63a7473a2239ae0679f08c
Merged-In: Icecd7fd44a222d939b63a7473a2239ae0679f08c
(cherry picked from commit
c7242818d4180dec4eae2e75f9fb91f7f6a160aa)
Treehugger Robot [Fri, 26 Jan 2018 21:26:24 +0000 (21:26 +0000)]
Merge "btif: Name the unique_lock in initialize_transaction()"
Tom Cherry [Fri, 26 Jan 2018 17:43:35 +0000 (09:43 -0800)]
btif: Name the unique_lock in initialize_transaction()
initialize_transaction()'s unique_lock is released immediately as a
temporary variable because it does not have a name.
Bug:
72525761
Test: None
Change-Id: Ic1b1a0bd3ab1e5f993ffe5e81b0cc390cb4e34ab
Hemant Gupta [Tue, 23 Jan 2018 00:54:33 +0000 (16:54 -0800)]
Cancel LE Advertising related timers during shutdown
Failure to cancel advertising timers might lead to them being executed
after AdvertisingManager is destroyed.
Test: ran all advertising tests, no regression
Fixes:
71051865
Change-Id: I4431f5e0fe82501dbdbb9ca816eb092dde7c9436
Jakub Pawlowski [Thu, 25 Jan 2018 18:53:57 +0000 (10:53 -0800)]
Use weak pointer when refering to AdvertisingManager
In btif layer, we schedule tasks for execution on
AdvertisingManager on bta thread. Before the scheduling we check if
AdvertisingManager is initialized. We don't check if AdvertisingManager
is still valid, when the command execution is starting on the bta thread.
This is a race condition, that can cause crashes.
To fix that, always post task for execution using weak reference, rather
than raw pointer. Thanks to it, the MessageLoop will check if the
weak_ptr is valid before attempt to execute the task. The check happens
on the target thread, right before the execution, eliminating all
possible race conditions.
Test: ran all advertising tests, no regression
Bug:
71051865
Change-Id: I7fd8255879d5272d47aa79974bb79bdaacb55800
Jakub Pawlowski [Thu, 25 Jan 2018 22:37:16 +0000 (22:37 +0000)]
Merge "Fixed L2CAP Buffer Length when transmit packets"
Stanley Tng [Thu, 25 Jan 2018 19:40:35 +0000 (11:40 -0800)]
Fixed L2CAP Buffer Length when transmit packets
Fixed the problem of the L2CAP buffer length is incorrect than blasting
multiple small data packets from java layer. The buffer length should be
what is actually read rather than what is possible to be read.
Test: Ran the new ACTS Tests for LE CoC
Bug:
70683224
Change-Id: I6cf4d465a41e4e936420f76b49ce2dbda20d41fb