OSDN Git Service

android-x86/system-bt.git
3 years agoL2cap scheduler: Implement high priority channel
Hansong Zhang [Fri, 15 Jan 2021 01:55:26 +0000 (17:55 -0800)]
L2cap scheduler: Implement high priority channel

Add a high priority queue for these channels in scheduler.

Introduce MockQueue to help test with BidiQueueEnd callbacks.

Test: cert/run
Test: bluetooth_test_gd
Tag: #gd-refactor
Bug: 141555841
Change-Id: I3b60002f0d2ac2fb4d3307717dce128ccb06247c

3 years agoIntroduce MultiPriorityQueue
Hansong Zhang [Fri, 15 Jan 2021 05:58:27 +0000 (21:58 -0800)]
Introduce MultiPriorityQueue

ACL and L2cap needs to prioritize some link/channels in some cases.  A
traditional priority queue requires predefined comparison, which can be
hard for our use case (PacketBuilder).  Instead, we specify the priority
value when we push to a queue.

Test: bluetooth_test_gd
Tag: #gd-refactor
Bug: 141555841
Change-Id: I33414b4bf81e9f63c88d8627376b565f5c5bb6de

3 years agoRefactor L2CA_SetFixedChannelTout
Hansong Zhang [Thu, 14 Jan 2021 21:00:45 +0000 (13:00 -0800)]
Refactor L2CA_SetFixedChannelTout

It's always used by LE GATT, so let's change it to
L2CA_SetLeGattTimeout.

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

3 years agoMerge changes Ia401bcf0,I724939c1,I606f4aff,I548ee2ad,Iee6c37a7, ...
Zach Johnson [Fri, 15 Jan 2021 15:58:33 +0000 (15:58 +0000)]
Merge changes Ia401bcf0,I724939c1,I606f4aff,I548ee2ad,Iee6c37a7, ...

* changes:
  rusty-gd: update hal facade
  rusty-gd: introduce RxAdapter
  rusty-gd: switch hci facade to grpc context
  rusty-gd: shim & facade are very similar, start sharing code
  rusty-gd: split HAL into control & acl
  rusty-gd: allow parting out injected values

3 years agoMerge "RootCanal: Check PIN on both sides"
Treehugger Robot [Fri, 15 Jan 2021 03:25:46 +0000 (03:25 +0000)]
Merge "RootCanal: Check PIN on both sides"

3 years agoRootCanal: Check PIN on both sides
Myles Watson [Fri, 15 Jan 2021 01:27:27 +0000 (17:27 -0800)]
RootCanal: Check PIN on both sides

Bug: 148864229
Tag: #gd-refactor
Test: cert/run
Change-Id: I54801c552afe6cc1068c9104836fbe4a211d566c

3 years agoMerge "Fix v2 format decoding in btsnooz.py"
Treehugger Robot [Thu, 14 Jan 2021 23:45:21 +0000 (23:45 +0000)]
Merge "Fix v2 format decoding in btsnooz.py"

3 years agoMerge changes I5d0c9f45,I847253d5,I05ec50c5,I4d55a4b3
Zach Johnson [Thu, 14 Jan 2021 20:02:52 +0000 (20:02 +0000)]
Merge changes I5d0c9f45,I847253d5,I05ec50c5,I4d55a4b3

* changes:
  rusty-gd: simplify exported types
  rusty-gd: implement controller shim
  rusty-gd: back message loop thread with rust, if rust enabled
  don't expose main thread message loop

3 years agofix mac build
Zach Johnson [Thu, 14 Jan 2021 19:54:00 +0000 (11:54 -0800)]
fix mac build

Bug: 177491893
Test: compile
Change-Id: Icc181273d8a771bb908dff4d5708fb2b2c38de18

3 years agoMerge "RootCanal: Reject unsolicited PIN responses"
Treehugger Robot [Thu, 14 Jan 2021 18:24:07 +0000 (18:24 +0000)]
Merge "RootCanal: Reject unsolicited PIN responses"

3 years agoAdd callbacks in LE link manager
Hansong Zhang [Thu, 14 Jan 2021 00:29:41 +0000 (16:29 -0800)]
Add callbacks in LE link manager

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

3 years agoMerge "Swich TEST_MAPPING config to unit_tests:true"
Julien Desprez [Thu, 14 Jan 2021 18:01:12 +0000 (18:01 +0000)]
Merge "Swich TEST_MAPPING config to unit_tests:true"

3 years agoL2cap LE shim: Don't match address type
Hansong Zhang [Wed, 13 Jan 2021 23:52:59 +0000 (15:52 -0800)]
L2cap LE shim: Don't match address type

In legacy stack, address type is not used in some L2cap LE APIs.
Matching it might cause problem.  Instead, we use address only, just
like legacy stack.

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

3 years agoRemove unused L2cap shim API
Hansong Zhang [Wed, 13 Jan 2021 20:54:07 +0000 (12:54 -0800)]
Remove unused L2cap shim API

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

3 years agoImplement L2CA_EnableUpdateBleConnParams in shim
Hansong Zhang [Wed, 13 Jan 2021 20:19:24 +0000 (12:19 -0800)]
Implement L2CA_EnableUpdateBleConnParams in shim

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

3 years agoSwich TEST_MAPPING config to unit_tests:true
Julien Desprez [Wed, 13 Jan 2021 20:02:39 +0000 (12:02 -0800)]
Swich TEST_MAPPING config to unit_tests:true

All unit_tests:true are run in presubmit which avoids
the explicit definition of TEST_MAPPING.

Test: presubmit runs all those tests
Bug: 175408655
Change-Id: I4d42ce5da5cdca819e61691475e8645e83942ab1
Merged-In: Ib6e861158b8b9b426b48147b778f49f73c35be9f

3 years agoRootCanal: Reject unsolicited PIN responses
Myles Watson [Thu, 14 Jan 2021 01:36:19 +0000 (17:36 -0800)]
RootCanal: Reject unsolicited PIN responses

Bug: 148864229
Tag: #gd-refactor
Test: cert/run
Change-Id: Ic6bcd706e243ea37e949cefaa77f5fd02e197061

3 years agorusty-gd: update hal facade
Zach Johnson [Wed, 23 Dec 2020 02:02:19 +0000 (18:02 -0800)]
rusty-gd: update hal facade

use RpcContext & RxAdapter

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: Ia401bcf0f4fcf4c14db4c93d96590c88b606c3af

3 years agorusty-gd: introduce RxAdapter
Zach Johnson [Wed, 23 Dec 2020 00:06:15 +0000 (16:06 -0800)]
rusty-gd: introduce RxAdapter

this consolidates logic for dispatching channels over gRPC or callbacks
into legacy

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I724939c1e55312bfb2c33b906252e6df111bd9f5

3 years agorusty-gd: switch hci facade to grpc context
Zach Johnson [Tue, 22 Dec 2020 23:24:40 +0000 (15:24 -0800)]
rusty-gd: switch hci facade to grpc context

this is backed by the tokio runtime, but
we don't need to pass it around

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I606f4aff6c0ad28b9a453a68d41f8b1815196bd2

3 years agorusty-gd: shim & facade are very similar, start sharing code
Zach Johnson [Tue, 22 Dec 2020 23:02:04 +0000 (15:02 -0800)]
rusty-gd: shim & facade are very similar, start sharing code

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I548ee2ad36adc109f48d9572826940ad5eee978e

3 years agorusty-gd: split HAL into control & acl
Zach Johnson [Tue, 22 Dec 2020 22:34:37 +0000 (14:34 -0800)]
rusty-gd: split HAL into control & acl

this way the ACL can bypass the HCI layer entirely

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: Iee6c37a7ffab39546d07a915e80900e748103fea

3 years agorusty-gd: allow parting out injected values
Zach Johnson [Tue, 22 Dec 2020 21:59:28 +0000 (13:59 -0800)]
rusty-gd: allow parting out injected values

this way we can inject only what we actually care about

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I3798084eabb7a8ffcc9a48b982715c792d64ff8d

3 years agorusty-gd: simplify exported types
Zach Johnson [Tue, 22 Dec 2020 08:05:31 +0000 (00:05 -0800)]
rusty-gd: simplify exported types

drop the exports, it's simpler

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost
Change-Id: I5d0c9f45f68ac818c9cd260dc50c325d066e5927

3 years agorusty-gd: implement controller shim
Zach Johnson [Tue, 22 Dec 2020 07:16:48 +0000 (23:16 -0800)]
rusty-gd: implement controller shim

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost
Change-Id: I847253d5b217295a8ae72e124b25a647dc0d96e1

3 years agorusty-gd: back message loop thread with rust, if rust enabled
Zach Johnson [Tue, 22 Dec 2020 02:14:30 +0000 (18:14 -0800)]
rusty-gd: back message loop thread with rust, if rust enabled

the rust code runs in a single threaded environment.
since the main thread is now implicitly running in this environment too,
this means we no longer need to transfer contexts in the shim

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run
Change-Id: I05ec50c525184c29627e1eaff2b62bac0b879416

3 years agoMerge changes Ic8ddcac8,I5f2ae561
Zach Johnson [Wed, 13 Jan 2021 23:13:38 +0000 (23:13 +0000)]
Merge changes Ic8ddcac8,I5f2ae561

* changes:
  rusty-gd: implement custom types & read address in controller
  rusty-gd: implement command sending via HCI shim

3 years agoMerge changes I9f667570,I056a3fdc,I685a3220,I81cdee3a,I7e053cff
Treehugger Robot [Wed, 13 Jan 2021 20:38:03 +0000 (20:38 +0000)]
Merge changes I9f667570,I056a3fdc,I685a3220,I81cdee3a,I7e053cff

* changes:
  Properly use tHCI_STATUS and hci error code equivalence
  Use proper stack/btm/btm_sec::btm_status_text
  gd: Include hci handle in unsuccessful mode change event
  Use proper bta/gatt/bta_gattc_act::gatt_disconnection_reason_text
  Add gatt_disconnection_reason_text

3 years agoL2cap shim: Implement L2CA_GetBleConnRole
Hansong Zhang [Wed, 13 Jan 2021 05:54:54 +0000 (21:54 -0800)]
L2cap shim: Implement L2CA_GetBleConnRole

Note: We haven't routed LE link property callbacks yet.

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

3 years agoRemove unused API L2CA_CancelBleConnectReq
Hansong Zhang [Wed, 13 Jan 2021 05:39:42 +0000 (21:39 -0800)]
Remove unused API L2CA_CancelBleConnectReq

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

3 years agogatt_disconnect: Remove L2CA_CancelBleConnectReq
Hansong Zhang [Wed, 13 Jan 2021 05:15:31 +0000 (21:15 -0800)]
gatt_disconnect: Remove L2CA_CancelBleConnectReq

When the link is not up, we need to cancel create connection.  In this
case, calling L2CA_CancelBleConnectReq() is just removing the gatt
direct connect client CONN_MGR_ID_L2CAP.  Then we clean up tcb.

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

3 years agoRefactor LE disconnnect reason
Hansong Zhang [Wed, 13 Jan 2021 03:06:44 +0000 (19:06 -0800)]
Refactor LE disconnnect reason

When we initiate a disconnection, the reason should always be terminated
by local host.  We only need to check the reason when there is a
disconnection complete HCI event.  Therefore, we can get rid of
L2CA_GetDisconnectReason().

The only GATT app using disconnect reason is HOGP, and the only
interesting state is connection timeout.  Send this event from shim.

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

3 years agoMerge changes I8e04ea0c,Ia710365d
Treehugger Robot [Wed, 13 Jan 2021 19:43:55 +0000 (19:43 +0000)]
Merge changes I8e04ea0c,Ia710365d

* changes:
  gd: Handle data status for extended advertising report
  gd: Handle scan response

3 years agop_clcb->reason is never set
Hansong Zhang [Wed, 13 Jan 2021 01:47:08 +0000 (17:47 -0800)]
p_clcb->reason is never set

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

3 years agoRemove unused data length API
Hansong Zhang [Wed, 13 Jan 2021 00:34:53 +0000 (16:34 -0800)]
Remove unused data length API

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

3 years agoSupport BTM_SetBleDataLength when L2cap shim is on
Hansong Zhang [Wed, 13 Jan 2021 00:22:00 +0000 (16:22 -0800)]
Support BTM_SetBleDataLength when L2cap shim is on

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

3 years agoGATT: Set data length directly
Hansong Zhang [Wed, 13 Jan 2021 00:17:27 +0000 (16:17 -0800)]
GATT: Set data length directly

Since only GATT, hearing aid (hardcoded), JNI (hidden API) can set data
length, we just skip L2cap set data length path, and directly send HCI
command.

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

3 years agoFix v2 format decoding in btsnooz.py
Neil Mayhew [Thu, 10 Dec 2020 03:14:15 +0000 (20:14 -0700)]
Fix v2 format decoding in btsnooz.py

The delta_time_ms field now seems to be 64 bits instead of 32. Without
this change, dumps fail to decode and the script exits with a TypeError
because type_to_hci encounters an unknown packet type.

Bug: 175283029
Test: ./btsnooz.py bugreport-WXYZ.txt
Tag: #refactor
Sponsor: optedoblivion@
Change-Id: Ib893ee63abacf5335a4cbabb1dbdfc1702da77e6

3 years agoClean up BTM_SetBleDataLength
Hansong Zhang [Wed, 13 Jan 2021 00:14:13 +0000 (16:14 -0800)]
Clean up BTM_SetBleDataLength

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

3 years agoSimplify max data length request
Hansong Zhang [Wed, 13 Jan 2021 00:11:26 +0000 (16:11 -0800)]
Simplify max data length request

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

3 years agoBLE_LLT_INCLUDED is always true
Hansong Zhang [Tue, 12 Jan 2021 22:33:30 +0000 (14:33 -0800)]
BLE_LLT_INCLUDED is always true

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

3 years agoClean up L2CA_UpdateBleConnParams
Hansong Zhang [Tue, 12 Jan 2021 21:03:29 +0000 (13:03 -0800)]
Clean up L2CA_UpdateBleConnParams

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

3 years agogd: Handle data status for extended advertising report
Chienyuan [Tue, 12 Jan 2021 14:34:44 +0000 (22:34 +0800)]
gd: Handle data status for extended advertising report

Tag: #gd-refactor
Bug: 177044452
Test: gd/cert/run --host
Change-Id: I8e04ea0cb1b8df795fdd4287a56262ac211c4f16

3 years agogd: Handle scan response
Chienyuan [Mon, 11 Jan 2021 14:25:11 +0000 (22:25 +0800)]
gd: Handle scan response

Tag: #gd-refactor
Bug: 177044452
Test: gd/cert/run --host
Change-Id: Ia710365dba1901803fd8c85d3cecb27f22d25bc5

3 years agoProperly use tHCI_STATUS and hci error code equivalence
Chris Manton [Fri, 8 Jan 2021 06:52:59 +0000 (22:52 -0800)]
Properly use tHCI_STATUS and hci error code equivalence

These values are overloaded for both status and reason.

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I9f6675707d67811468aab66d0515d68c1cc83ab3

3 years agoUse proper stack/btm/btm_sec::btm_status_text
Chris Manton [Wed, 13 Jan 2021 01:33:53 +0000 (17:33 -0800)]
Use proper stack/btm/btm_sec::btm_status_text

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I056a3fdc52a0b9f70f9da44a01f5ee0ebb897dc0

3 years agogd: Include hci handle in unsuccessful mode change event
Chris Manton [Wed, 13 Jan 2021 01:19:57 +0000 (17:19 -0800)]
gd: Include hci handle in unsuccessful mode change event

Bug: 177296647
Test: cert
Tag: #refactor
Change-Id: I685a32202edbf95ee285cc577497ea0d0f18e036

3 years agoUse proper bta/gatt/bta_gattc_act::gatt_disconnection_reason_text
Chris Manton [Wed, 13 Jan 2021 01:33:30 +0000 (17:33 -0800)]
Use proper bta/gatt/bta_gattc_act::gatt_disconnection_reason_text

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I81cdee3a3ececda20bbc882c8892be945c72cb94

3 years agoAdd gatt_disconnection_reason_text
Chris Manton [Fri, 8 Jan 2021 06:52:53 +0000 (22:52 -0800)]
Add gatt_disconnection_reason_text

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I7e053cff0cb1ca3c2a418e2d1ae362bbc02c22e4

3 years agoMerge "gd: Set scan response data based on AdvertisingType"
Treehugger Robot [Wed, 13 Jan 2021 06:22:34 +0000 (06:22 +0000)]
Merge "gd: Set scan response data based on AdvertisingType"

3 years agoMerge changes I442176d1,Ib147e50a,I9f4de837,Ib9cd95d0
Zach Johnson [Wed, 13 Jan 2021 04:45:23 +0000 (04:45 +0000)]
Merge changes I442176d1,Ib147e50a,I9f4de837,Ib9cd95d0

* changes:
  rusty-gd: most of the HCI shim layer
  move le_advertising_manager_test over to PyHci
  Emit checker for command status opcodes, remove unnecessary overloads
  HciLayerFacade -> HciFacade

3 years agodon't expose main thread message loop
Zach Johnson [Mon, 21 Dec 2020 23:10:28 +0000 (15:10 -0800)]
don't expose main thread message loop

ensure all calls go through the actual API

(will back message loop thread with rust's tokio runtime if running
with rust, to reduce thread transfer overhead at shim boundary)

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run
Change-Id: I4d55a4b35a620d63638004cb0e553bbcc04dd69b

3 years agorusty-gd: implement custom types & read address in controller
Zach Johnson [Mon, 21 Dec 2020 22:34:40 +0000 (14:34 -0800)]
rusty-gd: implement custom types & read address in controller

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: Ic8ddcac8fa2738e1282ca853a27450a56f1b54c7

3 years agorusty-gd: most of the HCI shim layer
Zach Johnson [Mon, 21 Dec 2020 18:01:45 +0000 (10:01 -0800)]
rusty-gd: most of the HCI shim layer

(command sending not connected yet)

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I442176d1e29485dab56dcaba53f0975de144a1fb

3 years agorusty-gd: implement command sending via HCI shim
Zach Johnson [Mon, 21 Dec 2020 20:06:40 +0000 (12:06 -0800)]
rusty-gd: implement command sending via HCI shim

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I5f2ae5613b395a57bd23f7772912383b5473d47b

3 years agomove le_advertising_manager_test over to PyHci
Zach Johnson [Sat, 19 Dec 2020 03:29:07 +0000 (19:29 -0800)]
move le_advertising_manager_test over to PyHci

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run
Change-Id: Ib147e50a91dd0c9d31905317028e267ff2b71070

3 years agoEmit checker for command status opcodes, remove unnecessary overloads
Zach Johnson [Fri, 18 Dec 2020 22:00:37 +0000 (14:00 -0800)]
Emit checker for command status opcodes, remove unnecessary overloads

simplifies python, facades, etc

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run
Change-Id: I9f4de8373efb9bf07c55bcab9a7bc31a473d9c25

3 years agoHciLayerFacade -> HciFacade
Zach Johnson [Fri, 18 Dec 2020 21:08:26 +0000 (13:08 -0800)]
HciLayerFacade -> HciFacade

Layer is redundant

Bug: 171749953
Tag: #gd-refactor
Test: cert/run
Change-Id: Ib9cd95d069a57e590fa2b4c8b438ab01951d4ec6

3 years agoClean up BTA_GATTC_Open
Hansong Zhang [Tue, 12 Jan 2021 21:24:38 +0000 (13:24 -0800)]
Clean up BTA_GATTC_Open

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

3 years agoBTM_Sec: AUTHENTICATE should imply MITM
Hansong Zhang [Tue, 12 Jan 2021 07:48:47 +0000 (23:48 -0800)]
BTM_Sec: AUTHENTICATE should imply MITM

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

3 years agoL2cap: Pass remote features to btm_sec
Hansong Zhang [Tue, 12 Jan 2021 05:49:01 +0000 (21:49 -0800)]
L2cap: Pass remote features to btm_sec

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

3 years agoShim hack: Add SCO disconnect callback
Hansong Zhang [Tue, 12 Jan 2021 01:30:34 +0000 (17:30 -0800)]
Shim hack: Add SCO disconnect callback

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

3 years agoL2cap LE shim: Use link property listener
Hansong Zhang [Mon, 11 Jan 2021 23:00:21 +0000 (15:00 -0800)]
L2cap LE shim: Use link property listener

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

3 years agoLE: Add link property listener and phy update
Hansong Zhang [Mon, 11 Jan 2021 21:15:15 +0000 (13:15 -0800)]
LE: Add link property listener and phy update

Add L2cap LE LinkPropertyListener.
Add PHY update listener for ACL and L2cap.

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

3 years agoMerge changes I48f17bc8,I46294bbf,I74d0b45a,I749eb082,I71224efc, ...
Treehugger Robot [Tue, 12 Jan 2021 20:38:12 +0000 (20:38 +0000)]
Merge changes I48f17bc8,I46294bbf,I74d0b45a,I749eb082,I71224efc, ...

* changes:
  gd_acl: Add ACL connection history
  Add gd/common/strings::StringFormatTimeWithMilliseconds
  bt_headless: Add connect/disconnect timeouts
  Include BTM_PmRegister::callback
  Use main/shim/dumpsys::supervision_timeout_to_seconds
  Add main/shim/dumpsys::supervision_timeout_to_seconds
  bt_headless: Add connect test

3 years agogd_acl: Add ACL connection history
Chris Manton [Fri, 8 Jan 2021 17:59:25 +0000 (09:59 -0800)]
gd_acl: Add ACL connection history

Towards discoverable code

Bug: 176960731
Tag: #refactor
Test: gd/cert/run

Change-Id: I48f17bc8826530a998e4f11d1eecf32574e6ad88

3 years agoAdd gd/common/strings::StringFormatTimeWithMilliseconds
Chris Manton [Sat, 9 Jan 2021 00:52:30 +0000 (16:52 -0800)]
Add gd/common/strings::StringFormatTimeWithMilliseconds

Also fix local/gm timezone test issue

Towards loggable code

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

Change-Id: I46294bbf69754be3bf4749fa1bb31320606659cf

3 years agobt_headless: Add connect/disconnect timeouts
Chris Manton [Fri, 8 Jan 2021 18:16:21 +0000 (10:16 -0800)]
bt_headless: Add connect/disconnect timeouts

Towards testable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I74d0b45a737efcbe1f855346d08a07e085e56107

3 years agoInclude BTM_PmRegister::callback
Chris Manton [Fri, 8 Jan 2021 18:15:45 +0000 (10:15 -0800)]
Include BTM_PmRegister::callback

Condition using tBTM_PM_REGISTER::

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I749eb082092adebdd441784db6f829c912839000

3 years agoUse main/shim/dumpsys::supervision_timeout_to_seconds
Chris Manton [Thu, 7 Jan 2021 22:51:59 +0000 (14:51 -0800)]
Use main/shim/dumpsys::supervision_timeout_to_seconds

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I71224efcf0026f69e83d19b711590f2222b80f92

3 years agoAdd main/shim/dumpsys::supervision_timeout_to_seconds
Chris Manton [Thu, 7 Jan 2021 22:50:02 +0000 (14:50 -0800)]
Add main/shim/dumpsys::supervision_timeout_to_seconds

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: Icd73d874a7143efdf33383ad3b096305c21d98b8

3 years agobt_headless: Add connect test
Chris Manton [Thu, 7 Jan 2021 22:37:00 +0000 (14:37 -0800)]
bt_headless: Add connect test

Towards testable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I91eafe7e8047638581dcda75f60527572d842ec6

3 years agoIncrease RFC_MCB_RELEASE_INACT_TIMER to 20 seconds
Hansong Zhang [Tue, 12 Jan 2021 07:22:33 +0000 (23:22 -0800)]
Increase RFC_MCB_RELEASE_INACT_TIMER to 20 seconds

Say we first connect to a remote device using RFCOMM.  The remote
decides to bond with us before we establish a channel.  This could take
longer than 2 seconds.

In the past we handle this before we create L2cap channel.  However,
re-bond can happen during RFCOMM session, because security requirement
might have changed.

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

3 years agogd: Set scan response data based on AdvertisingType
Chienyuan [Mon, 11 Jan 2021 14:14:53 +0000 (22:14 +0800)]
gd: Set scan response data based on AdvertisingType

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

3 years agoMerge changes from topic "Refactor StartScan/StopScan for GD"
Treehugger Robot [Tue, 12 Jan 2021 01:59:25 +0000 (01:59 +0000)]
Merge changes from topic "Refactor StartScan/StopScan for GD"

* changes:
  gd: replace old scan APIs and refactor tests
  gd: Implement basic scan function

3 years agoInclude stack/gatt/gatt_db::stack/btm/btm_ble_int
Chris Manton [Mon, 11 Jan 2021 23:33:31 +0000 (15:33 -0800)]
Include stack/gatt/gatt_db::stack/btm/btm_ble_int

Broken yukawa build

Bug: 177256931
Test: Builds and compiles
Tag: #refactor
Change-Id: Icc5e6bf1a5c936b5de390abe719d84b2836b0169

3 years agoMerge changes Ice686602,I577c366c
Zach Johnson [Mon, 11 Jan 2021 23:46:29 +0000 (23:46 +0000)]
Merge changes Ice686602,I577c366c

* changes:
  rusty-gd: some facade cleanup
  rusty-gd: add le events to facade

3 years agobtm_process_clk_off_comp_evt is no-op
Hansong Zhang [Sat, 9 Jan 2021 00:24:37 +0000 (16:24 -0800)]
btm_process_clk_off_comp_evt is no-op

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

3 years agoMerge "gatt: Extend Bluetooth GATT API with eatt support"
Jakub Pawlowski [Mon, 11 Jan 2021 22:28:49 +0000 (22:28 +0000)]
Merge "gatt: Extend Bluetooth GATT API with eatt support"

3 years agoLE L2cap security enforcement interface minor fix
Hansong Zhang [Sat, 9 Jan 2021 00:23:44 +0000 (16:23 -0800)]
LE L2cap security enforcement interface minor fix

Move the code for default impl.

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

3 years agoImplement robust caching (client)
HsingYuan Lo [Mon, 11 Jan 2021 10:14:48 +0000 (18:14 +0800)]
Implement robust caching (client)

Flag:
- Use flag to enable/disable robust caching on client side

When receiving service changed indication
- set read_db_hash flag to true

Read db hash function and response handler
- add bta_gattc_read_db_hash
- add bta_gattc_read_db_hash_cmpl
  - reset read_db_hash flag
  - If hash match, set states of all related clcb back to CONN_ST
  - If hash not match, start service discovery

When start service discovery is called
- read db hash first if read_db_hash flag is on
- start service discovery immediately if above request is rejected
- start service discovery immediately if read_db_hash flag is off

When receiving response during discover state
- call bta_gattc_read_db_hash_cmpl,
    if BTA_GATTC_DISCOVER_REQ_READ_DB_HASH is set
- call bta_gattc_read_ext_prop_desc_cmpl,
    if BTA_GATTC_DISCOVER_REQ_READ_EXT_PROP_DESC is set

When DATABASE OUT OF SYNC is received during connected state
- send the error(0x12) to application layer
- start service discovery immediately

When DATABASE OUT OF SYNC is received during discover state
- if the retry count exceeds the limit, do nothing
- otherwise restart service discovery again, and increase the retry count

When service discovery is completed (bta_gattc_explore_srvc_finished)
- if result is GATT_SUCCESS, reset the count to zero

Bug: 154056389
Test: compile & verify gatt client behavior
Tag: #feature
Change-Id: I8e3e03302c03f49bda40f0ec20ad5c607ef6dcdf

3 years agoL2cap: Reroute link callbacks to new listener
Hansong Zhang [Fri, 8 Jan 2021 23:53:03 +0000 (15:53 -0800)]
L2cap: Reroute link callbacks to new listener

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

3 years agoL2cap: Send link callbacks to listener
Hansong Zhang [Fri, 8 Jan 2021 23:19:16 +0000 (15:19 -0800)]
L2cap: Send link callbacks to listener

Send OnRoleChange, OnReadClockOffset, OnModeChange, OnModeChange to
listener.

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

3 years agoIntroduce L2cap classic link property listener
Hansong Zhang [Fri, 8 Jan 2021 20:53:29 +0000 (12:53 -0800)]
Introduce L2cap classic link property listener

For shim, and some other module in the future, to receive some link
callbacks, which are for non-security purposes.

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

3 years agoRe-log stack/btm/btm_dev::btm_sec_alloc_dev
Chris Manton [Thu, 7 Jan 2021 22:31:44 +0000 (14:31 -0800)]
Re-log stack/btm/btm_dev::btm_sec_alloc_dev

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I63bd3eb1a9fca3e2df3257bc4c3d899f1bb07380

3 years agoProperly include stack/btm/btm_sec::smp_int.h
Chris Manton [Thu, 7 Jan 2021 21:52:27 +0000 (13:52 -0800)]
Properly include stack/btm/btm_sec::smp_int.h

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I305c6e994fa4400ca3418f27b3af6aa20f38927b

3 years agoComplete stack/include/btm_client_interface::<BTM interface>
Chris Manton [Thu, 7 Jan 2021 21:11:11 +0000 (13:11 -0800)]
Complete stack/include/btm_client_interface::<BTM interface>

Towards modular code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I3c5e80a2b0745d847e09be0390176d2d8337f777

3 years agoAdd LOG_TAG stack/avct/avct_bcb_act::bluetooth
Chris Manton [Wed, 6 Jan 2021 22:11:45 +0000 (14:11 -0800)]
Add LOG_TAG  stack/avct/avct_bcb_act::bluetooth

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I0d885ccead7b0ef814d33bf6d0961a0376c10e10

3 years agoAdd stack/btm/btm_sec::NotifyBondingCanceled
Chris Manton [Tue, 5 Jan 2021 01:24:22 +0000 (17:24 -0800)]
Add stack/btm/btm_sec::NotifyBondingCanceled

Towards encapsulated code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I5a582d71c9637caf4985790aef32aafd71c21e3e

3 years agoUn-include stack/l2cap/l2c_link declare explictly
Chris Manton [Fri, 4 Dec 2020 16:42:44 +0000 (08:42 -0800)]
Un-include stack/l2cap/l2c_link declare explictly

Towards modular code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I81e882d6c9b8941390b985b017c74a3d0f31bd21

3 years agoRe-log btif/src/btif_av::btif_av_handle_event
Chris Manton [Fri, 4 Dec 2020 16:40:59 +0000 (08:40 -0800)]
Re-log btif/src/btif_av::btif_av_handle_event

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run
No-Typo-Check: Legacy terminology

Change-Id: I42597fc1d95fd47358433ec18ced3f41b08b06c8

3 years agoRe-log stack/gatt/gatt_api::GATTC_ConfigureMTU
Chris Manton [Sat, 2 Jan 2021 19:11:27 +0000 (11:11 -0800)]
Re-log stack/gatt/gatt_api::GATTC_ConfigureMTU

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I30f1d93eea21c74f8e8b59c66787f0e4d56de12a

3 years agoCanonicalize stack/gatt/gatt_attr::gatt_profile_cback
Chris Manton [Sat, 21 Nov 2020 01:34:39 +0000 (17:34 -0800)]
Canonicalize stack/gatt/gatt_attr::gatt_profile_cback

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I7dafaa0c6e624ada14f0f0beabc6ee2a123a2e0c

3 years agoUse proper API main/shim/acl::BTM_LogHistory
Chris Manton [Mon, 21 Dec 2020 18:44:20 +0000 (10:44 -0800)]
Use proper API main/shim/acl::BTM_LogHistory

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: Iab4c4278a02e2d0dff4f4e40a18911dee2620c5b

3 years agoRe-log btif/src/btif_dm::btif_dm_proc_loc_oob
Chris Manton [Sat, 7 Nov 2020 02:39:32 +0000 (18:39 -0800)]
Re-log btif/src/btif_dm::btif_dm_proc_loc_oob

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I4024f1e1e5c572e51073021502079bc97199157c

3 years agoCanonicalize btif/src/btif_gatt::btgattInterface
Chris Manton [Thu, 19 Nov 2020 21:55:48 +0000 (13:55 -0800)]
Canonicalize btif/src/btif_gatt::btgattInterface

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I23c55595082991614ce445405fa46514cbbda5c5

3 years agoMerge "Updateability: Remove IBluetoothHeadsetPhone aidl"
Chen Chen [Mon, 11 Jan 2021 19:00:45 +0000 (19:00 +0000)]
Merge "Updateability: Remove IBluetoothHeadsetPhone aidl"

3 years agogatt: Extend Bluetooth GATT API with eatt support
Łukasz Rymanowski [Wed, 19 Aug 2020 12:51:19 +0000 (14:51 +0200)]
gatt: Extend Bluetooth GATT API with eatt support

Tag: #feature
Test: manually verified against device supporting EATT
Bug: 159786353
Sponsor: jpawlowski@
Change-Id: Ib128308b08fcb047b123480434009b45a65f8e1f

3 years agogd: replace old scan APIs and refactor tests
Chienyuan [Fri, 8 Jan 2021 09:45:35 +0000 (17:45 +0800)]
gd: replace old scan APIs and refactor tests

Tag: #gd-refactor
Bug: 177044452
Test: gd/cert/run --host
Change-Id: Ic54f0eba9e4783ea8c34e28f11f07b3b94a46fcb

3 years agogd: Implement basic scan function
Chienyuan [Thu, 7 Jan 2021 13:22:03 +0000 (21:22 +0800)]
gd: Implement basic scan function

Tag: #refactor
Bug: 169390539
Test: gd/cert/run --host
Change-Id: Ifb4ea21a4cdab2d3587a9d5d4cf1255be536b231