History log of /system/bt/btif/src/btif_sock_l2cap.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
35ee0236559de4c6e49d2b7620a50aefd63203fc 02-Feb-2018 Jakub Pawlowski <jpawlowski@google.com> Unify logging in btif_sock_l2cap.cc

Test: compilation
Bug: 68359837
Change-Id: I71edd3d04734471b6cd586c323aa6b335f903fae
/system/bt/btif/src/btif_sock_l2cap.cc
622bd222e41f0c4fa9558d443b3e15f6ff10e8d9 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> 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
/system/bt/btif/src/btif_sock_l2cap.cc
3538b64d9760d8b98900e768354e9f0c499db277 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> BTA_JvL2capConnect simplification

Test: manual
Change-Id: I18ac5ac451490e0d3c0c9fc5daa9f8d64ff19bd5
/system/bt/btif/src/btif_sock_l2cap.cc
e5e2dd556b5f271a9425e526c66bf70efe4503a8 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Simplify btSock_start_l2cap_server_l

Test: run OPP, chekc LE CoC
Change-Id: I4091ea8065ba913966fcd14495b90b2c565fdba3
/system/bt/btif/src/btif_sock_l2cap.cc
408b5f967a7cd2e5253d96e7500c5ccaca6bd1de 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Stricter check of the MTU size in the BTIF L2CAP socket

Test: manual
Bug: 68359837
Change-Id: I0056044388f8886f704a9ff2f30db09b3110d143
/system/bt/btif/src/btif_sock_l2cap.cc
6ee309dc06ec7c0ee34ec2e01fbeb5056b3f589f 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> 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
/system/bt/btif/src/btif_sock_l2cap.cc
f47bfde2ed74ecf4a3ead73775fbbde178d885d0 29-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> 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
/system/bt/btif/src/btif_sock_l2cap.cc
4492288232d55588c664b92d47ee824a7910d1bc 25-Jan-2018 Stanley Tng <stng@google.com> 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
/system/bt/btif/src/btif_sock_l2cap.cc
a34e9b482390c389bc35f85895564c55d5507763 05-Jan-2018 Stanley Tng <stng@google.com> Remove L2CAP_MASK_LE_COC_CHANNEL flag in channel number

Cleanup the code by removing the use of L2CAP_MASK_LE_COC_CHANNEL flag
in the channel number. This flag will be passed in the proper "flags"
parameter.

Test: Ran the new ACTS Tests for LE CoC
Bug: 70683224
Change-Id: I6ed77b46e5434bca5f2501d853ae8181c7197b4c
/system/bt/btif/src/btif_sock_l2cap.cc
84519312368dfa4b12c1be5b8c6290d26f397cbf 12-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> One less copy when sending LE CoC data.

After this patch, data is read from socket directly into BT_HDR that is
passed down the stack, rather than copying the data later.

Test: manual
Bug: 68359837
Change-Id: I3f304e6c7e60ce64b44350678d0ba10324fc97bc
/system/bt/btif/src/btif_sock_l2cap.cc
49dd53cb3db63dc0f328a6d18413d97b01a48176 20-Dec-2017 Stanley Tng <stng@google.com> Added support for new Android API for LE CoC

Added support for the new Android API including the management of the
LE_PSM values.
Also fixed a bug when de-registering the L2CAP CoC, the RCB is not
freed correctly.

Test: Ran the new ACTS Tests for LE CoC and existing ACTS for RfComm
Bug: 70683224
Change-Id: I5a545656bece667e7ba942d7b2334e3f5b49b283
/system/bt/btif/src/btif_sock_l2cap.cc
c474342ab57843baea7d0a57ba5a9ab4bf3decf6 11-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Make BTA_JvL2capWrite take ownership of the data buffer

This is first step towards making it accept BT_HDR with data, in order
to make LE sockets work with zero copies.

Bug: 68359837
Test: transfer file using OPP
Change-Id: Ib202520554bbc83cb8587bf1c4caa4b0da6b266c
/system/bt/btif/src/btif_sock_l2cap.cc
19d30611c425b6121e9815c996ad08cb4ce62967 08-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Remove duplicated code in l2cap_sock - on_l2cap_write_fixed_done

Test: none
Bug: 68359837
Change-Id: Ic3ebe0b7eebbd0122e7f7751ab3b48d6acf62da6
/system/bt/btif/src/btif_sock_l2cap.cc
8452b05b1a21d13e8d97f2f8af1b7cdf77c6cbaa 05-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Prevent LE CoC from dropping data when remote MPS>8087

When using LE Coc through Java socket, one can read MPS from
getMaxTransmitPacketSize(). If this value is bigger than
local device L2CAP_MAX_SDU_LENGTH, data sent to remote will be
truncated. This patch fixes that by using properly big buffer for
receiving data from socket on native side.

Test: connect with device with MPS bigger than MPS, alternatively set
L2CAP_MAX_SDU_LENGTH to i.e. 30 on device during test and try to write
"remote MPS" of bytes to remote device.
Bug: 68359837
Change-Id: I02bef80f0dd0f0d6850704ac7787c5f3f5b9b3ab
/system/bt/btif/src/btif_sock_l2cap.cc
a32cfc94062df66234894360dca39878c0735761 05-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Revert "Use vector instead of raw pointer in l2cap socket write handling"

This reverts commit 4da2ff53e694c5bee2973c55bb14eb40f74a9d3d.

Change-Id: Id8a399ec6f7474b92579c4647899e424feeb0d33
/system/bt/btif/src/btif_sock_l2cap.cc
4da2ff53e694c5bee2973c55bb14eb40f74a9d3d 31-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Use vector instead of raw pointer in l2cap socket write handling

Currently, when we receive data from upper layers for LE CoC socket,
we store it in memory and pass a raw pointer around, keeping memory
until the write is acknowledged by controller and event is sent back to
btif layer in on_l2cap_write*_done. If anything goes wrong, we might
loose the pointer to the data and have a memory leak.

From now on, we store the data in std::vector and pass its ownership
down the stack. The moment the data is copied into lower layer buffer,
vector is automatically freed. We no longer pass the data back to
on_l2cap_write*_done callback.

Bug: 68359837
Test: compilation test
Change-Id: If34c0fba8d4a040a242b8c655491b8967a03b96a
/system/bt/btif/src/btif_sock_l2cap.cc
8ba543299b3f0d3320a91103af8e57094ae4321c 30-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Assert on null callback in BTA_JvL2capConnect and BTA_JvL2capConnectLE

Passing null as callback should never happen in any scenario.

Bug: 68359837
Test: compilation test
Change-Id: I29702219183eae9d1782438f99d01534fbe44d73
/system/bt/btif/src/btif_sock_l2cap.cc
5b790feeeb211c42bf78ca3ae9c26aa30e516765 18-Sep-2017 Jakub Pawlowski <jpawlowski@google.com> Make copyright headers consistent with Google template; remove "(C)"

Test: Comment changes only; still compiles...
Change-Id: Id699a8170112f06e4a2c9f2e0f0834d1817ace4e
/system/bt/btif/src/btif_sock_l2cap.cc
b749ebde2c6a55569e4e480abda3a4ee3afe2d72 07-Oct-2017 Myles Watson <mylesgw@google.com> Use unary operator instead of == bool

Automatically generated with coccinelle:

@@
expression e1;
@@

-e1 == false
+!e1

@@
expression e1;
@@

-false == e1
+!e1

@@
expression e1;
@@

-e1 == true
+e1

@@
expression e1;
@@

-true == e1
+e1

Test: build
Change-Id: Ic7df0dc43b550594855e457466b6bccd8f3443a3
/system/bt/btif/src/btif_sock_l2cap.cc
a484a888196ddf8bcbf1ad3226d6451bc735a94b 25-Jun-2017 Jakub Pawlowski <jpawlowski@google.com> Rename bt_bdaddr_t into RawAddress (3/3)

Test: compilation test
Change-Id: I4571721a0c6165a66450ee157a53d8d15bfc45d0
/system/bt/btif/src/btif_sock_l2cap.cc
a09c3482007047e852a40b67b86882e96ebede51 16-Jun-2017 Jakub Pawlowski <jpawlowski@google.com> Replace BD_ADDR with bt_bdaddr_t in JV related code

Test: compilation test
Change-Id: Ie0cf491506ebb898ba968586048d2b58248ba112
/system/bt/btif/src/btif_sock_l2cap.cc
c338fe868cc78fca87d3827b568b0a997f575642 01-Feb-2017 Marie Janssen <jamuraa@google.com> btif: remove logspam at higher debug levels

Some CHECK macros had logs that printed the function name, which
duplicated the logs in the functions outside the checks, producing too
many logs.

Remove some unused macros.

Changes:
02-01 09:34:11.757 1259 1755 D bt_btif : get_folder_items_list_rsp
02-01 09:34:11.757 1259 1755 D bt_btif : get_folder_items_list_rsp: item_cnt: 0 len: 0
to
02-01 09:34:11.757 1259 1755 D bt_btif : get_folder_items_list_rsp: item_cnt: 0 len: 0

and similar.

Test: run logcat, check that we have less duplicated logs
Change-Id: Id6e57f38b34d176ed8be0c3baedfbcf55e61a9a4
/system/bt/btif/src/btif_sock_l2cap.cc
911d1ae03efec2d54c3b1b605589d790d1745488 29-Nov-2016 Myles Watson <mylesgw@google.com> Apply clang-format to the rest of the tree

find * | grep "\.[ch]" | xargs clang-format --style=file -i

Test: mma -j32
Change-Id: I6fcc9862bb7bc07c2a367ca58fef2b3cd27a6f05
/system/bt/btif/src/btif_sock_l2cap.cc
531fe1a8c1ca7edfdaf11bbbf3bd63d51bde9b33 22-Nov-2016 Ajay Panicker <apanicke@google.com> Remove more usages of UINT_TO_PTR macro

Bug: 32995283
Test: Sanity tests with a carkit and a headset
Change-Id: Ie74ece4814499f771eb1f229558de7df5c726180
/system/bt/btif/src/btif_sock_l2cap.cc
58d57a46cbe38e0ab70d4f2333dd381ff89342b0 21-Nov-2016 Ajay Panicker <apanicke@google.com> Remove some usages of UINT_TO_PTR macro

Bug: 32995283
Test: Sanity test with various devices
Change-Id: I20a0b1571c044170ba5a8792d8e990a6790cbce2
/system/bt/btif/src/btif_sock_l2cap.cc
135db4f34477342b53242abfe9beec0262854389 11-Nov-2016 Ajay Panicker <apanicke@google.com> Remove pointer to integer cast in btif_sock_l2cap to prevent crash on 64 bit systems

Bug: 24400656
Test: Previously crashed Bluetooth, does not crash after patch
Change-Id: Ia381abca72e46d369a0de1749e42d1b6273a321a
/system/bt/btif/src/btif_sock_l2cap.cc
40cde56d28ab9751ba76bded0b7ac5974c750a97 21-Oct-2016 Myles Watson <mylesgw@google.com> btif: Add do-while blocks to macros

Test: mma -j32
Change-Id: Ie82465b8cef6c4f527fad13892abb365e15dad7c
/system/bt/btif/src/btif_sock_l2cap.cc
c0807c571d8a8f82d0200d6adc67de3db4c6e85f 21-Oct-2016 Myles Watson <mylesgw@google.com> btif: Fix formatting in comments

Test: mma -j32
Change-Id: I851e21d9f2935ab2afbf5e063f6df31e8d50c305
/system/bt/btif/src/btif_sock_l2cap.cc
f45481678af0694902b5200ba69ced4cb61d73f0 19-Oct-2016 Myles Watson <mylesgw@google.com> btif: Fixup clang-format

In src/btif_sock_l2cap.cc:
Move a comment before the define and run clang-format again.

Fix formatting in comments that were more than 80-characters wide.

Test: mma -j32
Change-Id: I17465a1425d1de9a28f0675fe65c8529359a87af
/system/bt/btif/src/btif_sock_l2cap.cc
6bd442f543972b072ef2cbbcf2f7c91202de1045 19-Oct-2016 Myles Watson <mylesgw@google.com> btif: Apply clang-format

clang-format doesn't understand block quotes of this form:

/* This is not handled well
** because there are two asterisks
**/

cd btif/

# Replace '**' at the beginning of the line with ' *'

sed 's/^[*][*]/ \*/' -i include/* src/* test/* co/*
clang-format --style=file -i src/* include/* test/* co/*

Test: mma -j32
Change-Id: I2477eae5480602d5b2fee5ec89c9ed7888022341
/system/bt/btif/src/btif_sock_l2cap.cc
7d59e4fae3390e6a99c70afc1604519d559f08b0 07-Apr-2016 Srinu Jella <sjella@codeaurora.org> Cleanup L2CAP socket properly on close

Use case:
1. Sometimes pairing pop up occurs during Android beam
transfer though it is not required.
2. No OPP Tx request over OBEX if we cancel during file transfer.

Steps:
1. Pair and connect from DUT to remote.
2. Go to gallery and send a file.
3. Accept same file and stop it from remote during transfer.
4. Repeat step 2-4 10 times.

Failure:
OPP Tx should not fail.

Root cause:
Close request was not properly handled from BTIF layer.

Fix:
1. Close the request properly from BTIF layer
to close the socket variables and instruct the BTA layer
close from there as well.

2. Clean up L2CAP socket properly on closure to free
the entry registered with security manager to avoid
leak in security manager records.

3. Close the socket for all valid handles including handle 0.

Change-Id: I4e37dcd858af258fbd64fbfb2fbf0083bd743e06
/system/bt/btif/src/btif_sock_l2cap.cc
a5764686f719d8d779d8a5ff8cc64010b7893e36 10-Oct-2016 Marie Janssen <jamuraa@google.com> btif: migrate from pthread locks to std::mutex

Test: run unit tests / sanity connection to devices
Change-Id: I293c3600affd229fea67cdd6624eba7f186cbcb7
/system/bt/btif/src/btif_sock_l2cap.cc
984e31a7bd4e50f12a1fb930eb1641c7ecdd837e 10-Oct-2016 Joseph Pirozzo <pirozzoj@google.com> L2CAP: Ensure handle is not null before attempting to close a socket

Bug: 32054308
Test: manual, UPF 55
Change-Id: Ib89f7557fa390d60691afe8399a768e8127e52cb
(cherry picked from commit a1fa1bb0d638d5f444bf959fb839e824d69de31d)
/system/bt/btif/src/btif_sock_l2cap.cc
78e1e09bbdfae2fb5870ff8c982dec3f5cfed763 03-Feb-2016 Gurpreet Ghai <gghai@codeaurora.org> Add null check to avoid exception after L2CAP psm assigned

Use case: BT will get crash in SNS testing.

steps: SNS testing BT ON/OFF.

Failure: Crash is observed.

Root Cause: If the number of supported services increased,
larger service record array is required. Smaller array is
resulting in out of record error causing L2CAP deregister.

Fix: Check added to avoid null pointer exception if null
is returned while fetching sock from id. Also cleanup of
SDP and security records done during BT turning Off.

Change-Id: I2e77127262119cabf2c372f894427dcdf3350e80
/system/bt/btif/src/btif_sock_l2cap.cc
b7f64bc45dec7f7fec74ceb04874f322b9434bbf 22-Jun-2016 Marie Janssen <jamuraa@google.com> btif: standardize types, #ifs

Use standard types everywhere.
Use standard style for #if statements:
- #if (VAR_NAME == TRUE)
- #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__

Change-Id: Ic29d1d0b32c3ca9953752a4e5da6c28f45ec8895
/system/bt/btif/src/btif_sock_l2cap.cc
d6121a37c579731b89348e618a823c53b938449a 12-May-2016 Pavlin Radoslavov <pavlin@google.com> Restart failed system calls interrupted with errno of EINTR

In number of places we don't handle properly system calls failures
when the errno is EINTR (i.e., the system call was interrupted
by a signal). In all our use cases, the system calls should be
restarted. The handling of the following system calls (as used in the code)
has been updated/fixed:

poll, send, recv, sendmsg, nanosleep, epoll_wait
read - mostly (e.g., socket-like fds)
write - mostly (e.g., socket-like fds)
select, accept, connect

Bug: 28471477
Bug: 28658141
Change-Id: I03e6f0f67e33876780fb6d02c33eb84547ba8f95
/system/bt/btif/src/btif_sock_l2cap.cc
713993d1784ab7c23aee1fa3cf1ab8676cc0aa69 21-Apr-2016 Jakub Pawlowski <jpawlowski@google.com> Convert BTIF code from C to C++

Modifications required:
* added proper casting
* moved variable definitions before goto statements
* added 'extern "C"' markers where needed
* renamed 'operator' to 'operator_name'

Bug: 28485365
Change-Id: I903357967387207e678866c02e008f047f8263f6
/system/bt/btif/src/btif_sock_l2cap.cc