OSDN Git Service

android-x86/system-bt.git
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 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 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

4 years agolast_author_service_id is never meaningfully set
Zach Johnson [Wed, 19 Aug 2020 21:56:47 +0000 (14:56 -0700)]
last_author_service_id is never meaningfully set

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

4 years agoBTM_SEC_OUT_FLAGS used to include authorized
Zach Johnson [Wed, 19 Aug 2020 21:47:06 +0000 (14:47 -0700)]
BTM_SEC_OUT_FLAGS used to include authorized

but now it doesn't so we only need the condition
above this one

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

4 years agoRemove BTM_SEC_AUTHORIZED, it's only removed or checked
Zach Johnson [Wed, 19 Aug 2020 21:51:27 +0000 (14:51 -0700)]
Remove BTM_SEC_AUTHORIZED, it's only removed or checked

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

4 years agothis used to check for authorized
Zach Johnson [Wed, 19 Aug 2020 21:43:35 +0000 (14:43 -0700)]
this used to check for authorized

BTM_SEC_IN_FLAGS was BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT |
BTM_SEC_IN_AUTHORIZE

authorized is gone now, so we only need the condition just above this
one

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

4 years agoRemove always false expressions
Zach Johnson [Wed, 19 Aug 2020 21:39:18 +0000 (14:39 -0700)]
Remove always false expressions

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

4 years agoThis expression is also never true
Zach Johnson [Wed, 19 Aug 2020 21:33:14 +0000 (14:33 -0700)]
This expression is also never true

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

4 years agoThis condition is never true
Zach Johnson [Wed, 19 Aug 2020 21:23:00 +0000 (14:23 -0700)]
This condition is never true

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

4 years agoSimpify boolean expression
Zach Johnson [Wed, 19 Aug 2020 21:22:07 +0000 (14:22 -0700)]
Simpify boolean expression

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

4 years agoRemove useless redefinition BTM_SEC_FLAG_AUTHORIZED
Zach Johnson [Wed, 19 Aug 2020 21:19:31 +0000 (14:19 -0700)]
Remove useless redefinition BTM_SEC_FLAG_AUTHORIZED

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

4 years agoBTM_SEC_OUT_AUTHENTICATE is never set, only checked or removed
Zach Johnson [Wed, 19 Aug 2020 21:15:50 +0000 (14:15 -0700)]
BTM_SEC_OUT_AUTHENTICATE is never set, only checked or removed

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

4 years agoBTM_SEC_IN_AUTHORIZE is never set, only checked or removed
Zach Johnson [Wed, 19 Aug 2020 21:09:43 +0000 (14:09 -0700)]
BTM_SEC_IN_AUTHORIZE is never set, only checked or removed

For clarity, falsed out these expressions in these
super complicated conditionals.

A future patch set will remove them.

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

4 years agoRemove BTA_AV_WITH_AVCTP_AUTHORIZATION
Zach Johnson [Wed, 19 Aug 2020 20:49:36 +0000 (13:49 -0700)]
Remove BTA_AV_WITH_AVCTP_AUTHORIZATION

It's always false.

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

4 years agoBTA_SEC_AUTHENTICATE does not include authorization
Zach Johnson [Wed, 19 Aug 2020 20:45:08 +0000 (13:45 -0700)]
BTA_SEC_AUTHENTICATE does not include authorization

this expression can be simplified

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

4 years agoFlatten bta_av_cb.sec_mask
Zach Johnson [Wed, 19 Aug 2020 20:14:25 +0000 (13:14 -0700)]
Flatten bta_av_cb.sec_mask

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

4 years agoThe security mask is always BTA_SEC_AUTHENTICATE
Zach Johnson [Wed, 19 Aug 2020 19:50:31 +0000 (12:50 -0700)]
The security mask is always BTA_SEC_AUTHENTICATE

don't pass in the message

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

4 years agoInternalize BTA_AvEnable's security mask
Zach Johnson [Wed, 19 Aug 2020 19:46:47 +0000 (12:46 -0700)]
Internalize BTA_AvEnable's security mask

it's always BTA_SEC_AUTHENTICATE

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

4 years agoFlatten BTA_SEC_AUTHORIZE
Zach Johnson [Wed, 19 Aug 2020 19:41:20 +0000 (12:41 -0700)]
Flatten BTA_SEC_AUTHORIZE

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

4 years agoAdd boolean flag for indicating IO Cap Response received
Martin Brabham [Thu, 20 Aug 2020 05:58:58 +0000 (22:58 -0700)]
Add boolean flag for indicating IO Cap Response received

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

4 years agoEnsure we delete the link key from the controller.
Martin Brabham [Thu, 20 Aug 2020 05:55:40 +0000 (22:55 -0700)]
Ensure we delete the link key from the controller.

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

4 years agoSimplify stack/l2cap/::l2c_link_check_send_pkts
Chris Manton [Wed, 19 Aug 2020 22:08:50 +0000 (15:08 -0700)]
Simplify stack/l2cap/::l2c_link_check_send_pkts

Towards proper interfaces

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

4 years agoMerge changes I283667e2,Ibc685b5d,I54537140,Ic11c5809
Treehugger Robot [Wed, 19 Aug 2020 22:15:02 +0000 (22:15 +0000)]
Merge changes I283667e2,Ibc685b5d,I54537140,Ic11c5809

* changes:
  Move create_classic_conn from l2c to acl
  Add API stack/acl/btm_acl::acl_create_classic_connection
  Simplify stack/l2cap/l2c_utils::l2cu_create_conn_after_switch
  Move stack/l2cap/l2c_link::btm_acl_connected

4 years agoMerge changes I14a0dc1d,If34b5018,Icdba6206
Treehugger Robot [Wed, 19 Aug 2020 21:55:06 +0000 (21:55 +0000)]
Merge changes I14a0dc1d,If34b5018,Icdba6206

* changes:
  This if is always true
  Remove useless line
  Remove unused parameter in btif_dm_proc_io_req

4 years agoMerge changes I1f6a908f,I96781ecd,I4de2d029,Ib3e5580a,I5b615bb3
Treehugger Robot [Wed, 19 Aug 2020 21:10:46 +0000 (21:10 +0000)]
Merge changes I1f6a908f,I96781ecd,I4de2d029,Ib3e5580a,I5b615bb3

* changes:
  BTM_ReadConnectability is never used now
  BTM_ReadDiscoverability is never used now
  Simplify BTM_SetDiscoverability
  Simplify BTM_SetConnectability
  Inline always 0 parameters

4 years agoMerge changes I8fd02d8f,Ia21eeb73
Treehugger Robot [Wed, 19 Aug 2020 20:57:37 +0000 (20:57 +0000)]
Merge changes I8fd02d8f,Ia21eeb73

* changes:
  Remove unnecessary definition
  GD SecurityRecord: Explicitly set IsEncrypted to false upon loading

4 years agoMerge changes I51c3b864,I2af0f2c2,Ifaec802b,I9ea573cb,I87154d64, ...
Zach Johnson [Wed, 19 Aug 2020 20:30:34 +0000 (20:30 +0000)]
Merge changes I51c3b864,I2af0f2c2,Ifaec802b,I9ea573cb,I87154d64, ...

* changes:
  what on earth
  if you pass 0, these are the values used
  These were never set
  The params are never ignore, they're set in this function
  Fold bt_scan_mode_t into BTA_DmSetVisibility
  Flatten BTA_DmSetVisibility

4 years agoMerge changes I5f284c8c,I5f1afa5e,I5e7478e9,I9c717be1,Ie8d7e20a, ...
Zach Johnson [Wed, 19 Aug 2020 20:10:47 +0000 (20:10 +0000)]
Merge changes I5f284c8c,I5f1afa5e,I5e7478e9,I9c717be1,Ie8d7e20a, ...

* changes:
  read_inq_tx_power_timer is never used
  p_inq_tx_power_cmpl_cb is always null
  Remove dead code
  btm_process_remote_name does nothing interesting if remote name not active
  btm_inq_vars.scan_type is not useful
  Remove useless variable
  Status is set but not used
  Replace with equivalent expression
  Remove unnecessary variable
  state is already set to this value higher in this function
  Flatten btm_initiate_inquiry
  BTM_BLE_LIMITED_INQUIRY is never used
  BTM_LIMITED_INQUIRY is never set
  Delete BTM_CancelPeriodicInquiry, it's unused and does nothing
  BTM_PERIODIC_INQUIRY_ACTIVE is never set
  This condition will never be met
  Replace equivalent expression
  Don't report illegal value for something uncontrollable
  reduce duplicate mask setting
  p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK is always true

4 years agoThis if is always true
Hansong Zhang [Wed, 19 Aug 2020 19:54:11 +0000 (12:54 -0700)]
This if is always true

In previous line, if p_dev_rec->sm4 & BTM_SM4_UPGRADE is true, then we
still have BTM_SUCCESS; if we invoke btm_cb.api.p_sp_callback, then OOB
data status is set in btif_dm_set_oob_for_io_req, unless the stack is
not running.

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

4 years agoMove create_classic_conn from l2c to acl
Chris Manton [Wed, 19 Aug 2020 19:23:40 +0000 (12:23 -0700)]
Move create_classic_conn from l2c to acl

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

4 years agoAdd API stack/acl/btm_acl::acl_create_classic_connection
Chris Manton [Wed, 19 Aug 2020 19:22:23 +0000 (12:22 -0700)]
Add API stack/acl/btm_acl::acl_create_classic_connection

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

4 years agoSimplify stack/l2cap/l2c_utils::l2cu_create_conn_after_switch
Chris Manton [Tue, 18 Aug 2020 05:03:41 +0000 (22:03 -0700)]
Simplify stack/l2cap/l2c_utils::l2cu_create_conn_after_switch

Towards proper interfaces

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

4 years agoRemove useless line
Hansong Zhang [Wed, 19 Aug 2020 19:42:53 +0000 (12:42 -0700)]
Remove useless line

auth_req is either BTM_AUTH_AP_NO (2) or BTM_AUTH_AP_YES (3).
BTM_AUTH_DD_BOND is 2.  Useless or.

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

4 years agoMove stack/l2cap/l2c_link::btm_acl_connected
Chris Manton [Wed, 19 Aug 2020 19:30:04 +0000 (12:30 -0700)]
Move stack/l2cap/l2c_link::btm_acl_connected

Into: stack/acl/btm_acl

Towards proper interfaces

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

4 years agoRemove unused parameter in btif_dm_proc_io_req
Hansong Zhang [Wed, 19 Aug 2020 19:34:00 +0000 (12:34 -0700)]
Remove unused parameter in btif_dm_proc_io_req

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

4 years agoRemove unnecessary definition
Hansong Zhang [Wed, 19 Aug 2020 19:13:02 +0000 (12:13 -0700)]
Remove unnecessary definition

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

4 years agoGD SecurityRecord: Explicitly set IsEncrypted to false upon loading
Hansong Zhang [Wed, 19 Aug 2020 19:04:48 +0000 (12:04 -0700)]
GD SecurityRecord: Explicitly set IsEncrypted to false upon loading

IsEncrypted is set to true only after Encryption Change event.

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

4 years agoBTM_ReadConnectability is never used now
Zach Johnson [Wed, 19 Aug 2020 18:53:25 +0000 (11:53 -0700)]
BTM_ReadConnectability is never used now

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

4 years agoBTM_ReadDiscoverability is never used now
Zach Johnson [Wed, 19 Aug 2020 18:51:57 +0000 (11:51 -0700)]
BTM_ReadDiscoverability is never used now

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

4 years agoSimplify BTM_SetDiscoverability
Zach Johnson [Wed, 19 Aug 2020 18:45:11 +0000 (11:45 -0700)]
Simplify BTM_SetDiscoverability

window & interval are fixed, and need no validation

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

4 years agoSimplify BTM_SetConnectability
Zach Johnson [Wed, 19 Aug 2020 18:43:39 +0000 (11:43 -0700)]
Simplify BTM_SetConnectability

The windows are fixed defaults, and need no validation.

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

4 years agoInline always 0 parameters
Zach Johnson [Wed, 19 Aug 2020 18:41:15 +0000 (11:41 -0700)]
Inline always 0 parameters

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

4 years agoMerge changes If3136d44,I7a3ee025,I734ece7f
Zach Johnson [Wed, 19 Aug 2020 18:40:27 +0000 (18:40 +0000)]
Merge changes If3136d44,I7a3ee025,I734ece7f

* changes:
  Remove inquiry filtering from shim
  Remove unused filter_cond
  max_resps is always 0: unlimited

4 years agowhat on earth
Zach Johnson [Wed, 19 Aug 2020 18:25:04 +0000 (11:25 -0700)]
what on earth

this has been here since this code was put into AOSP

"oh hey, PAN_Register changes discoverable and connectable, let's work
around it by saving the initial values and then restoring them after."

anyways, I checked PAN_Register only sets initial state & registers with
l2cap.

this looks like a vestige of early PAN, probably from BTA days when this
was on feature phones they needed a way to make your phone discoverable
so you could use PAN.

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

Change-Id: I51c3b864b5c7c4847bcc2dfb84e55b6191146778

4 years agoMerge "SecurityManagerChannel: AuthenticationRequest not always needed"
Treehugger Robot [Wed, 19 Aug 2020 18:25:38 +0000 (18:25 +0000)]
Merge "SecurityManagerChannel: AuthenticationRequest not always needed"

4 years agoif you pass 0, these are the values used
Zach Johnson [Wed, 19 Aug 2020 18:16:07 +0000 (11:16 -0700)]
if you pass 0, these are the values used

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

4 years agoThese were never set
Zach Johnson [Wed, 19 Aug 2020 18:10:01 +0000 (11:10 -0700)]
These were never set

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

4 years agoThe params are never ignore, they're set in this function
Zach Johnson [Wed, 19 Aug 2020 18:00:11 +0000 (11:00 -0700)]
The params are never ignore, they're set in this function

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

4 years agoFold bt_scan_mode_t into BTA_DmSetVisibility
Zach Johnson [Wed, 19 Aug 2020 17:53:29 +0000 (10:53 -0700)]
Fold bt_scan_mode_t into BTA_DmSetVisibility

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

4 years agoFlatten BTA_DmSetVisibility
Zach Johnson [Wed, 19 Aug 2020 17:42:07 +0000 (10:42 -0700)]
Flatten BTA_DmSetVisibility

is called from main thread

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

4 years agogatt: Allow services to indicate eatt support
Łukasz Rymanowski [Wed, 19 Aug 2020 12:29:37 +0000 (14:29 +0200)]
gatt: Allow services to indicate eatt support

With this patch eatch client/server can decide if EATT support
should be enabled or not.
If eatt_support is set to true, and EATT is available, it will be used for services added.
If eatt_support is set to false, that means only ATT (CID 4) is used for services added.

Tag: #feature
Bug: 159786353
Sponsor: jpawlowski@
Test: compilation
Change-Id: I584172800ce32a4a11df465841d2bc49ab224939

4 years agoread_inq_tx_power_timer is never used
Zach Johnson [Wed, 19 Aug 2020 17:27:25 +0000 (10:27 -0700)]
read_inq_tx_power_timer is never used

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

4 years agop_inq_tx_power_cmpl_cb is always null
Zach Johnson [Wed, 19 Aug 2020 17:25:48 +0000 (10:25 -0700)]
p_inq_tx_power_cmpl_cb is always null

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

4 years agoRemove dead code
Zach Johnson [Wed, 19 Aug 2020 17:02:19 +0000 (10:02 -0700)]
Remove dead code

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

4 years agobtm_process_remote_name does nothing interesting if remote name not
Zach Johnson [Wed, 19 Aug 2020 16:59:12 +0000 (09:59 -0700)]
btm_process_remote_name does nothing interesting if remote name not
active

this function call does nothing

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

4 years agobtm_inq_vars.scan_type is not useful
Zach Johnson [Wed, 19 Aug 2020 16:47:34 +0000 (09:47 -0700)]
btm_inq_vars.scan_type is not useful

was never checked to do anything interesting, was always general or none

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

4 years agoRemove useless variable
Zach Johnson [Wed, 19 Aug 2020 16:28:59 +0000 (09:28 -0700)]
Remove useless variable

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

4 years agoStatus is set but not used
Zach Johnson [Wed, 19 Aug 2020 16:27:38 +0000 (09:27 -0700)]
Status is set but not used

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

4 years agoReplace with equivalent expression
Zach Johnson [Wed, 19 Aug 2020 16:24:23 +0000 (09:24 -0700)]
Replace with equivalent expression

mode is always general

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

4 years agoRemove unnecessary variable
Zach Johnson [Wed, 19 Aug 2020 16:23:17 +0000 (09:23 -0700)]
Remove unnecessary variable

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

4 years agostate is already set to this value higher in this function
Zach Johnson [Wed, 19 Aug 2020 16:22:27 +0000 (09:22 -0700)]
state is already set to this value higher in this function

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

4 years agoFlatten btm_initiate_inquiry
Zach Johnson [Wed, 19 Aug 2020 16:20:04 +0000 (09:20 -0700)]
Flatten btm_initiate_inquiry

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