OSDN Git Service

android-x86/system-bt.git
4 years agoAdd Api stack/acl/btm_acl::acl_disconnect
Chris Manton [Sun, 23 Aug 2020 20:47:11 +0000 (13:47 -0700)]
Add Api stack/acl/btm_acl::acl_disconnect

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I69ee9674a65a1b9b67235b0ca8eea3dc3bcc21a0

4 years agoRe-include stack/btm/btm_dev.h
Chris Manton [Sat, 22 Aug 2020 19:33:58 +0000 (12:33 -0700)]
Re-include stack/btm/btm_dev.h

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I2228f2ab4d938ef3c94db34bfa2d508654a33826

4 years agoRemove def BLE_PRIVACY_SPT
Chris Manton [Sat, 22 Aug 2020 23:30:34 +0000 (16:30 -0700)]
Remove def BLE_PRIVACY_SPT

Always TRUE; untested and unsupported when false

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I88e5466db12dfafbe9ed4ef66459b0c9da7f4fc1

4 years agoRemove def BTM_DISC_DURING_RS
Chris Manton [Sat, 22 Aug 2020 23:23:40 +0000 (16:23 -0700)]
Remove def BTM_DISC_DURING_RS

Always TRUE; untested and unsupported when false

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I9873649ca7fc52d2081e4d0c8a505c5794fd5b91

4 years agoRemove tL2C_CB::tL2C_LCB::p_hcit_rcv_acl
Chris Manton [Sun, 23 Aug 2020 18:55:19 +0000 (11:55 -0700)]
Remove tL2C_CB::tL2C_LCB::p_hcit_rcv_acl

Never allocated, but always freed buffer

Luckily it's always null

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0a5a6ea2178b1478b9a992028f5f181ed5344367

4 years agoProperly process the LE Long Term Key Request
Jakub Pawlowski [Fri, 21 Aug 2020 15:39:11 +0000 (17:39 +0200)]
Properly process the LE Long Term Key Request

Stack in peripheral should properly accept and pass the LTK request.

Bug: 155399771
Test: cert/run --host LeSecurityTest
Tag: #gd-refactor
Change-Id: I7fcce47310480a435386975756900734239e4203

4 years agoRootCanal: Request Le LongTermKey
Myles Watson [Fri, 21 Aug 2020 16:06:45 +0000 (09:06 -0700)]
RootCanal: Request Le LongTermKey

Use OwnAddressType for scanning and connections.

Make Random (for LE security) be an 8-byte array.

Bug: 155399771
Test: cert/run --host LeSecurityTest
Tag: #gd-refactor
Change-Id: I5d6044769dfdeb51dd247ce69ee3b5e357b70497

4 years agoEliminate useless stack vars l2c_link_send_to_lower_
Chris Manton [Sun, 23 Aug 2020 01:29:55 +0000 (18:29 -0700)]
Eliminate useless stack vars l2c_link_send_to_lower_

xmit_window
acl_data_size

Towards readability

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I649b9d0fbcf16cacdbfac74cac0a414e50109202

4 years agoUse acl data passing API
Chris Manton [Sat, 22 Aug 2020 16:30:34 +0000 (09:30 -0700)]
Use acl data passing API

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0a31c891be3b1042d90fc17c3662d4e69b530648

4 years agoadd acl data passing API
Chris Manton [Sat, 22 Aug 2020 15:46:16 +0000 (08:46 -0700)]
add acl data passing API

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: I48d067c679715e2fc6987347b92b8177fca9d512

4 years agoSmooth l2c_link_send_to_lower/br_edr and ble
Chris Manton [Sat, 22 Aug 2020 15:41:54 +0000 (08:41 -0700)]
Smooth l2c_link_send_to_lower/br_edr and ble

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ia464ddf48f403d542f361b872c7c8a68c5de50af

4 years agoStreamline l2c_link_send_to_lower/br_edr and ble
Chris Manton [Sat, 22 Aug 2020 15:38:07 +0000 (08:38 -0700)]
Streamline l2c_link_send_to_lower/br_edr and ble

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: I075af46d4f194fe44c5389b1ab5aa8341a3356ef

4 years agoBreak out l2c_link_send_to_lower into br_edr and ble
Chris Manton [Sat, 22 Aug 2020 15:31:48 +0000 (08:31 -0700)]
Break out l2c_link_send_to_lower into br_edr and ble

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ia8c833a0ab806429743bd974d595cc102b738c5c

4 years agoAdd const stack/l2cap/l2c_link::l2c_link_send_to_lower
Chris Manton [Sat, 22 Aug 2020 15:26:49 +0000 (08:26 -0700)]
Add const stack/l2cap/l2c_link::l2c_link_send_to_lower

Pull out fit-in-buffer conditions

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: I861f7dc5eef2ee032a8e08c681ee5f18c7b5d277

4 years agoRemove def L2CAP_HCI_FLOW_CONTROL_DEBUG
Chris Manton [Fri, 21 Aug 2020 22:35:08 +0000 (15:35 -0700)]
Remove def L2CAP_HCI_FLOW_CONTROL_DEBUG

Towards readability

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I43cc934c5b0aabf5c1d05bf906277af3b52db5d0

4 years agoBreak out data passing events
Chris Manton [Fri, 21 Aug 2020 22:23:58 +0000 (15:23 -0700)]
Break out data passing events

Towards readability

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I2fe1987d46c660d7c9407a896c25961649533b6b

4 years agoRe-order conditional stack/l2cap/l2c_link::l2c_link_send_to_lower
Chris Manton [Fri, 21 Aug 2020 20:49:26 +0000 (13:49 -0700)]
Re-order conditional stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards readability

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I5f893d86c383c871051aa550d75f17ead8143585

4 years agoGroup controller acccess stack/l2cap/l2c_link::l2c_link_send_to_lower
Chris Manton [Fri, 21 Aug 2020 17:17:44 +0000 (10:17 -0700)]
Group controller acccess stack/l2cap/l2c_link::l2c_link_send_to_lower

Also add transport and link_xmit_quota

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Idcb98de26e07174dbe1732ce048cf96cefaa60c5

4 years agoColocate dec/def stack/l2cap/l2c_link::l2c_link_send_to_lower
Chris Manton [Fri, 21 Aug 2020 17:08:52 +0000 (10:08 -0700)]
Colocate dec/def stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I63693185bf9450ef94de4863d90bda1ef6315ee8

4 years agoMerge "GD-Cert: Override parameters during cert test"
Treehugger Robot [Sat, 22 Aug 2020 01:35:39 +0000 (01:35 +0000)]
Merge "GD-Cert: Override parameters during cert test"

4 years agoGD-Cert: Override parameters during cert test
Jack He [Fri, 21 Aug 2020 23:46:19 +0000 (16:46 -0700)]
GD-Cert: Override parameters during cert test

* Allow overriding system properties and paramters
  at runtime
* Override them into right values during cert testing to
  allow output collection

Bug: 165828962
Test: gd/cert/run --host
Tag: #gd-refactor
Change-Id: I1ebc8058cdb57eaa5442278f535e3750eec9dbad

4 years agoRefactor: Fix BT device name length issue
xiaoshun.xu [Tue, 18 Aug 2020 17:57:09 +0000 (01:57 +0800)]
Refactor: Fix BT device name length issue

BT device name only show 247bytes on settings, it supposed to show
248bytes if local device and remote device have 248bytes' name.
Increasing the argument passed to function strlcpy&memcpy bt 1
will resolve the issue.

Tag: #refactor
Bug: 162480697
Sponsor: mylesgw
Test: cert/run --host
Change-Id: Ib3fa7d78e39f0a9330658f9ce2b4a67003d7114d

4 years agoMerge changes Iddb20c40,Iddc3cd02
Treehugger Robot [Fri, 21 Aug 2020 22:06:38 +0000 (22:06 +0000)]
Merge changes Iddb20c40,Iddc3cd02

* changes:
  GD-HCI: Send original command instead of status packet upwards
  BTM-PM: Get rid of BTM_PM_DEBUG flag

4 years agoGD-HCI: Send original command instead of status packet upwards
Jack He [Fri, 21 Aug 2020 20:29:20 +0000 (13:29 -0700)]
GD-HCI: Send original command instead of status packet upwards

* Legacy stack expects original command when command status is available
* Add verbose logging for command complete and command status
* Wrap pending command in OsiObject so that it can be auto-freed by
  C++ unique_ptr

Bug: 165181021
Test: make, flash, test A2DP and HFP
Tag: #gd-refactor
Change-Id: Iddb20c405dc2f0326de53d3531464cbba65d6076

4 years agoBTM-PM: Get rid of BTM_PM_DEBUG flag
Jack He [Fri, 21 Aug 2020 06:18:18 +0000 (23:18 -0700)]
BTM-PM: Get rid of BTM_PM_DEBUG flag

* Instead of using a build time flag, use a LOG_VERBOSE
  to control the verbosity of BTM power manager logs
* Add more logging on error paths

Bug: 165181021
Test: make
Tag: #refactor
Change-Id: Iddc3cd025c2078ade4d7dd9d608a8e64b0987034

4 years agoMerge "InternalEnforceSecurityPolicy: Check if record is temporary"
Treehugger Robot [Fri, 21 Aug 2020 19:58:22 +0000 (19:58 +0000)]
Merge "InternalEnforceSecurityPolicy: Check if record is temporary"

4 years agoMerge changes I7eb89883,I93295962,I3ffe28ef,Ice072495,Iba166d9a, ...
Treehugger Robot [Fri, 21 Aug 2020 19:33:10 +0000 (19:33 +0000)]
Merge changes I7eb89883,I93295962,I3ffe28ef,Ice072495,Iba166d9a, ...

* changes:
  Simplify stack/l2cap/l2c_utils::l2cu_create_conn_br_edr
  Simplify stack/l2cap/l2c_link::l2c_link_role_changed
  Remove poor placement for SCN from tACL_CB
  add stack/btm/btm_scn
  Add tBTM_CB::btm_scn[BTM_MAX_SCN_]
  Simplify stack/l2cap/l2c_utils::l2cu_adj_id
  Precisely name tL2C_CB::tL2C_LCB::id
  Remove tL2C_CB::tL2C_LCB::info_rx_bits
  Encapsulate tL2C_CB::tL2C_LCB::link_flush_tout_
  Precisely name tL2C_CB::num_used_lcbs
  Encapsulate tL2C_CB::tL2C_LCB::disc_reason
  Remove set-once-never-execute l2cb.is_flush_active

4 years agoInternalEnforceSecurityPolicy: Check if record is temporary
Hansong Zhang [Wed, 19 Aug 2020 23:41:21 +0000 (16:41 -0700)]
InternalEnforceSecurityPolicy: Check if record is temporary

If we want AUTHENTICATED_ENCRYPTED_TRANSPORT, temporary link key is not
sufficient.  Pair again.

Test: cert/run --host
Tag: #gd-refactor
Bug: 141555841
Change-Id: I9a5b4b08fdd22d6c453443f6315b3f136913b516

4 years agoMerge "Clear advertising cache if bad advertisement is received"
Treehugger Robot [Fri, 21 Aug 2020 18:14:10 +0000 (18:14 +0000)]
Merge "Clear advertising cache if bad advertisement is received"

4 years agoClear advertising cache if bad advertisement is received
Henrik Davidsen [Thu, 20 Aug 2020 11:23:01 +0000 (12:23 +0100)]
Clear advertising cache if bad advertisement is received

Cache of advertisements from a device was not cleared if a bad
extended advertisement was received which caused that new
advertisements from same device address was rejected as invalid.

Tag: #stability
Test: receive malformed advertisement
Signed-off-by: Henrik Davidsen <h.davidsen@samsung.com>
Change-Id: If07010954fef235b696c8a120026934a7aeadcb5

4 years agoMerge "GD Security: Improve Enforce() workflow"
Treehugger Robot [Fri, 21 Aug 2020 17:15:26 +0000 (17:15 +0000)]
Merge "GD Security: Improve Enforce() workflow"

4 years agoSimplify stack/l2cap/l2c_utils::l2cu_create_conn_br_edr
Chris Manton [Tue, 18 Aug 2020 03:50:27 +0000 (20:50 -0700)]
Simplify stack/l2cap/l2c_utils::l2cu_create_conn_br_edr

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I7eb89883f5289bc89692e26c6f290f42f609009c

4 years agoSimplify stack/l2cap/l2c_link::l2c_link_role_changed
Chris Manton [Tue, 18 Aug 2020 04:38:01 +0000 (21:38 -0700)]
Simplify stack/l2cap/l2c_link::l2c_link_role_changed

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I93295962cedb99ce46fb23489649eec445fc540a

4 years agoRemove poor placement for SCN from tACL_CB
Chris Manton [Tue, 18 Aug 2020 23:06:34 +0000 (16:06 -0700)]
Remove poor placement for SCN from tACL_CB

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3ffe28efe945cfc8a9abc3c96d790827625b0281

4 years agoadd stack/btm/btm_scn
Chris Manton [Tue, 18 Aug 2020 22:57:04 +0000 (15:57 -0700)]
add stack/btm/btm_scn

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ice072495e981d02bfc5cbd6dce18436165b28f0d

4 years agoAdd tBTM_CB::btm_scn[BTM_MAX_SCN_]
Chris Manton [Tue, 18 Aug 2020 22:42:53 +0000 (15:42 -0700)]
Add tBTM_CB::btm_scn[BTM_MAX_SCN_]

To be moved out of tACL_CB

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Iba166d9a8576f910a8406864a5d5d0e9faffce72

4 years agoSimplify stack/l2cap/l2c_utils::l2cu_adj_id
Chris Manton [Fri, 21 Aug 2020 15:42:35 +0000 (08:42 -0700)]
Simplify stack/l2cap/l2c_utils::l2cu_adj_id

The first term in the condition is always true

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ib96d78cbaef78450eee30b1aa8291506d4161c5c

4 years agoPrecisely name tL2C_CB::tL2C_LCB::id
Chris Manton [Fri, 21 Aug 2020 15:38:58 +0000 (08:38 -0700)]
Precisely name tL2C_CB::tL2C_LCB::id

Signalling id

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0233757a9a74479f8b5d6b34c558a257b70977bd

4 years agoRemove tL2C_CB::tL2C_LCB::info_rx_bits
Chris Manton [Fri, 21 Aug 2020 15:17:21 +0000 (08:17 -0700)]
Remove tL2C_CB::tL2C_LCB::info_rx_bits

Write once; read never

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I53690a990985b7aaeb7570326f9726cb644a66e0

4 years agoEncapsulate tL2C_CB::tL2C_LCB::link_flush_tout_
Chris Manton [Fri, 21 Aug 2020 15:09:43 +0000 (08:09 -0700)]
Encapsulate tL2C_CB::tL2C_LCB::link_flush_tout_

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ic8d6f5712129031bd16510d7ba745ae19afbce77

4 years agoPrecisely name tL2C_CB::num_used_lcbs
Chris Manton [Fri, 21 Aug 2020 04:56:23 +0000 (21:56 -0700)]
Precisely name tL2C_CB::num_used_lcbs

From: tL2C_CB::tL2C_LCB::num_links_active

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I053469981e035493bc37de98fb44123622618859

4 years agoEncapsulate tL2C_CB::tL2C_LCB::disc_reason
Chris Manton [Fri, 21 Aug 2020 04:29:48 +0000 (21:29 -0700)]
Encapsulate tL2C_CB::tL2C_LCB::disc_reason

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I475eb9127e50dc58b7a0bc8f6f269db9ab63a94a

4 years agoRemove set-once-never-execute l2cb.is_flush_active
Chris Manton [Fri, 21 Aug 2020 04:46:54 +0000 (21:46 -0700)]
Remove set-once-never-execute l2cb.is_flush_active

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I8a5d32e2d190fd11bba2f8b70020730681ca881f

4 years agoFix address passing when we accept incoming connection
Jakub Pawlowski [Fri, 24 Jul 2020 10:58:56 +0000 (12:58 +0200)]
Fix address passing when we accept incoming connection

Tag: #gd-refactor
Bug: 155399771
Test: gd/cert/run --host LeSecurityTest
Change-Id: I21ceb49fe1b69e447e3d2e282db5d02b7a0c1bfe

4 years agoGD Security: Improve Enforce() workflow
Hansong Zhang [Wed, 19 Aug 2020 21:52:53 +0000 (14:52 -0700)]
GD Security: Improve Enforce() workflow

InternalEnforceSecurityPolicy establishes the requirement
- ENCRYPTED_TRANSPORT: If paired but not encrypted, just wait for
  encryption change; if unpaired, pair with NO_BOND_NO_MITM
- AUTHENTICATED_ENCRYPTED_TRANSPORT: Similar as above, but we need to
  pair again if existing LK is not authenticated. Exception: If no MITM
  is needed during pairing, we assume authenticated LK is not possible,
  so we allow connection. In the future, use IO cap to check.

When link is encrypted, or new pairing is complete, we invoke
UpdateLinkSecurityCondition.

Test: cert/run --host
Test: CtsVerifier Insecure RFCOMM client
Tag: #gd-refactor
Bug: 141555841
Change-Id: Ic5792c8e967cd068e08df4702393ae3188c6d4e8

4 years agoMerge "AclManager: Handle default data length"
Treehugger Robot [Thu, 20 Aug 2020 22:20:44 +0000 (22:20 +0000)]
Merge "AclManager: Handle default data length"

4 years agoMerge "Remove unused API"
Treehugger Robot [Thu, 20 Aug 2020 22:18:42 +0000 (22:18 +0000)]
Merge "Remove unused API"

4 years agoMerge changes I4b15d054,Id53d86f3,Icc604d09,Ib19ee20d,I550d96d1, ...
Treehugger Robot [Thu, 20 Aug 2020 21:08:21 +0000 (21:08 +0000)]
Merge changes I4b15d054,Id53d86f3,Icc604d09,Ib19ee20d,I550d96d1, ...

* changes:
  Unify def tBTM_SEC_CBACK=>tBTM_SEC_CALLBACK
  Simplify stack/acl/btm_acl::btm_acl_created()
  Removed unused tACL_CONN fields
  Use API stack/acl/btm_acl
  Add APIs to stack/acl/btm_acl
  Use API stack/acl/btm_acl::btm_acl_connection_request
  Add API stack/acl/btm_acl::btm_acl_connection_request
  Wrap tL2C_LCB::link_role in API
  Rename btm_dev_support_switch
  Streamline stack/btm/btm_dev::btm_dev_support_switch
  Replace BTM_ACL_PKT_TYPES_MASK_

4 years agoRemove unused API
Hansong Zhang [Thu, 20 Aug 2020 18:31:07 +0000 (11:31 -0700)]
Remove unused API

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6805be8b23b3ab284a1e6437387365d9b04cde50

4 years agoMerge changes I1aa0ab27,Ice003a60
Jakub Pawlowski [Thu, 20 Aug 2020 20:16:20 +0000 (20:16 +0000)]
Merge changes I1aa0ab27,Ice003a60

* changes:
  hci: Add Broadcast Isochronous Sets related commands
  hci: Add additional iso related commands

4 years agoUnify def tBTM_SEC_CBACK=>tBTM_SEC_CALLBACK
Chris Manton [Thu, 20 Aug 2020 17:39:23 +0000 (10:39 -0700)]
Unify def tBTM_SEC_CBACK=>tBTM_SEC_CALLBACK

The names were aliases to each other

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4b15d054adc53b0e13f916fc08dcaf17c91d6008

4 years agoSimplify stack/acl/btm_acl::btm_acl_created()
Chris Manton [Tue, 18 Aug 2020 17:34:35 +0000 (10:34 -0700)]
Simplify stack/acl/btm_acl::btm_acl_created()

Remove copy once/read never fields:
DEV_CLASS
BD_NAME

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Id53d86f370777cc999c4a060aa99a87edd2eb08c

4 years agoRemoved unused tACL_CONN fields
Chris Manton [Tue, 18 Aug 2020 17:25:30 +0000 (10:25 -0700)]
Removed unused tACL_CONN fields

tACL_CONN::BD_NAME
tACL_CONN::DEV_CLASS

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Icc604d09c9ca5e5ca30d6af622214f2580437f3a

4 years agoUse API stack/acl/btm_acl
Chris Manton [Thu, 20 Aug 2020 16:54:12 +0000 (09:54 -0700)]
Use API stack/acl/btm_acl

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ib19ee20ddf598ba0bf1d74a12a5686d7558f2fce

4 years agoAdd APIs to stack/acl/btm_acl
Chris Manton [Thu, 20 Aug 2020 16:35:52 +0000 (09:35 -0700)]
Add APIs to stack/acl/btm_acl

acl_accept_connection_request
acl_reject_connection_request

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I550d96d1dc04b5576996db919def6580c9a947d1

4 years agoUse API stack/acl/btm_acl::btm_acl_connection_request
Chris Manton [Thu, 20 Aug 2020 16:17:37 +0000 (09:17 -0700)]
Use API stack/acl/btm_acl::btm_acl_connection_request

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ie02b35f15f6e773b6f6a793c33b675f2208865fe

4 years agoAdd API stack/acl/btm_acl::btm_acl_connection_request
Chris Manton [Thu, 20 Aug 2020 15:59:29 +0000 (08:59 -0700)]
Add API stack/acl/btm_acl::btm_acl_connection_request

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Iaa2bc3870b87b1394ed7363afa0827b93a9bb2ca

4 years agoWrap tL2C_LCB::link_role in API
Chris Manton [Thu, 20 Aug 2020 15:48:32 +0000 (08:48 -0700)]
Wrap tL2C_LCB::link_role in API

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4a10763a8107f0a9dbc0ddf62d0671fe9b41a63f

4 years agoRename btm_dev_support_switch
Chris Manton [Mon, 17 Aug 2020 22:00:19 +0000 (15:00 -0700)]
Rename btm_dev_support_switch

=>btm_dev_support_role_switch

Streamline stack/btm/btm_dev::btm_dev_support_switch

Bug: 162984360
Tag: #refactor
Test: compiles and devices pair and work
Change-Id: I529006c587b67c6545656febc5a5f2b1daabe186

4 years agoStreamline stack/btm/btm_dev::btm_dev_support_switch
Chris Manton [Mon, 17 Aug 2020 21:32:08 +0000 (14:32 -0700)]
Streamline stack/btm/btm_dev::btm_dev_support_switch

Bug: 162984360
Tag: #refactor
Test: compiles and devices pair and work

Change-Id: I838a258471b484c29dc3828e1c940065451a10b0

4 years agoReplace BTM_ACL_PKT_TYPES_MASK_
Chris Manton [Sun, 16 Aug 2020 18:27:01 +0000 (11:27 -0700)]
Replace BTM_ACL_PKT_TYPES_MASK_

BTM_ACL_PKT_TYPES_MASK_DM1=>HCI_PKT_TYPES_MASK_DM1
BTM_ACL_PKT_TYPES_MASK_DH1=>HCI_PKT_TYPES_MASK_DH1
BTM_ACL_PKT_TYPES_MASK_DM3=>HCI_PKT_TYPES_MASK_DM3
BTM_ACL_PKT_TYPES_MASK_DH3=>HCI_PKT_TYPES_MASK_DH3
BTM_ACL_PKT_TYPES_MASK_DM5=>HCI_PKT_TYPES_MASK_DM5
BTM_ACL_PKT_TYPES_MASK_DH5=>HCI_PKT_TYPES_MASK_DH5
BTM_ACL_PKT_TYPES_MASK_NO_2_DH1=>HCI_PKT_TYPES_MASK_NO_2_DH1
BTM_ACL_PKT_TYPES_MASK_NO_3_DH1=>HCI_PKT_TYPES_MASK_NO_3_DH1
BTM_ACL_PKT_TYPES_MASK_NO_2_DH3=>HCI_PKT_TYPES_MASK_NO_2_DH3
BTM_ACL_PKT_TYPES_MASK_NO_3_DH3=>HCI_PKT_TYPES_MASK_NO_3_DH3
BTM_ACL_PKT_TYPES_MASK_NO_2_DH5=>HCI_PKT_TYPES_MASK_NO_2_DH5
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5=>HCI_PKT_TYPES_MASK_NO_3_DH5

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6c1420266afdb584612cf96cbfae32d437a83a90

4 years agoMerge changes Icedbc393,I396b7959
Treehugger Robot [Thu, 20 Aug 2020 18:19:52 +0000 (18:19 +0000)]
Merge changes Icedbc393,I396b7959

* changes:
  Check for MITM required.
  Fall back to local AuthenticationRequirements to set values

4 years agoAclManager: Handle default data length
Myles Watson [Wed, 19 Aug 2020 06:26:22 +0000 (23:26 -0700)]
AclManager: Handle default data length

Bug: 145832107
Test: cert/run --host
Tag: #gd-refactor
Change-Id: I851f22db86687801232621e738deeecf2df51834

4 years agop_auth_complete_callback is no-op for HCI_SUCCESS case
Hansong Zhang [Thu, 20 Aug 2020 07:56:47 +0000 (00:56 -0700)]
p_auth_complete_callback is no-op for HCI_SUCCESS case

Remove.

Test: cert/run --host
Tag: #gd-refactor
Bug: 141555841
Change-Id: Id1e511b2358c8695da721ce6750a8a6eddd1dac4

4 years agoMerge "Ensure IO Cap Response received before processing UserConfirmationRequest"
Treehugger Robot [Thu, 20 Aug 2020 17:09:36 +0000 (17:09 +0000)]
Merge "Ensure IO Cap Response received before processing UserConfirmationRequest"

4 years agoMerge changes I83637165,I4af96edd,I8e0ef282,I6bd6f659,I25e6810c, ...
Treehugger Robot [Thu, 20 Aug 2020 16:40:08 +0000 (16:40 +0000)]
Merge changes I83637165,I4af96edd,I8e0ef282,I6bd6f659,I25e6810c, ...

* changes:
  Wrap l2c::IsBonding in API
  Streamline includes stack/l2cap/l2c_link
  Move l2cu_get_next_buffer_to_send
  Move stack/l2cap/::l2cu_get_next_channel_in_rr
  Remove def L2CAP_ROUND_ROBIN_CHANNEL_SERVICE
  Remove def L2CAP_NUM_FIXED_CHNLS Optimization

4 years agohci: Add Broadcast Isochronous Sets related commands
Grzegorz Kołodziejczyk [Tue, 11 Aug 2020 12:59:41 +0000 (14:59 +0200)]
hci: Add Broadcast Isochronous Sets related commands

This is required for audio broadcaster functionality.

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: compilation
Change-Id: I1aa0ab271e188f70eda579f212e6870557cef7e5

4 years agohci: Add additional iso related commands
Grzegorz Kołodziejczyk [Tue, 11 Aug 2020 13:07:19 +0000 (15:07 +0200)]
hci: Add additional iso related commands

These are not necessary for the upcoming le audio implementation
but may become useful in near future.

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: compilation
Change-Id: Ice003a604da44d5430b6b356e6f16d0fcbdf1873

4 years agoWrap l2c::IsBonding in API
Chris Manton [Thu, 20 Aug 2020 06:04:53 +0000 (23:04 -0700)]
Wrap l2c::IsBonding in API

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I8363716501145101ea025bd44aa35fa7f870b2eb

4 years agoStreamline includes stack/l2cap/l2c_link
Chris Manton [Thu, 20 Aug 2020 00:50:06 +0000 (17:50 -0700)]
Streamline includes stack/l2cap/l2c_link

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4af96eddeb1dd30d10b766df1f617b4381a4e2f3

4 years agoMove l2cu_get_next_buffer_to_send
Chris Manton [Thu, 20 Aug 2020 00:23:45 +0000 (17:23 -0700)]
Move l2cu_get_next_buffer_to_send

From: stack/l2cap/l2c_utils
Into: stack/l2cap/l2c_link

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: I8e0ef282d5bae9a0deb0e465b326d7889d67d5e8

4 years agoMove stack/l2cap/::l2cu_get_next_channel_in_rr
Chris Manton [Thu, 20 Aug 2020 00:27:41 +0000 (17:27 -0700)]
Move stack/l2cap/::l2cu_get_next_channel_in_rr

From: stack/l2cap/l2c_utils
Into: stack/l2cap/l2c_link

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6bd6f659d312c893564de7d3c07d429d38da76a8

4 years agoRemove def L2CAP_ROUND_ROBIN_CHANNEL_SERVICE
Chris Manton [Wed, 19 Aug 2020 23:40:24 +0000 (16:40 -0700)]
Remove def L2CAP_ROUND_ROBIN_CHANNEL_SERVICE

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I25e6810c157914ebca1d5d135394f70c4f3ffdaf

4 years agoRemove def L2CAP_NUM_FIXED_CHNLS Optimization
Chris Manton [Wed, 19 Aug 2020 23:10:27 +0000 (16:10 -0700)]
Remove def L2CAP_NUM_FIXED_CHNLS Optimization

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Idbfc3b0dd32cdb6161b38f8436e4b5d3a89b6d0a

4 years agostack/btm: Support Reading Peer SCA
Jakub Tyszkowski [Tue, 18 Aug 2020 11:15:55 +0000 (13:15 +0200)]
stack/btm: Support Reading Peer SCA

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: compilation
Change-Id: Ia65d8aea66850a780909c240291934ea668cb6ea

4 years agoMerge "btm: Initial Iso Manager implementation"
Jakub Pawlowski [Thu, 20 Aug 2020 12:33:38 +0000 (12:33 +0000)]
Merge "btm: Initial Iso Manager implementation"

4 years agoMerge "GD-HCI: Flush snoop log to kernel buffer on every write"
Treehugger Robot [Thu, 20 Aug 2020 11:36:19 +0000 (11:36 +0000)]
Merge "GD-HCI: Flush snoop log to kernel buffer on every write"

4 years agoMerge changes Ic895dce8,I80b661d6,I108d89b0,Ia0963f5e,I63d2703c, ...
Zach Johnson [Thu, 20 Aug 2020 11:34:35 +0000 (11:34 +0000)]
Merge changes Ic895dce8,I80b661d6,I108d89b0,Ia0963f5e,I63d2703c, ...

* changes:
  More security flag hidings
  More security flag hiding
  More security flag hiding
  Flatten BTA_JvIsEncrypted
  Simplify BTA_JvIsEncrypted
  Start hiding security flags
  We don't do AMP
  Remove p_authorize_callback, it's never used
  btm_sec_are_all_trusted is never called
  trusted_mask is self refrential and always 0
  Remove trusted_mask from BTM_SecBond
  Remove trusted mask from BTM_SecAddDevice
  BTM_SEC_IS_SERVICE_TRUSTED is never used
  BTM_SecClrTempAuthService does nothing
  last_author_service_id is never meaningfully set
  Remove BTM_SEC_AUTHORIZED, it's only removed or checked

4 years agobtm: Initial Iso Manager implementation
Jakub Tyszkowski [Thu, 20 Aug 2020 10:58:19 +0000 (10:58 +0000)]
btm: Initial Iso Manager implementation

This adds the ISO Manager used to manage the CIG/CIS and
in future patches also BIG/BIS channels. It defines an API
for the user to call and callback interfaces that the user
has to implement and register in the ISO Manager to use it.

Bug: 150670922
Tag: #feature
Test: atest --host net_test_btm_iso
Sponsor: jpawlowski@
Change-Id: I0f4719b6efb74a7350cf3d6d9263bf855d60ce6f

4 years agoMerge changes Ifad48ac1,Iec6e7550,I68ff2112,Ibb875781,Iae859fcc, ...
Zach Johnson [Thu, 20 Aug 2020 10:20:38 +0000 (10:20 +0000)]
Merge changes Ifad48ac1,Iec6e7550,I68ff2112,Ibb875781,Iae859fcc, ...

* changes:
  BTM_SEC_OUT_FLAGS used to include authorized
  this used to check for authorized
  Remove always false expressions
  This expression is also never true
  This condition is never true
  Simpify boolean expression
  Remove useless redefinition BTM_SEC_FLAG_AUTHORIZED
  BTM_SEC_OUT_AUTHENTICATE is never set, only checked or removed
  BTM_SEC_IN_AUTHORIZE is never set, only checked or removed
  Remove BTA_AV_WITH_AVCTP_AUTHORIZATION
  BTA_SEC_AUTHENTICATE does not include authorization
  Flatten bta_av_cb.sec_mask
  The security mask is always BTA_SEC_AUTHENTICATE
  Internalize BTA_AvEnable's security mask
  Flatten BTA_SEC_AUTHORIZE

4 years agoMerge "Add boolean flag for indicating IO Cap Response received"
Treehugger Robot [Thu, 20 Aug 2020 09:27:23 +0000 (09:27 +0000)]
Merge "Add boolean flag for indicating IO Cap Response received"

4 years agoMerge "Ensure we delete the link key from the controller."
Treehugger Robot [Thu, 20 Aug 2020 08:44:21 +0000 (08:44 +0000)]
Merge "Ensure we delete the link key from the controller."

4 years agoGD-HCI: Flush snoop log to kernel buffer on every write
Jack He [Thu, 20 Aug 2020 08:29:24 +0000 (01:29 -0700)]
GD-HCI: Flush snoop log to kernel buffer on every write

* std::ofstream::flush() pushes user data into kernel memory. The data
  will be written even if this process crashes. However, data will be lost
  if there is a kernel panic, which is out of scope of BT snoop log.
* std::ofstream::write() followed by std::ofstream::flush() has similar
  effect as UNIX write(fd, data, len) as write() syscall dumps data into
  kernel memory directly
* Before this change, btsnoop log data might be partially stored in
  memory when bluetooth stack crashes, causing broken log entries
  or missing packets

Bug: 164973960
Test: make, flash phone, and test pairing
Tag: #gd-refactor
Change-Id: I611e0b9480511b569dadbb023775b0db8159f39d

4 years agoCheck for MITM required.
Martin Brabham [Fri, 14 Aug 2020 21:24:22 +0000 (14:24 -0700)]
Check for MITM required.

Per specification; if MITM is required then AUTO is NOT ALLOWED!

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: Icedbc393ae03610a3b8095c26a5f6ff5dfdec6c2

4 years agoEnsure IO Cap Response received before processing UserConfirmationRequest
Martin Brabham [Thu, 20 Aug 2020 06:03:03 +0000 (23:03 -0700)]
Ensure IO Cap Response received before processing UserConfirmationRequest

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: Iab245ff61b9a747b6a93336f7a75e2f3e4727054

4 years agoFall back to local AuthenticationRequirements to set values
Martin Brabham [Thu, 20 Aug 2020 06:06:18 +0000 (23:06 -0700)]
Fall back to local AuthenticationRequirements to set values

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: I396b79593653279cdfdbcdcb97a0392d0e465bf4

4 years agoMore security flag hidings
Zach Johnson [Thu, 20 Aug 2020 01:34:16 +0000 (18:34 -0700)]
More security flag hidings

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ic895dce8b28a9a1dffca1800580dfd08b2c55941

4 years agoMore security flag hiding
Zach Johnson [Thu, 20 Aug 2020 01:13:55 +0000 (18:13 -0700)]
More security flag hiding

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I80b661d6a6e438368428927e8f1e803b0638696b

4 years agoMore security flag hiding
Zach Johnson [Thu, 20 Aug 2020 01:08:34 +0000 (18:08 -0700)]
More security flag hiding

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I108d89b0c340e5114a129f5af639a8a8fc5e2678

4 years agoFlatten BTA_JvIsEncrypted
Zach Johnson [Thu, 20 Aug 2020 00:56:27 +0000 (17:56 -0700)]
Flatten BTA_JvIsEncrypted

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ia0963f5e1ef783eb48b29e61ac5cbc96d62b5614

4 years agoSimplify BTA_JvIsEncrypted
Zach Johnson [Thu, 20 Aug 2020 00:54:21 +0000 (17:54 -0700)]
Simplify BTA_JvIsEncrypted

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I63d2703c50fdaa67db035ce954b68ff681022d51

4 years agoStart hiding security flags
Zach Johnson [Thu, 20 Aug 2020 00:50:41 +0000 (17:50 -0700)]
Start hiding security flags

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ia88a7e71b4a2b4b8347a6f12a2f6d362232d090d

4 years agoWe don't do AMP
Zach Johnson [Thu, 20 Aug 2020 00:14:58 +0000 (17:14 -0700)]
We don't do AMP

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I87ab869e151465995728bd84ee9fa4b5b068bb4c

4 years agoRemove p_authorize_callback, it's never used
Zach Johnson [Thu, 20 Aug 2020 00:10:35 +0000 (17:10 -0700)]
Remove p_authorize_callback, it's never used

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I781796e16a5170aa69c344e54a6bcdcfc69fb7ee

4 years agobtm_sec_are_all_trusted is never called
Zach Johnson [Wed, 19 Aug 2020 23:16:16 +0000 (16:16 -0700)]
btm_sec_are_all_trusted is never called

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6dfd7e4e16091ac55a4b30a4eb4bf4783a0efba2

4 years agotrusted_mask is self refrential and always 0
Zach Johnson [Wed, 19 Aug 2020 23:08:43 +0000 (16:08 -0700)]
trusted_mask is self refrential and always 0

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4659415431ce835b2c8082a3c0f3fc65bf71cf82

4 years agoRemove trusted_mask from BTM_SecBond
Zach Johnson [Wed, 19 Aug 2020 22:33:32 +0000 (15:33 -0700)]
Remove trusted_mask from BTM_SecBond

it's always zero, does nothing, is useless

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4a4f7141fbd7d06e2e7d281416424c87da3033eb

4 years agoRemove trusted mask from BTM_SecAddDevice
Zach Johnson [Wed, 19 Aug 2020 22:08:31 +0000 (15:08 -0700)]
Remove trusted mask from BTM_SecAddDevice

It's just zeroed out, internalize it

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ib840fad787ee1dc73fdbbf79bdae3f37742f38fa

4 years agoBTM_SEC_IS_SERVICE_TRUSTED is never used
Zach Johnson [Wed, 19 Aug 2020 22:00:21 +0000 (15:00 -0700)]
BTM_SEC_IS_SERVICE_TRUSTED is never used

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: If4f892e78e9e95f6e426e4e4af883b14705fc9a2

4 years agoBTM_SecClrTempAuthService does nothing
Zach Johnson [Wed, 19 Aug 2020 21:57:56 +0000 (14:57 -0700)]
BTM_SecClrTempAuthService does nothing

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I7a402fa6c9db09557f080ed65401e8e2549ed762