OSDN Git Service

android-x86/system-bt.git
3 years agoMerge "BTM_API Shim: BTA will call shim BTM_API if GD enabled"
Treehugger Robot [Tue, 8 Sep 2020 22:52:43 +0000 (22:52 +0000)]
Merge "BTM_API Shim: BTA will call shim BTM_API if GD enabled"

3 years agoMerge "Fix l2cap callback connection creation API"
Treehugger Robot [Tue, 8 Sep 2020 22:51:05 +0000 (22:51 +0000)]
Merge "Fix l2cap callback connection creation API"

3 years agoBTM_API Shim: BTA will call shim BTM_API if GD enabled
Martin Brabham [Thu, 27 Aug 2020 18:08:34 +0000 (11:08 -0700)]
BTM_API Shim: BTA will call shim BTM_API if GD enabled

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: I0ab945eec94db65bc17f6e872e6925bd1fd8f1e8

3 years agoUpdate stack/::ble_addr_type
Chris Manton [Wed, 2 Sep 2020 04:58:08 +0000 (21:58 -0700)]
Update stack/::ble_addr_type

Using strict types tBLE_ADDR_TYPE

Towards readable code

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

3 years agoUpdate btif/src/::ble_addr_type
Chris Manton [Wed, 2 Sep 2020 04:38:44 +0000 (21:38 -0700)]
Update btif/src/::ble_addr_type

Using strict types tBLE_ADDR_TYPE

Towards readable code

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

3 years agoMerge "gatt: Fix CID check when receiving ack"
Treehugger Robot [Tue, 8 Sep 2020 19:58:36 +0000 (19:58 +0000)]
Merge "gatt: Fix CID check when receiving ack"

3 years agoMerge "Changed HID_DEV_MTU_SIZE from 64 to 512"
Treehugger Robot [Tue, 8 Sep 2020 18:29:48 +0000 (18:29 +0000)]
Merge "Changed HID_DEV_MTU_SIZE from 64 to 512"

3 years agoFix l2cap callback connection creation API
Chris Manton [Sun, 6 Sep 2020 04:45:45 +0000 (21:45 -0700)]
Fix l2cap callback connection creation API

Towards readable code

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

Change-Id: I5ba3967775f2544846a8524ac1f76177c7510f45

3 years agoMerge "Shim: Add GD advertising init flags"
Treehugger Robot [Tue, 8 Sep 2020 18:01:08 +0000 (18:01 +0000)]
Merge "Shim: Add GD advertising init flags"

3 years agoMerge "bt: don't return the address of a stack-allocated string"
Treehugger Robot [Tue, 8 Sep 2020 17:14:48 +0000 (17:14 +0000)]
Merge "bt: don't return the address of a stack-allocated string"

3 years agoRemove l2cap debug logging clutter
Chris Manton [Wed, 2 Sep 2020 22:17:51 +0000 (15:17 -0700)]
Remove l2cap debug logging clutter

Towards readable code

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

Change-Id: Ida4ec6ebdc4cac6ce4778fb154fea1c1c0630d06

3 years agogatt: Fix CID check when receiving ack
HsingYuan Lo [Tue, 8 Sep 2020 03:27:40 +0000 (11:27 +0800)]
gatt: Fix CID check when receiving ack

Tag: #feature
Test: build & test service change behavior
Bug: 159786353
Change-Id: Idb9811e8dd3b0a7bcacc482501f348c477a918c5

3 years agoPass AddressWithType into messages correctly
Jakub Pawlowski [Mon, 7 Sep 2020 15:06:28 +0000 (17:06 +0200)]
Pass AddressWithType into messages correctly

BluetoothAddress is created from string, which was improperly set to
both address and type up till now. After this is fixed, one can finally
compare address with expected address in events.

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

3 years agoChanged HID_DEV_MTU_SIZE from 64 to 512
Danny Trunk [Mon, 7 Sep 2020 14:44:24 +0000 (16:44 +0200)]
Changed HID_DEV_MTU_SIZE from 64 to 512

Changed HID_DEV_MTU_SIZE for Amiibo Backups over Bluetooth support

Signed-off-by: Danny Trunk <dtrunk90@gmail.com>
Change-Id: Ie4226b477d040177108729cb25e711fd35bfe0f2

3 years agoShim: Add GD advertising init flags
Chienyuan [Mon, 7 Sep 2020 10:03:56 +0000 (18:03 +0800)]
Shim: Add GD advertising init flags

Tag: #gd-refactor
Bug: 159815595
Test: cert/run --host
Change-Id: Ibe9f2b8155b990f3a3ae626339b40aec8d9e116e

3 years agobt: don't return the address of a stack-allocated string
George Burgess IV [Sun, 6 Sep 2020 19:49:05 +0000 (12:49 -0700)]
bt: don't return the address of a stack-allocated string

`char foo[] = "bar";` makes a stack-resident `char[4]`. The standard
ways of getting a not-stack-allocated string are:
- `const char *foo = "bar"` (`foo` will point to a `char[4]` in rodata.
  casting away the const here leads to badness if the string is
  modified.)
- `static char foo[] = "bar"` (`foo` will point to a `char[4]` in a
  writeable section of memory that lives for the life of the program.)

Since we return a non-const `char *` here, and since this method is a
stub, the latter seems more appropriate.

Bug: 162984360
Tag: #security
Test: TreeHugger
Change-Id: I51bd4a2d8e2e3826809a1bdc9743d2d1cb62870f

3 years agoUse tBTM_CB::tBTM_BLE_CB::scan_activity
Chris Manton [Thu, 3 Sep 2020 00:35:56 +0000 (17:35 -0700)]
Use tBTM_CB::tBTM_BLE_CB::scan_activity

Towards readable code

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

Change-Id: Ib1635458ff785125b5718622e719b11979744e71

3 years agoencapsulate tBTM_CB::tBTM_BLE_CB::scan_activity
Chris Manton [Thu, 3 Sep 2020 00:25:21 +0000 (17:25 -0700)]
encapsulate tBTM_CB::tBTM_BLE_CB::scan_activity

Towards readable code

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

3 years agoRemove API constant stack/btm/btm_ble_gap::btm_ble_start_inquiry
Chris Manton [Thu, 3 Sep 2020 00:56:56 +0000 (17:56 -0700)]
Remove API constant stack/btm/btm_ble_gap::btm_ble_start_inquiry

First param is a constant from only call junction

Towards readable code

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

3 years agoUpdate bta/include/::ble_addr_type
Chris Manton [Wed, 2 Sep 2020 04:47:35 +0000 (21:47 -0700)]
Update bta/include/::ble_addr_type

Using strict types tBLE_ADDR_TYPE

Towards readable code

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

3 years agoUpdate main/shim/::ble_addr_type
Chris Manton [Wed, 2 Sep 2020 04:45:37 +0000 (21:45 -0700)]
Update main/shim/::ble_addr_type

Using strict types tBLE_ADDR_TYPE

Towards readable code

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

3 years agoMerge "gatt: Add CID for sending notification confirmation"
Jakub Pawlowski [Fri, 4 Sep 2020 08:41:13 +0000 (08:41 +0000)]
Merge "gatt: Add CID for sending notification confirmation"

3 years agoMerge changes from topic "bt-char-ext-prop"
Jakub Pawlowski [Fri, 4 Sep 2020 08:38:35 +0000 (08:38 +0000)]
Merge changes from topic "bt-char-ext-prop"

* changes:
  Fall back to Read Request when reading Characteristic Extended Properties
  Server support for Characteristic Extended Properties
  Client support for Characteristic Extended Properties

3 years agoMerge "Shim: Security module InitFlag"
Treehugger Robot [Fri, 4 Sep 2020 04:27:39 +0000 (04:27 +0000)]
Merge "Shim: Security module InitFlag"

3 years agogatt: Add CID for sending notification confirmation
Łukasz Rymanowski [Thu, 3 Sep 2020 14:04:19 +0000 (14:04 +0000)]
gatt: Add CID for sending notification confirmation

This patch fixes a regression after

commit 7a496c86ba675e1023a5b84de686a823834896db
stack/gatt: Extend calls with CID

Notification confirmation was not taken into account.
For notification function attp_send_cl_msg() is called with p_clcb NULL
which leads to a crash in the following line:

uint16_t payload_size = gatt_tcb_get_payload_size_tx(tcb, p_clcb->cid);

This patch introduces a new function:  attp_send_cl_confirmation_msg()

which is used only for sending confirmation.
Also this patch makes sure that cid is provided to the GATT client so it
can be used in the confirmation call.
Note: handle was removed from the confirmation call as it is redundant.

The only missing part in this patch is handling timers per each
indication and this will be fixed in following patches which will add
eatt support.

Tag: #feature
Bug: 159786353
Sponsor: jpawlowski@
Test: compile & manual

Change-Id: I8bdb38ec673e11744d670223e5416be01666e1a6

3 years agoShim: Security module InitFlag
Martin Brabham [Mon, 31 Aug 2020 04:13:43 +0000 (21:13 -0700)]
Shim: Security module InitFlag

Add InitFlags::GdSecurityEnabled()

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: Ic6e164dcd448831a4af4758a13f2c89bf8fd4c27

3 years agoShim layer for GD security enforcement
Hansong Zhang [Thu, 3 Sep 2020 06:34:41 +0000 (23:34 -0700)]
Shim layer for GD security enforcement

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

3 years agoUse BTM_GetHCIConnHandle to get handle
Hansong Zhang [Wed, 2 Sep 2020 23:50:28 +0000 (16:50 -0700)]
Use BTM_GetHCIConnHandle to get handle

Don't pass handle directly

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

3 years agoMerge "HFP: Add more logs to SCO sessions"
Treehugger Robot [Thu, 3 Sep 2020 16:28:43 +0000 (16:28 +0000)]
Merge "HFP: Add more logs to SCO sessions"

3 years agoMerge "hci: Support periodic advertising sync + transfer"
Jakub Pawlowski [Thu, 3 Sep 2020 15:52:22 +0000 (15:52 +0000)]
Merge "hci: Support periodic advertising sync + transfer"

3 years agoFall back to Read Request when reading Characteristic Extended Properties
Jakub Pawlowski [Thu, 28 Jun 2018 15:27:57 +0000 (08:27 -0700)]
Fall back to Read Request when reading Characteristic Extended Properties

If Read Multiple Request is not supported, fall back to Read Request.

Test: Manually tested against device modified to not support Read
Multiple Request (GATT_REQ_READ_MULTI in gatt_server_handle_client_req
forced to return GATT_REQ_NOT_SUPPORTED)
Bug: 110864501

Change-Id: I262678c93f2c3e56832502d1f46542dfc97c7904

3 years agoServer support for Characteristic Extended Properties
Jakub Pawlowski [Wed, 27 Jun 2018 08:59:47 +0000 (01:59 -0700)]
Server support for Characteristic Extended Properties

Test: sl4a GattExtendedPropertiesTest
Bug: 110864501
Change-Id: If04b28f1b90c1f7b5a6f53673f6bd2c4791f28bb

3 years agoClient support for Characteristic Extended Properties
Jakub Pawlowski [Tue, 26 Jun 2018 05:52:33 +0000 (22:52 -0700)]
Client support for Characteristic Extended Properties

Read value of Characteristic Extended Properties descirptors as part of
GATT service discovery process. Also store this value as part of GATT
Cache.

Test: updated GattDatabaseTest.serialize_deserialize_binary_test added
 GattCacheTest.stored_attribute_to_binary_characteristic_extended_properties_test
 Added sl4a GattExtendedPropertiesTest
Bug: 110864501
Change-Id: Iccd8aa378c14e75f91d761a675c7c23f096ce2da

3 years agohci: Support periodic advertising sync + transfer
Jakub Tyszkowski [Tue, 5 May 2020 09:48:29 +0000 (11:48 +0200)]
hci: Support periodic advertising sync + transfer

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

3 years agoshim::Acl should only run if gd::Core disabled
Chris Manton [Thu, 3 Sep 2020 02:56:22 +0000 (19:56 -0700)]
shim::Acl should only run if gd::Core disabled

Bug: 166280067
Test: compile
Tag: #refactor
Change-Id: I6f79df1b7126d5237d9b2c9bcac3c3a65aaff19c

3 years agoMerge "BTM_API Shim"
Treehugger Robot [Thu, 3 Sep 2020 01:34:27 +0000 (01:34 +0000)]
Merge "BTM_API Shim"

3 years agoMerge "HFP: Add missing sco listen action in state machine"
Treehugger Robot [Thu, 3 Sep 2020 00:31:55 +0000 (00:31 +0000)]
Merge "HFP: Add missing sco listen action in state machine"

3 years agoMerge "Adds fuzzer for l2cap"
Treehugger Robot [Thu, 3 Sep 2020 00:27:27 +0000 (00:27 +0000)]
Merge "Adds fuzzer for l2cap"

3 years agoHFP: Add more logs to SCO sessions
Jack He [Mon, 31 Aug 2020 23:48:06 +0000 (16:48 -0700)]
HFP: Add more logs to SCO sessions

Bug: 159815595
Test: make phone call with HFP
Tag: #refactor
Change-Id: Idcca06da14c1212c28fb1dadd215b4035202b60f

3 years agoHFP: Add missing sco listen action in state machine
Jack He [Wed, 2 Sep 2020 22:58:19 +0000 (15:58 -0700)]
HFP: Add missing sco listen action in state machine

Bug: 167564040
Bug: 159815595
Tag: #refactor
Test: compile & verify hfp is working
Change-Id: Ife1c3bc68d0f805946e70e172b90bb96abf9fb33

3 years agoAdds fuzzer for l2cap
Dylan Katz [Sun, 19 Jul 2020 17:25:44 +0000 (10:25 -0700)]
Adds fuzzer for l2cap

This adds a fuzzer for l2cap and a few related subcomponents.
Test: gd/fuzz/run bluetooth_gd_l2cap_fuzzer
Tag: #feature
Bug: 167425311
Sponsor: zachoverflow@

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I052f103929749b6532c66881cf88589375cf8a5d

3 years agoBTM_API Shim
Martin Brabham [Thu, 27 Aug 2020 17:28:50 +0000 (10:28 -0700)]
BTM_API Shim

  - Add several API implementations
  - Connect callbacks to UI

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: Ibe225070223ad1d695ea0226e93ec39ffb1531e8

3 years agoMerge "BTM_API Shim: Call BTA sp_cback for events"
Treehugger Robot [Wed, 2 Sep 2020 20:19:52 +0000 (20:19 +0000)]
Merge "BTM_API Shim: Call BTA sp_cback for events"

3 years agoMerge changes I4614e05e,I8bfaa30b
Treehugger Robot [Wed, 2 Sep 2020 19:51:20 +0000 (19:51 +0000)]
Merge changes I4614e05e,I8bfaa30b

* changes:
  Add a way to enforce l2cap security by requirement
  L2cap sec: Remove the workaround for legacy device

3 years agoMerge changes I5b7c552c,Ie209b705
Jakub Pawlowski [Wed, 2 Sep 2020 19:28:47 +0000 (19:28 +0000)]
Merge changes I5b7c552c,Ie209b705

* changes:
  stack/l2c: Add helper l2cu_reject_ble_coc_connection
  stack/gatt: Extend calls with CID

3 years agostack/l2c: Add helper l2cu_reject_ble_coc_connection
Łukasz Rymanowski [Tue, 5 May 2020 06:48:21 +0000 (08:48 +0200)]
stack/l2c: Add helper l2cu_reject_ble_coc_connection

New helper will take tL2C_CCB* as a parameter (when available).

This will be needed later on when this function will need more more knowledge.

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

3 years agoBTM_API Shim: Call BTA sp_cback for events
Martin Brabham [Fri, 21 Aug 2020 07:03:36 +0000 (00:03 -0700)]
BTM_API Shim: Call BTA sp_cback for events

    - IO Capability Request
    - IO Capability Response
    - User Confirmation Request

Bug: 159815595
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: I30aee8b7c29d6784d62fb5d900fee7bb223aaf10

3 years agoBTM_API Shim: Implement BTM_ConfirmReqReply
Martin Brabham [Fri, 21 Aug 2020 06:08:13 +0000 (23:08 -0700)]
BTM_API Shim: Implement BTM_ConfirmReqReply

Bug: 159815595
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: I1f86b0d6ae924e0ea068831cfb27f737df32018d

3 years agoMerge "gd HCI: fix failed assertion about extended_properties"
Treehugger Robot [Wed, 2 Sep 2020 18:35:51 +0000 (18:35 +0000)]
Merge "gd HCI: fix failed assertion about extended_properties"

3 years agoMerge "gd HCI: Initialize advertising_handle_ with kInvalidHandle"
Treehugger Robot [Wed, 2 Sep 2020 18:35:44 +0000 (18:35 +0000)]
Merge "gd HCI: Initialize advertising_handle_ with kInvalidHandle"

3 years agostack/gatt: Extend calls with CID
Łukasz Rymanowski [Fri, 1 May 2020 00:40:58 +0000 (02:40 +0200)]
stack/gatt: Extend calls with CID

This is preparation for EATT

Tag: #feature
Bug: 159786353
Sponsor: jpawlowski@
Test: atest net_test_stack
Change-Id: Ie209b705f6cc458286e9566919280ed5e2de60c9

3 years agoMerge "Fix potential overflow for gatt process write"
Jakub Pawlowski [Wed, 2 Sep 2020 15:22:06 +0000 (15:22 +0000)]
Merge "Fix potential overflow for gatt process write"

3 years agoFix potential overflow for gatt process write
Chris Manton [Wed, 4 Mar 2020 19:26:31 +0000 (11:26 -0800)]
Fix potential overflow for gatt process write

Bug: 143604331
Test: net_test_stack_gatt_native

Change-Id: I88704d74ba0c265872fbfd20c8bcd3bc1dd60360
Merged-In: I88704d74ba0c265872fbfd20c8bcd3bc1dd60360

3 years agogd HCI: fix failed assertion about extended_properties
Chienyuan [Tue, 1 Sep 2020 12:38:12 +0000 (20:38 +0800)]
gd HCI: fix failed assertion about extended_properties

Bug: 159815595
Tag: #gd-refactor
Test: gd/cert/run --host
Test: manual
Change-Id: Ie910933ed1e9c9619fc0eddd03e41576513ec207

3 years agogd HCI: Initialize advertising_handle_ with kInvalidHandle
Chienyuan [Tue, 1 Sep 2020 12:12:55 +0000 (20:12 +0800)]
gd HCI: Initialize advertising_handle_ with kInvalidHandle

Bug: 152348535
Tag: #gd-refactor
Test: gd/cert/run --host
Test: atest bluetooth_test_gd
Change-Id: I5254e08f12cc547339f51489dfd06ee2fcd25d57

3 years agoMerge "HFP: Fix missing sco events and masked events"
Treehugger Robot [Wed, 2 Sep 2020 02:37:33 +0000 (02:37 +0000)]
Merge "HFP: Fix missing sco events and masked events"

3 years agoFirst entry acl shim layer
Chris Manton [Thu, 27 Aug 2020 01:00:33 +0000 (18:00 -0700)]
First entry acl shim layer

Test: atest bluetooth_test_gd
Bug: 166280067
Tag: #refactor
Change-Id: I720045436cd0405b2b9ea1c0e657f8128dffa3a1

3 years agoHFP: Fix missing sco events and masked events
Zach Johnson [Wed, 2 Sep 2020 00:17:26 +0000 (17:17 -0700)]
HFP: Fix missing sco events and masked events

* SCO events have secondary actions that need to be handled
* Also remove event masking, which is no longer needed

Bug: 167349211
Bug: 159815595
Tag: #refactor
Test: compile & verify Bluetooth connections are working
Change-Id: If8d3aa873b55b5d6936c16766fd6c1c49749002d

3 years agoAdd a way to enforce l2cap security by requirement
Hansong Zhang [Tue, 1 Sep 2020 23:44:37 +0000 (16:44 -0700)]
Add a way to enforce l2cap security by requirement

Instead of finding the service from psm, and finding the requirement
from the service record, enforce that specific requirement directly

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

3 years agoAdd main/shim/helpers::ToLegacyAddressWithType
Chris Manton [Tue, 1 Sep 2020 17:55:08 +0000 (10:55 -0700)]
Add main/shim/helpers::ToLegacyAddressWithType

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

3 years agoRe-include stack/btm/btm_ble_gap
Chris Manton [Tue, 1 Sep 2020 17:03:44 +0000 (10:03 -0700)]
Re-include stack/btm/btm_ble_gap

Towards readable code

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

3 years agoEnforce internal linkage stack/btm/btm_ble_bgconn
Chris Manton [Tue, 1 Sep 2020 16:25:20 +0000 (09:25 -0700)]
Enforce internal linkage stack/btm/btm_ble_bgconn

Towards readable code

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

3 years agoRe-include stack/btm/btm_ble_bgconn
Chris Manton [Tue, 1 Sep 2020 16:23:46 +0000 (09:23 -0700)]
Re-include stack/btm/btm_ble_bgconn

Towards readable code

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

3 years agoReplace tBTM_SEC_BLE::identity addr/type
Chris Manton [Tue, 1 Sep 2020 04:21:35 +0000 (21:21 -0700)]
Replace tBTM_SEC_BLE::identity addr/type

Replace with address_with_type

Towards readable code

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

3 years agoFactor out btm_ble_conn_complete::maybe_resolve_address
Chris Manton [Mon, 31 Aug 2020 22:25:23 +0000 (15:25 -0700)]
Factor out btm_ble_conn_complete::maybe_resolve_address

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

Change-Id: I910bb35b9eecfd543a4d0b132eef638bdf86040b

3 years agoUse tBTM_SEC_BLE::tADDRESS_TYPE
Chris Manton [Fri, 28 Aug 2020 00:05:36 +0000 (17:05 -0700)]
Use tBTM_SEC_BLE::tADDRESS_TYPE

Towards readable code

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

Change-Id: I5b67eba668a3bb458bf058da80b2dc08e033bd44

3 years agoSimplify return value btm_ble_read_resolving_list_entry
Chris Manton [Mon, 31 Aug 2020 20:00:09 +0000 (13:00 -0700)]
Simplify return value btm_ble_read_resolving_list_entry

Return value too complicated.

Heck, it's not even checked in the single call location

Towards readable code

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

3 years agoStreamline stack/btm/btm_ble_add::btm_identity_addr_to_random_pseudo
Chris Manton [Thu, 27 Aug 2020 17:23:29 +0000 (10:23 -0700)]
Streamline stack/btm/btm_ble_add::btm_identity_addr_to_random_pseudo

Towards readable code

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

3 years agoStreamline btm_ble_refresh_peer_resolvable_private_addr
Chris Manton [Thu, 27 Aug 2020 17:05:36 +0000 (10:05 -0700)]
Streamline btm_ble_refresh_peer_resolvable_private_addr

Towards readable code

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

3 years agoL2cap sec: Remove the workaround for legacy device
Hansong Zhang [Mon, 31 Aug 2020 22:52:20 +0000 (15:52 -0700)]
L2cap sec: Remove the workaround for legacy device

We don't enforce security when we need to open an L2cap channel for a
legacy device (pre 2.1, simple pairing not supported), and let upper
layer enforce security.  However, now we always enforce security in
L2cap, except for RFCOMM (which is additional), so there is no other
upper layer can enforce security.  Moreover, supporting pre 2.1 devices
(either local or remote) can give us additional complexity, and GD
doesn't support it.

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

3 years agoEncapsulate tBTM_CB::tBTM_BLE_CB::tBTM_BLE_CONN_ST
Chris Manton [Mon, 31 Aug 2020 16:38:51 +0000 (09:38 -0700)]
Encapsulate tBTM_CB::tBTM_BLE_CB::tBTM_BLE_CONN_ST

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

3 years agoMerge "BTM_API Shim: Add ShimUi"
Treehugger Robot [Tue, 1 Sep 2020 22:11:15 +0000 (22:11 +0000)]
Merge "BTM_API Shim: Add ShimUi"

3 years agoMerge "BTM_API Shim: Add ShimBondListener"
Treehugger Robot [Tue, 1 Sep 2020 20:00:30 +0000 (20:00 +0000)]
Merge "BTM_API Shim: Add ShimBondListener"

3 years agoMerge changes I0aa05e5b,I4c2bc679,I2b0a15e8,I8aabfbc4,Ifc8114d9, ...
Treehugger Robot [Tue, 1 Sep 2020 19:10:09 +0000 (19:10 +0000)]
Merge changes I0aa05e5b,I4c2bc679,I2b0a15e8,I8aabfbc4,Ifc8114d9, ...

* changes:
  Remove unused code in rfc_int.h
  Remove sec_id related code in RFCOMM
  Move rfcomm security requirement to rfcomm module
  Clear RFCOMM security when done
  Get rid of p_cur_service in dev_rec
  Legacy RFCOMM: Use the new security record
  Introduce BTM_SetRfcommSecurity

3 years agoBTM: Fix a bit flip in the role change state comparison
Jack He [Tue, 1 Sep 2020 00:52:27 +0000 (17:52 -0700)]
BTM: Fix a bit flip in the role change state comparison

Bug: 167151478
Test: make phone calls over Bluetooth
Tag: #stability
Change-Id: I331e2897e23816d5ead2e8bb225e27a48f8d636e

3 years agoRemove unused code in rfc_int.h
Hansong Zhang [Mon, 31 Aug 2020 22:03:58 +0000 (15:03 -0700)]
Remove unused code in rfc_int.h

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

3 years agoRemove sec_id related code in RFCOMM
Hansong Zhang [Mon, 31 Aug 2020 21:56:25 +0000 (14:56 -0700)]
Remove sec_id related code in RFCOMM

That's for BTM security registration.  RFCOMM is not using it.  So far
only L2cap channel (GAP_ConnOpen) is using dynamic sec_id.

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

3 years agoMove rfcomm security requirement to rfcomm module
Hansong Zhang [Mon, 31 Aug 2020 20:55:43 +0000 (13:55 -0700)]
Move rfcomm security requirement to rfcomm module

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

3 years agoClear RFCOMM security when done
Hansong Zhang [Mon, 31 Aug 2020 20:13:31 +0000 (13:13 -0700)]
Clear RFCOMM security when done

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

3 years agoGet rid of p_cur_service in dev_rec
Hansong Zhang [Mon, 31 Aug 2020 19:44:47 +0000 (12:44 -0700)]
Get rid of p_cur_service in dev_rec

Instead of storing the service for pending security requirements when we
pair a new device, we directly store the security requirement.

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

3 years agoBTM_API Shim: Add ShimUi
Martin Brabham [Fri, 21 Aug 2020 05:46:06 +0000 (22:46 -0700)]
BTM_API Shim: Add ShimUi

Create ShimUi class to accept tBTM_APPL_INFO to callback to BTA layer

Bug: 159815595
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: Ifae3a4d72eb919a7468984fbf617c4a6f979c485

3 years agoBTM_API Shim: Add ShimBondListener
Martin Brabham [Fri, 21 Aug 2020 05:08:22 +0000 (22:08 -0700)]
BTM_API Shim: Add ShimBondListener

Create a new class ShimBondListener that accepts the
tBTM_APPL_INFO as a constructor argument.

Bug: 159815595
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: Ifb524cd7af85dba5f5659112437cb5d6284bb8b6

3 years agoLegacy RFCOMM: Use the new security record
Hansong Zhang [Sun, 30 Aug 2020 22:46:34 +0000 (15:46 -0700)]
Legacy RFCOMM: Use the new security record

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

3 years agoIntroduce BTM_SetRfcommSecurity
Hansong Zhang [Sun, 30 Aug 2020 22:29:39 +0000 (15:29 -0700)]
Introduce BTM_SetRfcommSecurity

Store RFCOMM security requirements in a separate map

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

3 years agoRemove unused log to improve readability
Hansong Zhang [Sun, 30 Aug 2020 22:59:18 +0000 (15:59 -0700)]
Remove unused log to improve readability

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

3 years agoOnly RFCOMM Uses btm_sec_mx_access_request
Hansong Zhang [Fri, 28 Aug 2020 22:41:45 +0000 (15:41 -0700)]
Only RFCOMM Uses btm_sec_mx_access_request

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

3 years agoMerge changes I93466084,I1e1ed49c,Id825a84e
Treehugger Robot [Mon, 31 Aug 2020 16:57:00 +0000 (16:57 +0000)]
Merge changes I93466084,I1e1ed49c,Id825a84e

* changes:
  Add API stack/l2cap/l2c_ble::l2cble_conn_comp_from_address_with_type
  Add API stack/acl/btm_acl::acl_link_role_from_handle
  Add btm_identity_addr_to_random_pseudo_from_address_with_type

3 years agoMerge changes I5719d43c,Ia756d0fa,Iba08e90a,Ia5d1b195,I678011f4, ...
Zach Johnson [Mon, 31 Aug 2020 15:27:14 +0000 (15:27 +0000)]
Merge changes I5719d43c,Ia756d0fa,Iba08e90a,Ia5d1b195,I678011f4, ...

* changes:
  Replace unreadable AG state machine
  good riddance AV stream state machine
  Replace AV non state machine function table
  Replace BTA AV state machine
  Flatten bta_hd_sm_execute
  Remove unused parameter from bta_hd_vc_unplug_act
  Remove unused parameter from bta_hd_disconnect_act
  Remove unused parameter from bta_hd_unregister_act
  Replace unreadable HD state machine
  Replace HH unreadable state machine
  BTA_HH_LE_INCLUDED is always true
  Remove unreferenced mce file & headers
  btif_mce_get_interface is never called
  Callbacks are never used
  Remove MCE code that now no longer does anything
  BTA_MceGetRemoteMasInstances does nothing
  bta_mce_get_remote_mas_instances is never referenced
  bta_mce_enable is never referenced
  bta_mce_sm_execute is never referenced
  Remove now unused BTA_MceEnable
  btif_mce_execute_service is never called
  booleans are a thing for a reason
  Simplify BTA_SdpCreate/RemoveRecordByUser
  Simplfy BTA_SdpSearch
  simplify BTA_SdpEnable
  Burninate SDP "state machine"

3 years agoAdd API stack/l2cap/l2c_ble::l2cble_conn_comp_from_address_with_type
Chris Manton [Thu, 27 Aug 2020 16:49:14 +0000 (09:49 -0700)]
Add API stack/l2cap/l2c_ble::l2cble_conn_comp_from_address_with_type

Towards readable code

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

3 years agoAdd API stack/acl/btm_acl::acl_link_role_from_handle
Chris Manton [Mon, 17 Aug 2020 23:09:35 +0000 (16:09 -0700)]
Add API stack/acl/btm_acl::acl_link_role_from_handle

Bug: 162984360
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I1e1ed49c3f0d489c4e087f0520d2626d7d300b94

3 years agoAdd btm_identity_addr_to_random_pseudo_from_address_with_type
Chris Manton [Thu, 27 Aug 2020 17:28:39 +0000 (10:28 -0700)]
Add btm_identity_addr_to_random_pseudo_from_address_with_type

Towards readable code

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

3 years agoAdd API stack/btm/btm_ble::btm_ble_connected_from_address_with_type
Chris Manton [Thu, 27 Aug 2020 16:44:19 +0000 (09:44 -0700)]
Add API stack/btm/btm_ble::btm_ble_connected_from_address_with_type

Towards readable code

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

3 years agoStreamline stack/btm/btm_ble::btm_ble_connected
Chris Manton [Thu, 27 Aug 2020 04:45:19 +0000 (21:45 -0700)]
Streamline stack/btm/btm_ble::btm_ble_connected

Towards readable code

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

3 years agoAdd gd acl init flag
Chris Manton [Wed, 19 Aug 2020 20:36:54 +0000 (13:36 -0700)]
Add gd acl init flag

Tag: #gd-refactor
Bug: 159815595
Test: cert/run --host
Change-Id: If8344697c48a4a68eeb7606905c1d3b14e3da43a

3 years agoMerge "Remove unnecessary command check"
Treehugger Robot [Mon, 31 Aug 2020 03:49:46 +0000 (03:49 +0000)]
Merge "Remove unnecessary command check"

3 years agoRemove unnecessary command check
Chris Manton [Sun, 30 Aug 2020 18:58:51 +0000 (11:58 -0700)]
Remove unnecessary command check

Test fix complements
https://android-review.googlesource.com/c/platform/system/bt/+/1409768

Bug: 155399771
Test: bluetooth_test_gd
--gtest_filter=LeExtendedAdvertisingManagerTest.create_advertiser_tes
Tag: #gd-refactor

Change-Id: I19f37f82624c4daaeea6a2e8f61fdd92ea442d4a

3 years agoReplace unreadable AG state machine
Zach Johnson [Sun, 30 Aug 2020 17:51:38 +0000 (10:51 -0700)]
Replace unreadable AG state machine

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

3 years agogood riddance AV stream state machine
Zach Johnson [Sun, 30 Aug 2020 17:14:36 +0000 (10:14 -0700)]
good riddance AV stream state machine

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

3 years agoAdd new api stack/acl/ble_acl::acl_ble__complete
Chris Manton [Thu, 27 Aug 2020 18:45:27 +0000 (11:45 -0700)]
Add new api stack/acl/ble_acl::acl_ble__complete

Towards readable code

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

3 years agoRemove unused defs
Chris Manton [Thu, 27 Aug 2020 00:58:37 +0000 (17:58 -0700)]
Remove unused defs

Towards readable code

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