OSDN Git Service

android-x86/system-bt.git
5 years agoCert: implement assert function with event buffer
Chienyuan [Thu, 2 May 2019 20:29:20 +0000 (13:29 -0700)]
Cert: implement assert function with event buffer

Test: run gd/cert/run_cert.sh
Change-Id: I237ecdee7e70b860f3e73d4825dd79b0235ae22b

5 years agoMerge "Module: Add TestModule for dependency injection"
Treehugger Robot [Thu, 2 May 2019 21:21:12 +0000 (21:21 +0000)]
Merge "Module: Add TestModule for dependency injection"

5 years agoModule: Add TestModule for dependency injection
Myles Watson [Thu, 2 May 2019 17:31:26 +0000 (10:31 -0700)]
Module: Add TestModule for dependency injection

Test: HciLayerTest
Change-Id: I32dbfaa051be5cb42adb7a081b37966479df5268

5 years agoCert: add common helper for event stream on the py side
Chienyuan [Tue, 30 Apr 2019 23:21:32 +0000 (16:21 -0700)]
Cert: add common helper for event stream on the py side

* add common helper for event stream on the py side, implement
  assert_event_occurs in the helper
* add event stream helpers for hci event, sco and acl in GdDevice
* add take_for() function in BlockingQueue for take data with timeout

Test: run gd/cert/run_cert.sh
Change-Id: Ia8168159ee47441ec332046627124e0ed3811d6b

5 years agoMake SnoopLogger a Module
Hansong Zhang [Tue, 30 Apr 2019 21:52:43 +0000 (14:52 -0700)]
Make SnoopLogger a Module

* Add API SnoopLogger::SetFilePath to set output file path
* Add return code check for GdDevice backing process and rootcanal

Test: cert/run_cert.sh
Change-Id: Iac33070d4ac880d50a0dd78ad75f7ac7ccc239b2

5 years agoRootcanal: Exit local loopback mode on HciReset
Hansong Zhang [Tue, 30 Apr 2019 17:51:27 +0000 (10:51 -0700)]
Rootcanal: Exit local loopback mode on HciReset

In Bluetooth code spec v5.1 Vol 2 Part E 7.6.2, it states "the commands
HCI_Reset and HCI_Write_Loopback_Mode can be used to exit Local Loopback
mode".

In HAL cert test, enter local loopback mode, reset, and check whether
local loopback mode.

Test: cert/run_cert.sh
Bug: 131625008
Change-Id: I79546b202affe8ccd48b10e230cf73465324b409

5 years agoRootcanal HCI HAL: Set read from socket blocking
Hansong Zhang [Tue, 30 Apr 2019 18:10:47 +0000 (11:10 -0700)]
Rootcanal HCI HAL: Set read from socket blocking

In HciSocketDevice::SendHci, rootcanal first writes to HCI socket one
byte HCI packet type first, then HCI packet body. When the stack
receives the first byte, it tries to read the entire packet, but
sometimes the rest of packet was not delivered yet, so the stack will
crash. Instead, the stack should be blocked until all bytes are read,
with a 3 second timeout when rootcanal can't deliver all bytes to stack.

Test: try cert/run_cert.sh multiple times
Bug: 131625008
Change-Id: I99df53c658717a5c931ebc075eb75df447e10332

5 years agoMerge changes I471a49f6,If5879a76
Zach Johnson [Tue, 30 Apr 2019 18:50:03 +0000 (18:50 +0000)]
Merge changes I471a49f6,If5879a76

* changes:
  Clean up facade naming and paths
  Add enforcement of module dependency declaration

5 years agoMerge "Create handlers for every module upon module start."
Zach Johnson [Tue, 30 Apr 2019 18:49:33 +0000 (18:49 +0000)]
Merge "Create handlers for every module upon module start."

5 years agoMerge "PDL: Check sizes before validating constraints"
Treehugger Robot [Tue, 30 Apr 2019 00:22:30 +0000 (00:22 +0000)]
Merge "PDL: Check sizes before validating constraints"

5 years agoClean up facade naming and paths
Zach Johnson [Mon, 29 Apr 2019 23:45:21 +0000 (16:45 -0700)]
Clean up facade naming and paths

Remove "cert" from build rules that apply to stack under test

hal/facade/* -> hal/
api.proto -> facade.proto

In proto -> [x]Facade
Module -> [x]FacadeModule
Grpc service -> [x]FacadeService

A few straggling references to HciCmd and HciEvt

Test: atest --host bluetooth_test_gd and ./cert/run_cert.sh

Change-Id: I471a49f65a216d6669b3cb7f5ffebc7c069e2d6d

5 years agoCreate handlers for every module upon module start.
Zach Johnson [Mon, 29 Apr 2019 21:48:42 +0000 (14:48 -0700)]
Create handlers for every module upon module start.

Test: atest --host bluetooth_test_gd and ./cert/run_cert.sh
Change-Id: I360556ef3bb2ccf34d5658f00b30cc33949a77c1

5 years agoAdd enforcement of module dependency declaration
Zach Johnson [Mon, 29 Apr 2019 22:34:55 +0000 (15:34 -0700)]
Add enforcement of module dependency declaration

Move dependency access into module, enforce dependency was listed
in ListDependencies.

Remove ModuleRegistry from Start/Stop.

Test: atest --host bluetooth_test_gd and cert/run_cert.sh
Change-Id: If5879a76aae764286f1b5bd7df2b497ea8f51998

5 years agoGracefully shutdown SUT in cert
Hansong Zhang [Mon, 29 Apr 2019 21:35:53 +0000 (14:35 -0700)]
Gracefully shutdown SUT in cert

* After each test suite, shutdown the stack before closing rootcanal
* Don't stop gRPC server twice
* Crash the stack when can't build gRPC server

Test: cert/run_cert.sh
Change-Id: Ie4c8d749079e99b46d63fb70d157db26d9aa2474

5 years agoHAL: Add facade for fetching incoming HCI packets
Chienyuan [Thu, 25 Apr 2019 22:11:54 +0000 (15:11 -0700)]
HAL: Add facade for fetching incoming HCI packets

Adding the event stream primitives. General event stream request is
defined in facade/common.proto. "grpc/grpc_event_stream.h" provides
helper class templates GrpcEventStreamCallback and GrpcEventStream to
help user handle EventStream request without writing boilerplate code.

Test: cert/run_cert.sh
Change-Id: I00b51fc7b1faefb7c97cc647876f41854872a415

5 years agoFix BlockingQueue bug when using vector
Chienyuan [Mon, 29 Apr 2019 20:41:32 +0000 (13:41 -0700)]
Fix BlockingQueue bug when using vector

return value instead of reference when take

Test: run unittest
Change-Id: I268f5022306353493a348a52ed363cf60a125661

5 years agoRemove redundant Bluetooth from internal class names
Zach Johnson [Mon, 29 Apr 2019 19:07:23 +0000 (12:07 -0700)]
Remove redundant Bluetooth from internal class names

Test: atest --host bluetooth_test_gd and ./cert/run_cert.sh
Change-Id: I55b2c1ecc1ec254a197d6fde70968a9aa8c06c00

5 years agoAdd a persistent key to overwrite MIN_CE_LEN for Hearing Aids
Stanley Tng [Sat, 27 Apr 2019 21:51:11 +0000 (14:51 -0700)]
Add a persistent key to overwrite MIN_CE_LEN for Hearing Aids

To help in debugging the noise issues on Hearing Aids, add a new
persistent key, persist.bluetooth.hearingaidmincelen, to overwrite the
MIN_CE_LEN parameter that are used for the Connection Parameter Update
operations.

Bug: 130916579
Test: Manual testing
Change-Id: I1c52b2f99235f8d88e0a1d278dbf3174f1c60709

5 years agoMerge changes Ibcb21966,I026b9e89
Treehugger Robot [Sat, 27 Apr 2019 02:42:45 +0000 (02:42 +0000)]
Merge changes Ibcb21966,I026b9e89

* changes:
  Migrate GD code to module
  Add basic concept of module and module registry + dependency graph

5 years agoMigrate GD code to module
Zach Johnson [Fri, 26 Apr 2019 18:57:05 +0000 (11:57 -0700)]
Migrate GD code to module

Test: atest --host bluetooth_test_gd
Change-Id: Ibcb219666ff5552efc602bf063e69a6e6b7e4bd8

5 years agoAdd basic concept of module and module registry + dependency graph
Zach Johnson [Fri, 26 Apr 2019 05:24:54 +0000 (22:24 -0700)]
Add basic concept of module and module registry + dependency graph

Modules have protected lifecycle functions.
Modules are identified by a factory object that knows how to construct them.
Modules can indicate which dependencies they have.

Dependencies are started before their dependent modules.
Don't support incremental module stop for the moment - it's all or nothing.

Test: atest --host bluetooth_test_gd:ModuleTest
Change-Id: I026b9e893501506a6cea8387941b3a9424a9bec9

5 years agoImplement blocking queue
Chienyuan [Fri, 26 Apr 2019 18:59:35 +0000 (11:59 -0700)]
Implement blocking queue

Test: run unittest
Change-Id: I93c59a2d8c9bbe9bee762412b368773c4b35456f

5 years agoPDL: Check sizes before validating constraints
Myles Watson [Fri, 26 Apr 2019 16:02:18 +0000 (09:02 -0700)]
PDL: Check sizes before validating constraints

Test: bluetooth_packet_parser_test  --gtest_filter=*WayTooSmall*
Change-Id: Ia43c066c11b83f1e9b651ffdd85c6e0196c45332

5 years agoAdd workaround for "Service Changed" indications breaking server-only remotes
Jakub Pawlowski [Wed, 24 Apr 2019 21:00:16 +0000 (23:00 +0200)]
Add workaround for "Service Changed" indications breaking server-only remotes

Test: Connect with ruwido remote when magictether service is registered
Bug: 122994857
Change-Id: Ibb2c1272bb08c7a127c8f7d37ee6a05f15618fc2

5 years agoBasic integration of GD with ACTS
Zach Johnson [Mon, 22 Apr 2019 23:34:49 +0000 (16:34 -0700)]
Basic integration of GD with ACTS

* Add GD base test, which can parse config and bring up rootcanal.
* Add GD device controller, which is only optimized for host at this point.
* Add host config for running tests,
* Add basic hal test to test end to end flows.

Missing from this patch:
* GD cert device controller (should be similar to GD device)

Test: after setting up acts (gd/cert/set_up_acts.sh): gd/cert/run_cert.sh

Change-Id: Ibde7c7b0fe85b64643ed11fffe833e9ff53ed48c

5 years agoMerge "Revert "Revert "Cert for HAL adapter"""
Treehugger Robot [Thu, 25 Apr 2019 01:30:36 +0000 (01:30 +0000)]
Merge "Revert "Revert "Cert for HAL adapter"""

5 years agoRevert "Revert "Cert for HAL adapter""
Hansong Zhang [Wed, 24 Apr 2019 17:25:42 +0000 (17:25 +0000)]
Revert "Revert "Cert for HAL adapter""

This reverts commit 865d9d138f1099a0236847e39329ee641c62b1ae.

Reason for revert: Re-landing CL I3cf2f54605ce2709d1c149b1221dedc8dc5dca92

Change-Id: I63d60ab99d3a4a1b369f77d6c48eff0f463506e4

5 years agoSimple btsnoop logger implementation
Jack He [Mon, 22 Apr 2019 18:45:26 +0000 (11:45 -0700)]
Simple btsnoop logger implementation

Test: run unit test and check btsnoop log
Change-Id: Ib5ea3fc6440c48e1a7b5d5f3bcc3a0b1c23ac9c2

5 years agoMerge "Revert "Cert for HAL adapter""
Treehugger Robot [Wed, 24 Apr 2019 14:08:23 +0000 (14:08 +0000)]
Merge "Revert "Cert for HAL adapter""

5 years agoMerge "HearingAid: add addToWhiteList NativeInterface API"
Weichin Weng [Wed, 24 Apr 2019 09:15:31 +0000 (09:15 +0000)]
Merge "HearingAid: add addToWhiteList NativeInterface API"

5 years agoRevert "Cert for HAL adapter"
SzuWei Lin [Wed, 24 Apr 2019 07:10:06 +0000 (07:10 +0000)]
Revert "Cert for HAL adapter"

This reverts commit 7b003eb97a032ae16fb5e793bd641635319724c4.

Reason for revert: aosp_x86_64-eng build error

Change-Id: I6e5484f960209b8486806ab21b8d694437e3c10f

5 years agoHearingAid: add addToWhiteList NativeInterface API
weichinweng [Tue, 23 Apr 2019 02:56:20 +0000 (10:56 +0800)]
HearingAid: add addToWhiteList NativeInterface API

Add a new native interface API, addToWhiteList, that adds a LE device to
the whitelist.

Bug: 129452236
Test: Manual testing with Hearing Aids
Change-Id: I57c327380f07243e484c5c3afedfe60404f883fa

5 years agoMerge "Cert for HAL adapter"
Treehugger Robot [Tue, 23 Apr 2019 23:49:26 +0000 (23:49 +0000)]
Merge "Cert for HAL adapter"

5 years agoMerge "PDL: Use underscores for field names"
Treehugger Robot [Tue, 23 Apr 2019 23:02:27 +0000 (23:02 +0000)]
Merge "PDL: Use underscores for field names"

5 years agoCert for HAL adapter
Hansong Zhang [Mon, 8 Apr 2019 23:18:21 +0000 (16:18 -0700)]
Cert for HAL adapter

Introducing cert framework and a simple test case for HCI HAL
transportation adapter

Test-prerequisite: gRPC python. Install from pip
(https://grpc.io/blog/installation)

Test: 1. start HCI rootcanal or HIDL transport
      $ANDROID_HOST_OUT/nativetest64/root-canal/root-canal
      2. start stack with facade
      $ANDROID_HOST_OUT/bin/stack_with_facade
      3. run a simple test case
      $ANDROID_HOST_OUT/nativetest64/bluetooth_cert_test/bluetooth_cert_test

Or: One-liner: python cert/run_cert.py

Change-Id: I3cf2f54605ce2709d1c149b1221dedc8dc5dca92

5 years agoPDL: Use underscores for field names
Myles Watson [Mon, 22 Apr 2019 21:16:41 +0000 (14:16 -0700)]
PDL: Use underscores for field names

field_name : FieldType,

Test: bluetooth_packet_parser_test
Change-Id: I3b6d673111c7c4d7b5814563b132a3b48d3fdfcf

5 years agoRoot-canal: Add missing payload size field to loopback evt
Hansong Zhang [Tue, 23 Apr 2019 20:06:52 +0000 (13:06 -0700)]
Root-canal: Add missing payload size field to loopback evt

Bug: 131168063
Test: 1. Download AOSP CL929617 and 948661
      2. mma. Run python cert/run_cert.py
      3. Check btsnoop log

Change-Id: I1e31a1323f4aa8cb549af7545029b9d21eaabe9c

5 years agoMerge "HFP: Fix null pointer dereference in bta_ag_codec_negotiate()."
Treehugger Robot [Fri, 19 Apr 2019 13:54:34 +0000 (13:54 +0000)]
Merge "HFP: Fix null pointer dereference in bta_ag_codec_negotiate()."

5 years agoCall gatt_disconnect if the LE connection is not established and no APP use it.
weichinweng [Mon, 25 Mar 2019 05:51:10 +0000 (13:51 +0800)]
Call gatt_disconnect if the LE connection is not established and no APP use it.

When the LE connection hold APP is removed, if the LE connection is not
established and no APP use it, we never free transport control block
(p_tcb) or close it. For BLE device that have not established and no APP
use it, will call gatt_disconnect to free p_tcb and go to close state.

Bug: 127908699
Test: GattConnectTest
Change-Id: Ifed10c67141cb4c9221478db759c5614714fff30

5 years agoMerge "Use GATT_WRITE_NO_RSP for "state change" updates"
Treehugger Robot [Fri, 19 Apr 2019 03:36:29 +0000 (03:36 +0000)]
Merge "Use GATT_WRITE_NO_RSP for "state change" updates"

5 years agoMerge "HCI: Use fixed-width types"
Treehugger Robot [Fri, 19 Apr 2019 02:34:30 +0000 (02:34 +0000)]
Merge "HCI: Use fixed-width types"

5 years agoMerge changes I321e12bf,If7e6e586,Ie145d1dd
Treehugger Robot [Fri, 19 Apr 2019 02:00:31 +0000 (02:00 +0000)]
Merge changes I321e12bf,If7e6e586,Ie145d1dd

* changes:
  l2cap: Add FCS support
  packet/parser: Add tests for payload size modifier
  packet/parser: Add Checksum support

5 years agoUse GATT_WRITE_NO_RSP for "state change" updates
weichinweng [Wed, 17 Apr 2019 07:52:07 +0000 (15:52 +0800)]
Use GATT_WRITE_NO_RSP for "state change" updates

For Hearing Aid, replaces the GATT_WRITE with GATT_WRITE_NO_RSP for the
"state change" updates that are send to the devices. Using no response
write is faster and these informational updates does not need a
confirmation from the devices.

Bug: 130332748
Test: 1.run unit test
2.Forget/Repair HearingAid device from Bluetooth UI.
3.Disconnect/Reconnect HearingAid device from Bluetooth UI.
4.HearingAid device power off/on, check them can reconnect.
5.Multiple click connect/disconnect from Bluetooth UI within 1 sec,
check them can reconnect.
6.One side HearingAid device power off/on when playing music, check it
can reconnect and music is work fine.

Change-Id: I55e9b4b0b8c76412e5810e1cec5d96819527d099

5 years agoMerge "rootcanal: Check return values from callbacks"
Treehugger Robot [Fri, 19 Apr 2019 00:28:28 +0000 (00:28 +0000)]
Merge "rootcanal: Check return values from callbacks"

5 years agoHCI: Use fixed-width types
Myles Watson [Fri, 12 Apr 2019 17:40:43 +0000 (10:40 -0700)]
HCI: Use fixed-width types

Test: run bluetooth_test_gd
Change-Id: I9a9ef272d92635d7d56b8515a1889b7922ea3b87

5 years agol2cap: Add FCS support
Myles Watson [Wed, 17 Apr 2019 00:05:10 +0000 (17:05 -0700)]
l2cap: Add FCS support

Test: bluetooth_gd_test --gtest_filter=*Fcs*
Change-Id: I321e12bfb3ec8b5652d26d2b2e5066dc6a80895c

5 years agopacket/parser: Add tests for payload size modifier
Myles Watson [Wed, 17 Apr 2019 23:17:56 +0000 (16:17 -0700)]
packet/parser: Add tests for payload size modifier

Test: bluetooth_packet_parser_test --gtest_filter=*SizeMod*
Change-Id: If7e6e586477e6580adc540127f82500642658aea

5 years agopacket/parser: Add Checksum support
Myles Watson [Thu, 18 Apr 2019 16:09:01 +0000 (09:09 -0700)]
packet/parser: Add Checksum support

Make TypeDef represent Enum, Custom, and Checksum types.
Add SimpleSum as a test checksum.

Test: bluetooth_test_gd --gtest_filter=*SimpleSum*
Change-Id: Ie145d1dd17a710b50e98de8714102945b3c65c99

5 years agoBitInserter: Add byte observer for checksums
Myles Watson [Tue, 16 Apr 2019 17:24:26 +0000 (10:24 -0700)]
BitInserter: Add byte observer for checksums

Test: bluetooth_test_gd --gtest_filter=*BitInserter*
Change-Id: I9ef5bc5951244279fc142127a5c3c9a54c4eaf5c

5 years agorootcanal: Check return values from callbacks
Myles Watson [Thu, 18 Apr 2019 13:49:50 +0000 (06:49 -0700)]
rootcanal: Check return values from callbacks

Bug: 130624816
Test: kill the Bluetooth stack
Change-Id: Ie1d0e45f5847b4b4c6e6ee86061fa1092156d5db

5 years agoHFP: Fix null pointer dereference in bta_ag_codec_negotiate().
Ray Kuo [Tue, 16 Apr 2019 13:36:23 +0000 (21:36 +0800)]
HFP: Fix null pointer dereference in bta_ag_codec_negotiate().

BTM_ReadRemoteFeatures function will return NULL if ACL link to the remote
device is disconnected. Need to check whether p_rem_feat is nullptr
before dereferencing it.

Bug: 129736080
Test: make, force BTM_ReadRemoteFeatures() to return null and perform
MT/MO call tests.

Change-Id: I28d90823340d8721ee2349d3f55f07d1e823fee3

5 years agopacket: Support fixed-width custom types
Myles Watson [Fri, 12 Apr 2019 17:39:59 +0000 (10:39 -0700)]
packet: Support fixed-width custom types

Test: bluetooth_packet_parser_test --gtest_filter=*testChildWithAddress*
Change-Id: I73ff7962d99f668b4cbf1b4068bf74d069b9f599

5 years agoSend connected callback immediately when attempting to connect to already connected...
Jakub Pawlowski [Mon, 15 Apr 2019 20:07:27 +0000 (22:07 +0200)]
Send connected callback immediately when attempting to connect to already connected device

Instead of adding the device to the connection manager, just send the
successfull connection callback.

This patch is restoring behaviour from before Connection Manager
refactor. During the refactor this behaviour was broken.

Bug: 130273570
Test: sl4a GattConnectTest
Change-Id: Ic4fa7089a8262f6f792206496a7cfb9c83a16eb2

5 years agoMerge "Mark these yacc files as creating headers"
Treehugger Robot [Tue, 16 Apr 2019 00:06:53 +0000 (00:06 +0000)]
Merge "Mark these yacc files as creating headers"

5 years agoMerge "Implement Queue"
Treehugger Robot [Mon, 15 Apr 2019 21:49:01 +0000 (21:49 +0000)]
Merge "Implement Queue"

5 years agoMerge "Change storage metadata type to byte array"
Treehugger Robot [Mon, 15 Apr 2019 20:37:28 +0000 (20:37 +0000)]
Merge "Change storage metadata type to byte array"

5 years agoRootCanal: Open network ports only if there is a console
Myles Watson [Fri, 12 Apr 2019 21:30:51 +0000 (14:30 -0700)]
RootCanal: Open network ports only if there is a console

Bug: 128355308
Test: toggle airplane mode and check for opening sockets
Change-Id: I8c4581b708c05a8c72dba3604c02adea97c1653b

5 years agoMark these yacc files as creating headers
Dan Willemsen [Fri, 12 Apr 2019 22:16:12 +0000 (15:16 -0700)]
Mark these yacc files as creating headers

So that they're properly represented in the build graph.

Test: treehugger
Change-Id: If7141171117260b870dc6a0c6608dcae696b3189

5 years agoImplement Queue
Chienyuan [Thu, 4 Apr 2019 17:29:02 +0000 (10:29 -0700)]
Implement Queue

* Implement Queue which provides a flow control mechanism for data
  transmission between modules. This queue streaming data with
  EnqueueCallback and DequeueCallback based on the reactor pattern.
  Enqueue end should register callback when data is ready to be sent
  and unregister when no data ready to send. Dequeue end should
  register callback when ready to handle data and unregister when not
  ready to handle data.

* Implement ReactiveSemaphore, a wrapper for an event_fd work in
  non-blocking and Semaphore mode used by Queue to handle readable
  signal in the reactor pattern.

Test: run bluetooth_test_gd
Change-Id: Ia7019cdbe271d193c92f1a0b405ecced41a2d84b

5 years agoSimple stack bring up
Hansong Zhang [Tue, 9 Apr 2019 15:55:27 +0000 (08:55 -0700)]
Simple stack bring up

Just bring up the HAL transportation layer

Test: unit test
Change-Id: I94641d3008ce155d13df6ffe78f3710b3efca645

5 years agoHCI HAL adapter: separate initialization and set_callback
Hansong Zhang [Wed, 10 Apr 2019 22:46:25 +0000 (15:46 -0700)]
HCI HAL adapter: separate initialization and set_callback

Test: run bluetooth_test_gd

Change-Id: I1275be3020e34c56e0ef439e0f748db127d9f8e2

5 years agoAdd .gitignore
Hansong Zhang [Thu, 11 Apr 2019 21:24:37 +0000 (14:24 -0700)]
Add .gitignore

Test: compile
Change-Id: I0e4dd26c07ba5ed5e6ea4acf0fa9c9f831cba534

5 years agoMerge "packet: Enforce View inheritance and validation"
Treehugger Robot [Thu, 11 Apr 2019 05:46:26 +0000 (05:46 +0000)]
Merge "packet: Enforce View inheritance and validation"

5 years agoMerge "PDL: SMP packet definitions"
Jakub Pawlowski [Wed, 10 Apr 2019 14:48:30 +0000 (14:48 +0000)]
Merge "PDL: SMP packet definitions"

5 years agopacket: Enforce View inheritance and validation
Myles Watson [Thu, 4 Apr 2019 22:33:43 +0000 (15:33 -0700)]
packet: Enforce View inheritance and validation

Add was_validated_ flag to Views that can be constructed from bytes.
Check was_validated_ in every generated Get* function.

Test: bluetooth_packet_parser_test --gtest_filter=*Validate*Death*
Change-Id: I1de8d4e5e60bdd7b51562ffd258300e808db4adb

5 years agoMerge "Remove Ajay from owners"
Zach Johnson [Tue, 9 Apr 2019 21:47:23 +0000 (21:47 +0000)]
Merge "Remove Ajay from owners"

5 years agoRemove Ajay from owners
Zach Johnson [Tue, 9 Apr 2019 21:43:41 +0000 (14:43 -0700)]
Remove Ajay from owners

Moved to a different team.

Test: none
Change-Id: I2df8efa1dd59a98ae5c0d9bcd801955e5c85f8d7

5 years agoBluetooth HCI HAL adapter for Android HIDL
Hansong Zhang [Mon, 8 Apr 2019 21:26:53 +0000 (14:26 -0700)]
Bluetooth HCI HAL adapter for Android HIDL

Test: unit test
Change-Id: I60339d3f0845437e64705edc744e6091a2c3a171

5 years agoMerge "Switch to clang-r353983b."
Treehugger Robot [Tue, 9 Apr 2019 17:14:53 +0000 (17:14 +0000)]
Merge "Switch to clang-r353983b."

5 years agoMerge "DO NOT MERGE -- Merge PPRL.190405.003 into master"
Xin Li [Tue, 9 Apr 2019 04:29:22 +0000 (04:29 +0000)]
Merge "DO NOT MERGE -- Merge PPRL.190405.003 into master"

5 years agoPDL: SMP packet definitions
Myles Watson [Mon, 11 Mar 2019 23:48:08 +0000 (16:48 -0700)]
PDL: SMP packet definitions

Change-Id: Ia6e2da10a959e9476c4f3f32398ac5e815996669

5 years agoMerge "hci: CreateConnectionRoleSwitch is 8 bits"
Treehugger Robot [Tue, 9 Apr 2019 04:06:16 +0000 (04:06 +0000)]
Merge "hci: CreateConnectionRoleSwitch is 8 bits"

5 years agohci: CreateConnectionRoleSwitch is 8 bits
Myles Watson [Mon, 8 Apr 2019 23:41:33 +0000 (16:41 -0700)]
hci: CreateConnectionRoleSwitch is 8 bits

Test: Manual comparison with the spec
      Vol 2 Part E 7.1.5 Command Parameter Allow_Role_Switch
Change-Id: Iaa7df5c3c946e3740115df79f14bfae0ddf872b6

5 years agoDO NOT MERGE -- Merge PPRL.190405.003 into master
Xin Li [Tue, 9 Apr 2019 01:56:18 +0000 (18:56 -0700)]
DO NOT MERGE -- Merge PPRL.190405.003 into master

Bug: 130175407
Change-Id: I643bb187b1555598121d8b4a15b0acd73fe1f741

5 years agoMerge "packet/parser: Add pragma once to generated files"
Treehugger Robot [Tue, 9 Apr 2019 01:50:55 +0000 (01:50 +0000)]
Merge "packet/parser: Add pragma once to generated files"

5 years agoMerge "no forward_list in hci/acl_builder_test.cc"
Treehugger Robot [Tue, 9 Apr 2019 00:26:30 +0000 (00:26 +0000)]
Merge "no forward_list in hci/acl_builder_test.cc"

5 years agono forward_list in hci/acl_builder_test.cc
Myles Watson [Mon, 8 Apr 2019 19:08:33 +0000 (12:08 -0700)]
no forward_list in hci/acl_builder_test.cc

Test: bluetooth_test_gd --gtest_filter="*Acl*"
Change-Id: I6a764ec276102df59897102d6380110b5dd266ce

5 years agopacket/parser: Add pragma once to generated files
Myles Watson [Fri, 5 Apr 2019 15:45:43 +0000 (08:45 -0700)]
packet/parser: Add pragma once to generated files

Test: bluetooth_packet_parser_test
Change-Id: Ie0a2717cdbf74859fd457ee68533caded16a5d20

5 years agoAdapter layer for Bluetooth HCI HAL
Hansong Zhang [Fri, 29 Mar 2019 21:27:05 +0000 (14:27 -0700)]
Adapter layer for Bluetooth HCI HAL

Add adapter layer for HIDL HAL and host rootcanal HAL

Test: with cert and rootcanal
Change-Id: I1a84076d3df3176b75a499ac160e503e51fad8b3

5 years agoSnap for 5310204 from 817facf4bc2a956fafa8a38c15ab5963f2d0bc0e to pi-platform-release
android-build-team Robot [Mon, 8 Apr 2019 18:10:47 +0000 (18:10 +0000)]
Snap for 5310204 from 817facf4bc2a956fafa8a38c15ab5963f2d0bc0e to pi-platform-release

Change-Id: I704240f3f6bd8da8e23865ff7a6eb85b2233bcb1

5 years agoSwitch to clang-r353983b.
Stephen Hines [Fri, 5 Apr 2019 23:06:55 +0000 (16:06 -0700)]
Switch to clang-r353983b.

This is the current toolchain version being used in
build/soong/cc/config/global.go, so it should be used here as well.
Ideally, this python file would be updated to pick up the value directly
from the build configuration.

Test: N/A
Change-Id: I1c615a0d0c6dc4dedd82d1ced0381bab273f9e61

5 years agoModernise code to use override specifier
Yi Kong [Fri, 29 Mar 2019 22:42:58 +0000 (15:42 -0700)]
Modernise code to use override specifier

Generated by clang-tidy.

Test: m checkbuild
Change-Id: Icba58009f6db2a0e9e1360326b0b66fc10d04a5a

5 years agoMerge changes Ica38a448,I526fb846
Treehugger Robot [Fri, 5 Apr 2019 05:05:25 +0000 (05:05 +0000)]
Merge changes Ica38a448,I526fb846

* changes:
  Add namespace in bluetooth_packetgen
  Add multi file support for bluetooth_packetgen

5 years agoMerge "Add packet parser tests to TEST_MAPPING"
Treehugger Robot [Fri, 5 Apr 2019 02:19:38 +0000 (02:19 +0000)]
Merge "Add packet parser tests to TEST_MAPPING"

5 years agoMerge "Fix handling of startup_timer_expired"
Treehugger Robot [Fri, 5 Apr 2019 01:35:30 +0000 (01:35 +0000)]
Merge "Fix handling of startup_timer_expired"

5 years agoAdd namespace in bluetooth_packetgen
Hansong Zhang [Thu, 4 Apr 2019 23:23:32 +0000 (16:23 -0700)]
Add namespace in bluetooth_packetgen

::bluetooth is our top level namespace. Each subdirectory is a
namespace.

Test: bluetooth_packet_parser_test
Change-Id: Ica38a448c692396e6a34dd66eabc3eaa8df884e0

5 years agoAdd multi file support for bluetooth_packetgen
Hansong Zhang [Thu, 4 Apr 2019 20:24:43 +0000 (13:24 -0700)]
Add multi file support for bluetooth_packetgen

Test: bluetooth_packet_parser_test
Change-Id: I526fb8462f67f2ce099aab4e63ca695797f36723

5 years agoAdd packet parser tests to TEST_MAPPING
Zach Johnson [Fri, 5 Apr 2019 00:21:31 +0000 (17:21 -0700)]
Add packet parser tests to TEST_MAPPING

Test: atest bluetooth_packet_parser_test
Change-Id: If82370a834825cd265fac3c7e100176b94c79bb0

5 years agoPDL: L2CAP packet definition
Myles Watson [Mon, 25 Mar 2019 22:25:08 +0000 (15:25 -0700)]
PDL: L2CAP packet definition

Test: Comparison with the SPEC
      bluetooth_test_gd --gtest_filter="*L2cap*"
Change-Id: If29036fa7147b27d5a79458773c5eb772eb15817

5 years agoPDL: HCI packet definition
Myles Watson [Mon, 25 Mar 2019 22:24:43 +0000 (15:24 -0700)]
PDL: HCI packet definition

Test: Comparison with the SPEC
      bluetooth_test_gd --gtest_filter="*Acl*"
Change-Id: I48fcd2655edb54d831f8b395de9a209c46049189

5 years agopacket: Add the PDL Packet Generator
Ajay Panicker [Wed, 6 Feb 2019 22:02:36 +0000 (14:02 -0800)]
packet: Add the PDL Packet Generator

Test: bluetooth_packet_parser_test
Change-Id: Ia741e608aebff7b55d005a37e0f0eaeae63767a8

5 years agoFix memory leak of reactor and reactor_unittest
Chienyuan [Sat, 30 Mar 2019 00:33:41 +0000 (17:33 -0700)]
Fix memory leak of reactor and reactor_unittest

* Fix memory leak happen in below two cases

Case 1

1. Reactable1 register
2. Reactable2 register
3. Reactable2 unregister during the callback event of Reactable2
4. Reactable1 unregister

In step 3, reactable_removed_ will set to true due to unregister while
reactable->is_executing_ is true, it makes sure we delete Reactable2
after the callback is executed. But it will cause Reactable1 to not be
deleted in step 4.

To avoid this, we can reset reactable_removed_ to false after Reactable
deleted.

Case 2

1. Reactable1 register
2. Reactable2 register
3. Reactable2 unregister during the callback event of Reactable2
4. Reactable1 unregister from different thread during step 3 processing

In step 3, although we reset reactable_removed_ to false after Reactable2
deleted immediately for case 1, if other thread unregister Reactable1
before Reactable2 deleted, Reactable1 will fail to be deleted.

To avoid thie, we add a local variable to check if the Reacable is
executing. If not, deleted the Reactable directly.

* Add unittest for these two cases
* Fix memory leak in reactor_unittest
* Turn on cfi and address flag

Test: sudo ./bluetooth_test_gd
Change-Id: I0a0ca79b439fd3a1bf3ec0fa2b2a43a88e037fbb

5 years agoPacketBuilderTest: Modify member array
Chienyuan [Wed, 3 Apr 2019 23:12:36 +0000 (16:12 -0700)]
PacketBuilderTest: Modify member array

Test: sudo ./bluetooth_test_gd
Change-Id: Ibf015899c9430a25d7ae64f5bcc82a13e8f80871

5 years agoMerge "Handle Bluetooth HAL service died"
Treehugger Robot [Wed, 3 Apr 2019 18:45:12 +0000 (18:45 +0000)]
Merge "Handle Bluetooth HAL service died"

5 years agoHandle Bluetooth HAL service died
Ugo Yu [Tue, 2 Apr 2019 13:55:14 +0000 (21:55 +0800)]
Handle Bluetooth HAL service died

Bug: 129320921
Test: kill Bluetooth HAL
Change-Id: I83c897f5a9def52b2050a3e73d97f99b1b71aa3b

5 years agoFix handling of startup_timer_expired
Sunny Kapdi [Sat, 30 Mar 2019 00:42:38 +0000 (17:42 -0700)]
Fix handling of startup_timer_expired

1. The startup_timer needs to be less than
3 sec to allow the wakelock to be held by
the stack and needs to be less than the
BLE_START_TIMEOUT of framework.
2. On expiry of startup_timer, just abort
as there is no proper recovery steps here.

Test: "adb shell cat dev/ttyHS0" when Bluetooth is OFF
      Turn on Bluetooth
Bug: 129394377
Change-Id: I1a397bab5c88fe7ef8ccbc369897903ee5d0a36a
Merged-In: I1a397bab5c88fe7ef8ccbc369897903ee5d0a36a

5 years agoMerge "RootCanal: Add beacons by default"
Treehugger Robot [Wed, 3 Apr 2019 03:40:38 +0000 (03:40 +0000)]
Merge "RootCanal: Add beacons by default"

5 years agoMerge "packet: Add Packet classes and tests"
Treehugger Robot [Wed, 3 Apr 2019 01:01:06 +0000 (01:01 +0000)]
Merge "packet: Add Packet classes and tests"

5 years agopacket: Add Packet classes and tests
Myles Watson [Mon, 1 Apr 2019 20:21:25 +0000 (13:21 -0700)]
packet: Add Packet classes and tests

Test: atest bluetooth_test_gd
Change-Id: I8e124d5123cff3354f5c451b3806904a2d60b38d

5 years agoAdd service change handle for Hearing Aids
weichinweng [Wed, 20 Mar 2019 10:53:11 +0000 (18:53 +0800)]
Add service change handle for Hearing Aids

When receive service changed indication from Hearing Aid (which indicates
Hearing Aid service changed), it will refresh the hearing aid attribute
handle to ensure the attribute handle is correct.

Bug: 122008481
Test: 1.run unit test
2.After Pair old version FW HearingAid, Disconnect/Reconnect new version
FW HearingAId, then check whether HearingAid is working fine.
3.After Pair old version FW HearingAid, Bluetooth off/on to reconnect
new version FW HearingAId, then check whether HearingAid is working
fine.
Change-Id: I48eae10a3016429f35f4f904752be93bb419d515