OSDN Git Service

android-x86/system-bt.git
3 years agoMerge changes Ia06fbdda,I08306608,I8e43aee4
Treehugger Robot [Sat, 13 Mar 2021 04:21:44 +0000 (04:21 +0000)]
Merge changes Ia06fbdda,I08306608,I8e43aee4

* changes:
  HCI: Use 0x0123 for hex
  HCI: Add more PDL tests
  Only pad the previous field

3 years agoLog command status error conditions
Chris Manton [Fri, 12 Mar 2021 03:01:53 +0000 (19:01 -0800)]
Log command status error conditions

Bug: 182524282
Test: Manual verification on failing scenario
Tag: #refactor
Change-Id: Ia76e97648c8091e2bde5a26b307d2779c21e6640

3 years agoHCI: Use 0x0123 for hex
Myles Watson [Fri, 12 Mar 2021 05:44:08 +0000 (21:44 -0800)]
HCI: Use 0x0123 for hex

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
Tag: #gd-refactor
Change-Id: Ia06fbdda9101b77204c6ee3ba1c8c1edc81aa3bf

3 years agoHCI: Add more PDL tests
Myles Watson [Thu, 11 Mar 2021 21:10:23 +0000 (13:10 -0800)]
HCI: Add more PDL tests

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
Tag: #gd-refactor
Change-Id: I083066083a519c19a8d5c3a4928b306e2495c512

3 years agoOnly pad the previous field
Myles Watson [Thu, 11 Mar 2021 18:05:47 +0000 (10:05 -0800)]
Only pad the previous field

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
      bluetooth_packet_parser_test
Tag: #gd-refactor
Change-Id: I8e43aee420be58af81cd9f47fcf53a566af1b3fa

3 years agoMerge changes I389b26d7,I0a668115,I75ef0b5c
Myles Watson [Fri, 12 Mar 2021 17:12:01 +0000 (17:12 +0000)]
Merge changes I389b26d7,I0a668115,I75ef0b5c

* changes:
  Alias iterator in packet-gen
  Use generic type for JsonParser
  Change dynamic_cast to static_cast

3 years agoAlias iterator in packet-gen
Erwin Jansen [Thu, 11 Mar 2021 22:53:15 +0000 (14:53 -0800)]
Alias iterator in packet-gen

The msvc compiler is unable to translate some of the generated code:

error: no viable conversion from 'std::array<uint8_t, 248>::iterator'
(aka '_Array_iterator<unsigned char, 248ULL>') to 'uint8_t *' (aka
'unsigned char *')

Instead of assigning the value to a ptr, we alias the iterator instead.

Test: atest bluetooth_test_gd
Tag: #gd-refactor
Bug: 182505215
Change-Id: I389b26d71ef5bd8f96ae819d34ce11590f14a5e6

3 years agoMerge "PDL: For the Rust test, clone structs"
Treehugger Robot [Fri, 12 Mar 2021 02:51:43 +0000 (02:51 +0000)]
Merge "PDL: For the Rust test, clone structs"

3 years agoMerge changes I86da8ca8,Ibb58fae9,I9c6a9fa3,I4d1ab599,I818c0f4a, ...
Treehugger Robot [Fri, 12 Mar 2021 02:19:33 +0000 (02:19 +0000)]
Merge changes I86da8ca8,Ibb58fae9,I9c6a9fa3,I4d1ab599,I818c0f4a, ...

* changes:
  Change libbt-platform-protos dependency
  Update the readme to use build.py and explain Rust
  Add build.py to simplify building locally
  Build support for Rust via Cargo
  Add option to build libbluetooth as staticlib
  Prevent building some codecs when not supported
  Build support and abstractions for Linux build
  Add source_root parameter to bluetooth_packetgen
  Fix bison 3.7 incompatability
  Host tools support

3 years agoMerge "HCI PDL: Fix formatting with spaces"
Treehugger Robot [Thu, 11 Mar 2021 22:53:00 +0000 (22:53 +0000)]
Merge "HCI PDL: Fix formatting with spaces"

3 years agoMerge "Unbind cert_self_test from ACTS"
Jizheng Chu [Thu, 11 Mar 2021 21:42:47 +0000 (21:42 +0000)]
Merge "Unbind cert_self_test from ACTS"

3 years agoPDL: For the Rust test, clone structs
Myles Watson [Tue, 9 Mar 2021 23:44:43 +0000 (15:44 -0800)]
PDL: For the Rust test, clone structs

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
Tag: #gd-refactor
Change-Id: Id3e8ddca497fb0014bfcac1c96b465dede4c6995

3 years agoHCI PDL: Fix formatting with spaces
Myles Watson [Tue, 9 Mar 2021 21:57:18 +0000 (13:57 -0800)]
HCI PDL: Fix formatting with spaces

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
Tag: #gd-refactor
Change-Id: Ifd4d681fe95664cec639bab800bec73c26b1d3a4

3 years agoUse generic type for JsonParser
Erwin Jansen [Thu, 11 Mar 2021 17:42:20 +0000 (09:42 -0800)]
Use generic type for JsonParser

The android emulator team uses a newer libchrome library. The json read
method now returns an Optional type, vs. a unique_ptr.

We now let the compiler infer the type and rely on the operators to do
the right thing.

Change-Id: I0a668115659d6508344190783b7dc55d84374f15
Test: System compiles.
Bug: 182487647

3 years agoChange dynamic_cast to static_cast
Erwin Jansen [Sun, 7 Mar 2021 21:01:06 +0000 (13:01 -0800)]
Change dynamic_cast to static_cast

dynamic_cast requires type information at run time to throw exceptions.
This is not available in the emulator build system, where execeptions
are explicitly disabled.

Instead we use static_cast to downcast.

Change-Id: I75ef0b5c694320fc1e9fe648e8087e4def8cdf94
Test: Build succeeds.

3 years agoShim Scanning: Update address type and device type to storage
Chienyuan [Thu, 11 Mar 2021 11:39:08 +0000 (19:39 +0800)]
Shim Scanning: Update address type and device type to storage

Tag: #gd-refactor
Bug: 182243613
Test: gd/cert/run
Test: manual, pair LE device with public address
Change-Id: I8a9a0873dbdf4e8fd85f12ae7f0b2d911f5a47dc

3 years agoMerge "rusty-gd: Use a sequenced runner to post closures."
Qasim Javed [Thu, 11 Mar 2021 01:59:20 +0000 (01:59 +0000)]
Merge "rusty-gd: Use a sequenced runner to post closures."

3 years agoGD: Open a pid file when stack is running
Hansong Zhang [Thu, 4 Mar 2021 02:08:42 +0000 (18:08 -0800)]
GD: Open a pid file when stack is running

So that some other manager process can detect it

Test: cert/run
Bug: 181590011
Tag: #refactor
Change-Id: I340b5d25b4374d47c8c769d80fcd287b23696202

3 years agorusty-gd: Use a sequenced runner to post closures.
Qasim Javed [Tue, 9 Mar 2021 21:30:01 +0000 (13:30 -0800)]
rusty-gd: Use a sequenced runner to post closures.

With this, I am able to reconnect to Pixel Buds successfully.

Previously, there was a crash due CHECK(ThreadTaskRunner::IsSet())
failing.

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost DirectHciTest

Change-Id: I43ad40b03a63bdec5284c584216671bd3ae20376

3 years agoMerge "Remove log.h from mock file"
Weichin Weng [Wed, 10 Mar 2021 02:04:26 +0000 (02:04 +0000)]
Merge "Remove log.h from mock file"

3 years agoMove Common Criteria mode dependency to Android only.
weichinweng [Fri, 5 Mar 2021 06:12:09 +0000 (14:12 +0800)]
Move Common Criteria mode dependency to Android only.

Bug: 181293964
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I92deb21350f9ec963d7d5985aed31563b7384bbd

3 years agoRemove log.h from mock file
weichinweng [Mon, 8 Mar 2021 12:08:30 +0000 (20:08 +0800)]
Remove log.h from mock file

Bug: 181293964
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I89356bb39fa0fe5cc70d8ee17a28699275a32126

3 years agoMerge "Fix handshaking error between HCI driver and rootcanal"
JaeMan Park [Wed, 10 Mar 2021 00:04:51 +0000 (00:04 +0000)]
Merge "Fix handshaking error between HCI driver and rootcanal"

3 years agoMerge "Revert "Put stack vars in proper scope""
Chris Manton [Tue, 9 Mar 2021 22:13:27 +0000 (22:13 +0000)]
Merge "Revert "Put stack vars in proper scope""

3 years agoMerge changes I40975081,Ia1fe07b4,Ieffc9874
Myles Watson [Tue, 9 Mar 2021 22:08:18 +0000 (22:08 +0000)]
Merge changes I40975081,Ia1fe07b4,Ieffc9874

* changes:
  PDL: Add example test packets
  Rust: Add a packet test
  PDL: Add support for test

3 years agoRevert "Put stack vars in proper scope"
Chris Manton [Tue, 9 Mar 2021 20:36:21 +0000 (12:36 -0800)]
Revert "Put stack vars in proper scope"

Bug: 182259591
Test: Builds and compiles
Tag: #refactor

This reverts commit 3318a1ce16a4fdb3d7a2c4bfc4e9dfe407839d3f.

Change-Id: I25771c2c40089fc46ebce256c0ae1344ac6af2c4

3 years agoSend response as combined form
Jeongik Cha [Tue, 9 Mar 2021 05:41:07 +0000 (14:41 +0900)]
Send response as combined form

As-is: root-canal's response consists of packet type and payload
separately

In the case of several request in parallel, the responses could be
overlapped, so make it combined to avoid the situation.

Test: atest AdapterServiceTest
Bug: 182167189
Change-Id: I19b99f6399777e927b81c26366d8e02ae577936e

3 years agoMerge "Add metric_id_manager to GD using existing Address and LruCache of GD"
Chen Chen [Tue, 9 Mar 2021 01:58:42 +0000 (01:58 +0000)]
Merge "Add metric_id_manager to GD using existing Address and LruCache of GD"

3 years agoPDL: Add example test packets
Myles Watson [Tue, 9 Mar 2021 00:38:57 +0000 (16:38 -0800)]
PDL: Add example test packets

Bug: 182216573
Test: atest libbt_packets_test
Tag: #gd-refactor
Change-Id: I40975081d5d30f7078a432df94b9d0c58410da97

3 years agoRust: Add a packet test
Myles Watson [Tue, 9 Mar 2021 00:37:55 +0000 (16:37 -0800)]
Rust: Add a packet test

Bug: 182216573
Test: atest libbt_packets_test
Tag: #gd-refactor
Change-Id: Ia1fe07b49363b166d164811dd9aaceea05e66d48

3 years agoPDL: Add support for test
Myles Watson [Tue, 9 Mar 2021 00:51:50 +0000 (16:51 -0800)]
PDL: Add support for test

Bug: 182216573
Test: atest libbt_packets_test
Tag: #gd-refactor
Change-Id: Ieffc9874c0ff17cb2a0acb5e9399b6222f585f7c

3 years agoMerge changes Ib81960bb,I1d84f463,Id475e310,I4ba9755c,Ib6f7b4ba, ...
Chris Manton [Tue, 9 Mar 2021 00:19:34 +0000 (00:19 +0000)]
Merge changes Ib81960bb,I1d84f463,Id475e310,I4ba9755c,Ib6f7b4ba, ...

* changes:
  Introduce main_shim_test
  Add main/test::shim mocks
  Add gd/neighbor::inquiry mock
  Add SCO HACK for shim acl mock
  Add gd/hci::controller mock
  gd_acl: Directly access acl manager for SCO hack
  Put stack vars in proper scope
  Return proper type stack/acl/btm_pm::BTM_SetPowerMode
  Explicitly specify status type include/hardware/ble_scanner.h
  Add stack init indirection for activity_attribution
  Use proper tBTM_STATUS types
  Use tBTM_STATUS in stack/l2cap/::
  gd_shim: Log more info about acl queue state
  Add bta_sys post to main alternative method
  Remove unused field srvc_id
  Template prep for bta hardening
  Use btm_status in stack/rfcomm/::
  Use proper types tBLE_SCAN_MODE
  User proper types tBTM_STATUS
  Canonicalize tBTM_APPL_INFO::bta_security
  Streamline bta_av_link_role_ok
  Use canonical include paths
  Add hci code conversion stack/include/hci_error_code
  Remove unused bta/include/bta_api::#defs
  Remove unused API BTM_GetPeerSCA
  Remove unused API BTM_RequestPeerSCA
  Remove unused API BTM_IsPhy2mSupported
  Properly conform tACL_CONN field names
  Add stack/include::BT_HDR rigid struct
  Use proper types tSMP_STATUS
  Properly type stack/smp::tSMP_EVT
  Remove useless extern keyword for definitions
  Remove unused stack/gatt/gatt_int::#defs
  Re-include bta/ag/bta_ag_sdp.cc

3 years agoAdd a way to connect to linux raw HCI HAL
Hansong Zhang [Wed, 3 Mar 2021 23:55:37 +0000 (15:55 -0800)]
Add a way to connect to linux raw HCI HAL

Tag: #refactor
Bug: 181590011
Test: cert/run
Change-Id: I5308fd604b091392b9a8b15154732afeb03dde57

3 years agoIntroduce main_shim_test
Chris Manton [Fri, 5 Mar 2021 20:25:19 +0000 (12:25 -0800)]
Introduce main_shim_test

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

Change-Id: Ib81960bb3065f3964be16ba0feaf22358be8f323

3 years agoAdd main/test::shim mocks
Chris Manton [Fri, 5 Mar 2021 02:53:07 +0000 (18:53 -0800)]
Add main/test::shim mocks

Bug: 181991662
Test: gd/cert/run
Tag: #refactor
No-Typo-Check: Legacy misnamed code

Change-Id: I1d84f463fe1a126f1cc685b10f77f4872088a78d

3 years agoAdd gd/neighbor::inquiry mock
Chris Manton [Fri, 5 Mar 2021 02:52:31 +0000 (18:52 -0800)]
Add gd/neighbor::inquiry mock

Bug: 181991662
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: Id475e31092c884b33bd92b4ee18ff53b7c4d4a03

3 years agoAdd SCO HACK for shim acl mock
Chris Manton [Fri, 5 Mar 2021 22:47:01 +0000 (14:47 -0800)]
Add SCO HACK for shim acl mock

Bug: 181991662
Test: gd/cert/run
Tag: #refactor
Change-Id: I4ba9755c6f482c99bbbc0bd55de22d45d8949815

3 years agoAdd gd/hci::controller mock
Chris Manton [Fri, 5 Mar 2021 02:52:21 +0000 (18:52 -0800)]
Add gd/hci::controller mock

Bug: 181991662
Test: cert
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: Ib6f7b4bada0ae673842f134dc5eb22d9b2bf422d

3 years agogd_acl: Directly access acl manager for SCO hack
Chris Manton [Fri, 5 Mar 2021 16:35:18 +0000 (08:35 -0800)]
gd_acl: Directly access acl manager for SCO hack

Also explicitly log SCO disconnect

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

Change-Id: Ia8fb5408d909c02d01bac5057dd388e1d8909e63

3 years agoPut stack vars in proper scope
Chris Manton [Wed, 3 Mar 2021 01:03:12 +0000 (17:03 -0800)]
Put stack vars in proper scope

Toward refactor-able code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ied75ac91e075d9072875b34f91d91c1191473215

3 years agoReturn proper type stack/acl/btm_pm::BTM_SetPowerMode
Chris Manton [Mon, 1 Mar 2021 18:34:01 +0000 (10:34 -0800)]
Return proper type stack/acl/btm_pm::BTM_SetPowerMode

Toward type safe code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ifdd3fcbd0c149f5d5a8987f6e0a15210d8a6cdc8

3 years agoExplicitly specify status type include/hardware/ble_scanner.h
Chris Manton [Mon, 1 Mar 2021 18:33:30 +0000 (10:33 -0800)]
Explicitly specify status type include/hardware/ble_scanner.h

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ifec58b3e95fe9414b27f1199551b7cb65982ca0b

3 years agoAdd stack init indirection for activity_attribution
Chris Manton [Fri, 5 Mar 2021 21:51:43 +0000 (13:51 -0800)]
Add stack init indirection for activity_attribution

Conforms to peers and is more testable

Bug: 181991662
Test: cert
Tag: #refactor
Change-Id: Ib01c3b35ee5bb0deb370cbbee4d8e88929beb4dc

3 years agoUse proper tBTM_STATUS types
Chris Manton [Tue, 2 Mar 2021 21:30:20 +0000 (13:30 -0800)]
Use proper tBTM_STATUS types

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I7727220d4da93279ed215fa366b528cc859b8525

3 years agoUse tBTM_STATUS in stack/l2cap/::
Chris Manton [Mon, 1 Mar 2021 17:32:24 +0000 (09:32 -0800)]
Use tBTM_STATUS in stack/l2cap/::

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I588780b8301474b01c2c9f52e3d9c2c1b9fdd937

3 years agogd_shim: Log more info about acl queue state
Chris Manton [Thu, 4 Mar 2021 05:46:43 +0000 (21:46 -0800)]
gd_shim: Log more info about acl queue state

Bug: 179649871
Test: cert
Tag: #refactor

Change-Id: I8aaae60224afa28477d8a556ec11b11df06fa5c0

3 years agoAdd bta_sys post to main alternative method
Chris Manton [Wed, 3 Mar 2021 21:46:20 +0000 (13:46 -0800)]
Add bta_sys post to main alternative method

Toward eliminating BTA sys

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Id6b12b2d9744929ebb344fc1caf20c6a8015a525

3 years agoRemove unused field srvc_id
Chris Manton [Wed, 3 Mar 2021 21:45:40 +0000 (13:45 -0800)]
Remove unused field srvc_id

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I3dcaf1e3acacb2fe7754c24c3fd383ddce03bf69

3 years agoTemplate prep for bta hardening
Chris Manton [Mon, 8 Mar 2021 18:05:41 +0000 (10:05 -0800)]
Template prep for bta hardening

Syntactic sugar to wrangle next Union battle

Towards readable code

Bug: 163134718
Test: cert
Tag: #refactor
Change-Id: I5921b2ab188f1062b0c1ad19bf9e2d0e2c8017db

3 years agoUse btm_status in stack/rfcomm/::
Chris Manton [Mon, 1 Mar 2021 17:32:01 +0000 (09:32 -0800)]
Use btm_status in stack/rfcomm/::

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I2e15fca337cbec3e265b7945d59a2fdbb6d178d5

3 years agoUse proper types tBLE_SCAN_MODE
Chris Manton [Wed, 3 Mar 2021 01:03:01 +0000 (17:03 -0800)]
Use proper types tBLE_SCAN_MODE

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I740140779cea143d829d137d8cb8dff4748489cc

3 years agoUser proper types tBTM_STATUS
Chris Manton [Wed, 3 Mar 2021 01:02:42 +0000 (17:02 -0800)]
User proper types tBTM_STATUS

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I495d4d13dfbac92b80c83223687b99763c9381a5

3 years agoCanonicalize tBTM_APPL_INFO::bta_security
Chris Manton [Sun, 28 Feb 2021 07:08:57 +0000 (23:08 -0800)]
Canonicalize tBTM_APPL_INFO::bta_security

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I52cb204abc1b6e42c7239c25211e87772c7c1b8d

3 years agoStreamline bta_av_link_role_ok
Chris Manton [Sun, 28 Feb 2021 04:52:00 +0000 (20:52 -0800)]
Streamline bta_av_link_role_ok

Toward readable code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ic559c133134392b6123a292e991ef933080cb043

3 years agoUse canonical include paths
Chris Manton [Thu, 4 Mar 2021 05:47:09 +0000 (21:47 -0800)]
Use canonical include paths

Toward readable code

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

Change-Id: I5248569747177e3bb169509e34c7053145bfbfda

3 years agoAdd hci code conversion stack/include/hci_error_code
Chris Manton [Mon, 1 Mar 2021 21:54:35 +0000 (13:54 -0800)]
Add hci code conversion stack/include/hci_error_code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ib3aadbecc039df43b6fc6bf4cc603674ecf6b4c0

3 years agoRemove unused bta/include/bta_api::#defs
Chris Manton [Wed, 3 Mar 2021 01:55:28 +0000 (17:55 -0800)]
Remove unused bta/include/bta_api::#defs

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I46b2473c22ea1cf9f111f768d47263c19d2249ae

3 years agoRemove unused API BTM_GetPeerSCA
Chris Manton [Sun, 28 Feb 2021 04:20:44 +0000 (20:20 -0800)]
Remove unused API BTM_GetPeerSCA

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I5050817e500d33265ecd8bfc9ec2b547ab0ff625

3 years agoRemove unused API BTM_RequestPeerSCA
Chris Manton [Sun, 28 Feb 2021 04:18:04 +0000 (20:18 -0800)]
Remove unused API BTM_RequestPeerSCA

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I2bacaee6f567d717065cab643a249072645bc0ba

3 years agoRemove unused API BTM_IsPhy2mSupported
Chris Manton [Sun, 28 Feb 2021 04:14:33 +0000 (20:14 -0800)]
Remove unused API BTM_IsPhy2mSupported

Toward meaningful code

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I3ea1d0538678f7617b8a485c9430ecd0e43741e9

3 years agoProperly conform tACL_CONN field names
Chris Manton [Fri, 5 Mar 2021 00:50:53 +0000 (16:50 -0800)]
Properly conform tACL_CONN field names

And put getters in header

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I544de67b543b272485e8993fc609288703c16bbf

3 years agoAdd stack/include::BT_HDR rigid struct
Chris Manton [Thu, 4 Mar 2021 22:27:37 +0000 (14:27 -0800)]
Add stack/include::BT_HDR rigid struct

Missing the dreaded flexible array member which is embedded
in the middle of so many larger structs

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I7c4f92221b25dc93e6165ed7ab1991529ffc1539

3 years agoUse proper types tSMP_STATUS
Chris Manton [Tue, 2 Mar 2021 17:49:50 +0000 (09:49 -0800)]
Use proper types tSMP_STATUS

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ie0851299d1d4467c4beb60b73405269cf174036a

3 years agoProperly type stack/smp::tSMP_EVT
Chris Manton [Tue, 2 Mar 2021 20:32:50 +0000 (12:32 -0800)]
Properly type stack/smp::tSMP_EVT

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: I9a8cc028eaf994b9b8b94d62ddaae05f4cb038e8

3 years agoAdd metric_id_manager to GD using existing Address and LruCache of GD
Chen Chen [Fri, 5 Mar 2021 00:23:47 +0000 (16:23 -0800)]
Add metric_id_manager to GD using existing Address and LruCache of GD

Test: atest bluetooth_test_gd
Bug: 181819141
Change-Id: I5c4217f91f3bc14dec99486d83353d27fc69c630

3 years agoRemove useless extern keyword for definitions
Chris Manton [Thu, 4 Mar 2021 05:41:15 +0000 (21:41 -0800)]
Remove useless extern keyword for definitions

Messes up my tools

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ic088b46d71dceadbb1ba69f4181cd2f604fb54f7

3 years agoRemove unused stack/gatt/gatt_int::#defs
Chris Manton [Wed, 3 Mar 2021 01:11:38 +0000 (17:11 -0800)]
Remove unused stack/gatt/gatt_int::#defs

Bug: 163134718
Test: cert
Tag: #refactor

Change-Id: Ie2a465efd76aa2b594dbe0bf407176d4819aab1f

3 years agoRe-include bta/ag/bta_ag_sdp.cc
Chris Manton [Mon, 25 Jan 2021 18:04:55 +0000 (10:04 -0800)]
Re-include bta/ag/bta_ag_sdp.cc

Bug: 163134718
Test: cert
Tag: #refactor
Change-Id: I3c7935841504cbc4231f339b8c47a02cfac9ed7f

3 years agoFix handshaking error between HCI driver and rootcanal
JaeMan Park [Mon, 22 Feb 2021 05:42:08 +0000 (14:42 +0900)]
Fix handshaking error between HCI driver and rootcanal

Rootcanal needs to implement response of request
  READ_CLASS_OF_DEVICE
  READ_VOICE_SETTING
  WRITE_CONNECTION_ACCEPT_TIMEOUT

Bug: 180860482
Test: m root-canal
Change-Id: I53e67649c3558ea7d64e6521aa1a602b2245c942

3 years agocommon Criteria mode: Get all bonded devices key after keystore callback init.
weichinweng [Thu, 4 Mar 2021 02:39:56 +0000 (10:39 +0800)]
common Criteria mode: Get all bonded devices key after keystore callback init.

Bug: 181293964
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I25c70363d7651c27a6c15b60db9402eee359d804

3 years agoCommon Criteria mode: Rename Common Criteria mode from NIAP mode (2/2)
weichinweng [Thu, 4 Mar 2021 01:11:30 +0000 (09:11 +0800)]
Common Criteria mode: Rename Common Criteria mode from NIAP mode (2/2)

Bug: 181293964
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I8455403fdfad2451831c6b5d3f9162b7e3a0296d

3 years agoRe-include stack/hid/hidd_conn.cc
Chris Manton [Sat, 23 Jan 2021 19:20:08 +0000 (11:20 -0800)]
Re-include stack/hid/hidd_conn.cc

Bug: 163134718
Test: cert
Tag: #refactor
Change-Id: Idd4aa5471bc96a8df01adf2507e8d6bafed37a4c

3 years agoAvoid potential null dereference
Greg Kaiser [Fri, 5 Mar 2021 16:04:46 +0000 (08:04 -0800)]
Avoid potential null dereference

We move our null check of 'p_dev' to before the first time we
dereference it.

Tag: #stability
Bug: 179741365
Test: TreeHuggger
Change-Id: Iafc45c9f82b88f9f0462f87b029789e861509287

3 years agoMerge "Turn off sanitize options for root-canal for linux_bionic"
Jeongik Cha [Fri, 5 Mar 2021 15:29:21 +0000 (15:29 +0000)]
Merge "Turn off sanitize options for root-canal for linux_bionic"

3 years agoUse cid instead of attribute handle
HsingYuan Lo [Tue, 2 Mar 2021 09:52:40 +0000 (17:52 +0800)]
Use cid instead of attribute handle

Current API is defined as below
void BTA_GATTC_SendIndConfirm(uint16_t conn_id, uint16_t cid)

We need to use cid instead of attribute handle, otherwise when eatt is
enabled, something will happen

Bug: 159786353
Test: compile & make sure the cid is correctly sent to stack
Tag: #feature
Change-Id: If0cd9dd6783af7fefdb7af7130e5e9545188eecd

3 years agoCert test scaffolding for iso layer
Jakub Pawlowski [Tue, 23 Feb 2021 08:19:43 +0000 (09:19 +0100)]
Cert test scaffolding for iso layer

Tag: #feature
Test: cert/run LeIsoTest
Bug: 177907117
Change-Id: Icc23db17d5f6fc8d0fd1f9497a64c99d9f0cfd5e

3 years agostack/test: Fix memory leak in iso tests
Jakub Tyszkowski [Tue, 2 Mar 2021 15:01:59 +0000 (15:01 +0000)]
stack/test: Fix memory leak in iso tests

HCI command buffer should be released after
passing it to the mock bte interface.

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

3 years agoMerge "Bluetooth hal metrics: Add LogBluetoothHalCrashReason"
Treehugger Robot [Fri, 5 Mar 2021 04:35:11 +0000 (04:35 +0000)]
Merge "Bluetooth hal metrics: Add LogBluetoothHalCrashReason"

3 years agoMerge "Exit notification timeouts immediately for disconnected devices"
Sal Savage [Fri, 5 Mar 2021 02:03:42 +0000 (02:03 +0000)]
Merge "Exit notification timeouts immediately for disconnected devices"

3 years agoSome dependencies are host supported
Hansong Zhang [Wed, 3 Mar 2021 01:30:10 +0000 (17:30 -0800)]
Some dependencies are host supported

Bug: 181590011
Tag: #refactor
Test: compile
Change-Id: I247a300c3ba35715b5ddb8c06523e71189ba0ab5

3 years agoAdd host support for libbluetooth.so
Hansong Zhang [Tue, 2 Mar 2021 01:52:04 +0000 (17:52 -0800)]
Add host support for libbluetooth.so

Bug: 181590011
Tag: #refactor
Test: compile
Change-Id: I9a53eeaac5a5c612d47671bca4f95cf252faeb93

3 years agoChange libbt-platform-protos dependency
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:33 +0000 (22:33 +0000)]
Change libbt-platform-protos dependency

Move the dependency to use the target included in
//external/proto_logging instead. This will be provided via cros_workon
for ChromeOS and in the prepared platform-dir for Linux build.

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I86da8ca8e7b666ccdc4cc36680f90083bbe76dfb

3 years agoUpdate the readme to use build.py and explain Rust
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:28 +0000 (22:33 +0000)]
Update the readme to use build.py and explain Rust

Updated the README to build using build.py and explain how the Rust
portion is built on Linux.

Bug: 179821440
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: Ibb58fae9b9ca8aaaf1dcce7c5d33204c46fd9678

3 years agoAdd build.py to simplify building locally
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:25 +0000 (22:33 +0000)]
Add build.py to simplify building locally

This adds a script that can build system/bt locally on your Linux
machine. Please see required folder layout in the script on how to
prepare your environment and check the help text on how to use it.

In its simplest form (for example):
  ./build.py --out ../build --platform-dir ../staging --clang

This will build all of systembt in ../build using the ../staging
directory as your source directory and will use the clang compiler to do
the build.

Bug: 179821440
Tag: #floss
Test: atest --host bluetooth_test_gd

Change-Id: I9c6a9fa30235b2fc661a0fe327154f18a03ca026

3 years agoBuild support for Rust via Cargo
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:21 +0000 (22:33 +0000)]
Build support for Rust via Cargo

ChromeOS is missing support for mixing C++ and Rust in GN so we compile
Rust in a separate step using Cargo. Currently, only the direct code
portions were copied to the Cargo.toml and tests are still missing. The
final output from the Rust build is the libbt_shim_ffi staticlib.

Some BUILD.gn rules for rust libraries were also added (to try to make
it work with an experimental Rust toolchain in GN) but was abandonded
because dependencies couldn't be built. Leaving this in since it will be
useful when GN supports building Rust as well on ChromeOS.

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I4d1ab599309b153b2304cb87c4526bc476dc2637

3 years agoAdd option to build libbluetooth as staticlib
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:18 +0000 (22:33 +0000)]
Add option to build libbluetooth as staticlib

For ChromeOS/Linux, we want to build a static libbluetooth to make it
easier to find build breakages earlier and to simplify some of the build
issues. This change adds a compile time define to choose between using
dlsym to load libbluetooth and using extern to access the symbols
directly.

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I818c0f4a7baf414e73dc6f6ae73bb3e3bc3f357f

3 years agoPrevent building some codecs when not supported
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:14 +0000 (22:33 +0000)]
Prevent building some codecs when not supported

When building outside Android, we may not have support for the non
Bluetooth standard codecs (i.e. everything except SBC). So put all
references to aptx, ldac, aac and vendor codecs inside the
EXCLUDE_NONSTANDARD_CODECS ifdef.

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I80914f2944b5466b88e221ba10ceae4dd30c16cf

3 years agoBuild support and abstractions for Linux build
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:10 +0000 (22:33 +0000)]
Build support and abstractions for Linux build

This has a large number of fixes to build on Linux/ChromeOS. In general,
it is making sure the BUILD.gn and Android.bp for a directory structure
match and it has all the configs + deps needed to build.

Besides a number of simple fixups (missing headers), there are also
a few abstractions that need to be noted:

* All of audio HAL is stubbed out (using the host implementation)
* Parameter provider and system_properties (under gd/os) now have
  a linux variant that changes where configuration files are kept. The
  current location for linux is now /etc/systembt. This implementation
  was copied from the host versions (which seems to be used for host
  testing).

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I1a6b3b362cedbe5f675794a115a330cc7f85f9c1

3 years agoAdd source_root parameter to bluetooth_packetgen
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:07 +0000 (22:33 +0000)]
Add source_root parameter to bluetooth_packetgen

In packetgen, add a source-root parameter that we use to rebase paths
from. This was necessary to get the same directory output structure on
Linux builds with GN.

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I75cdb1693655356ad1470d29a8a45440c775df8f

3 years agoFix bison 3.7 incompatability
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:33:03 +0000 (22:33 +0000)]
Fix bison 3.7 incompatability

On bison 3.7, YYSTYPE and YYLTYPE don't get defined in the header so
define them directly in the lexer

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I02b9b615dc6d013efdace733491e7a73c3e1eb69

3 years agoHost tools support
Abhishek Pandit-Subedi [Tue, 2 Mar 2021 22:32:58 +0000 (22:32 +0000)]
Host tools support

This adds support for the dumpsys bundler tool (which combines multiple
flatbuffer schemas) and the packetgen tool (which converts pdls to
a language parser).

Bug: 176847256
Tag: #floss
Test: atest --host bluetooth_test_gd
Change-Id: I1315979093668f60a476b85f41bb1d707995b2a7

3 years agogd: Fix address manager bug
Chienyuan [Thu, 4 Mar 2021 13:36:50 +0000 (21:36 +0800)]
gd: Fix address manager bug

Tag: #gd-refactor
Bug: 180869951
Test: gd/cert/run
Change-Id: Ia04aea10c686c8c4ec8985f2ba3f3424691ea825

3 years agoBluetooth hal metrics: Add LogBluetoothHalCrashReason
weichinweng [Tue, 15 Dec 2020 06:56:19 +0000 (14:56 +0800)]
Bluetooth hal metrics: Add LogBluetoothHalCrashReason

Add LogBluetoothHalCrashReason function to collect Bluetooth hal crash
reason.

Bug: 174284338
Tag: #feature
Test: atest BluetoothInstrumentationTests
Change-Id: Ibbc465d3145068fdc7f743b67ae4278b4cdf2430

3 years agoMerge "RootCanal: Disable LeExtendedAdvertising"
Myles Watson [Thu, 4 Mar 2021 01:20:12 +0000 (01:20 +0000)]
Merge "RootCanal: Disable LeExtendedAdvertising"

3 years agoRootCanal: Disable LeExtendedAdvertising
Myles Watson [Wed, 3 Mar 2021 23:23:33 +0000 (15:23 -0800)]
RootCanal: Disable LeExtendedAdvertising

Bug: 181783722
Test: cert/run
Tag: #gd-refactor
Change-Id: I1e687b9177211385f62aff39db59c312db3c8c4a

3 years agoMerge "Merge RQ2A.210305.007"
Xin Li [Wed, 3 Mar 2021 21:41:36 +0000 (21:41 +0000)]
Merge "Merge RQ2A.210305.007"

3 years agoMerge RQ2A.210305.007
Xin Li [Tue, 2 Mar 2021 23:49:59 +0000 (15:49 -0800)]
Merge RQ2A.210305.007

Bug: 180401296
Merged-In: I70d48f04611d3bd380b8e29d21e590e69c6bfe0c
Change-Id: If5621cce571c1e580be6a7949f945318482146aa

3 years agoUnbind cert_self_test from ACTS
Jizheng Chu [Wed, 3 Mar 2021 01:23:05 +0000 (17:23 -0800)]
Unbind cert_self_test from ACTS

Test: gd/cert/run CertSelfTest
Change-Id: Ib4722c871746b13a02c86ea55ceb477ed0fa340c

3 years agoRootCanal: Send LeReadRemoteFeatures to LE address
Myles Watson [Tue, 2 Mar 2021 21:46:14 +0000 (13:46 -0800)]
RootCanal: Send LeReadRemoteFeatures to LE address

Bug: 181371297
Test: cert/run DirectHciTest
Tag: #gd-refactor
Change-Id: I8b795c2bb440f98fc840a837e2ab27ef35811558

3 years agoMerge "Shim Scanning: Update device property" am: b2613c875f
Treehugger Robot [Tue, 2 Mar 2021 22:09:33 +0000 (22:09 +0000)]
Merge "Shim Scanning: Update device property" am: b2613c875f

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1609573

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I70d48f04611d3bd380b8e29d21e590e69c6bfe0c