gd: Fix LeAclManagerTest fails on real device
Tag: #gd-refactor
Bug: 193071659
Test: gd/cert/run
Test: bluetooth_test_gd
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
Change-Id: Ic743eb7fa6a9dd3de73f18bf06a08b47419eea78
diff --git a/system/gd/hci/cert/le_acl_manager_test_lib.py b/system/gd/hci/cert/le_acl_manager_test_lib.py
index 39f148b..2abff9f 100644
--- a/system/gd/hci/cert/le_acl_manager_test_lib.py
+++ b/system/gd/hci/cert/le_acl_manager_test_lib.py
@@ -136,12 +136,12 @@
handle = cc_view.GetConnectionHandle()
address = cc_view.GetPeerAddress()
return True
- if b'\x3e\x13\x0A\x00' in packet_bytes:
+ if b'\x3e\x1f\x0A\x00' in packet_bytes:
cc_view = hci_packets.LeEnhancedConnectionCompleteView(
hci_packets.LeMetaEventView(
hci_packets.EventView(bt_packets.PacketViewLittleEndian(list(packet_bytes)))))
handle = cc_view.GetConnectionHandle()
- address = cc_view.GetPeerResolvablePrivateAddress()
+ address = cc_view.GetPeerAddress()
return True
return False
@@ -202,6 +202,7 @@
def test_cert_connects(self):
self.set_privacy_policy_static()
self.register_for_le_event(hci_packets.SubeventCode.CONNECTION_COMPLETE)
+ self.register_for_le_event(hci_packets.SubeventCode.ENHANCED_CONNECTION_COMPLETE)
self.dut_le_acl_manager.listen_for_incoming_connections()
@@ -253,7 +254,7 @@
hci_packets.EventView(bt_packets.PacketViewLittleEndian(list(packet_bytes)))))
handle = cc_view.GetConnectionHandle()
return True
- if b'\x3e\x13\x0A\x00' in packet_bytes:
+ if b'\x3e\x1f\x0A\x00' in packet_bytes:
cc_view = hci_packets.LeEnhancedConnectionCompleteView(
hci_packets.LeMetaEventView(
hci_packets.EventView(bt_packets.PacketViewLittleEndian(list(packet_bytes)))))
diff --git a/system/gd/hci/facade/le_advertising_manager_facade.cc b/system/gd/hci/facade/le_advertising_manager_facade.cc
index f237d69..c249da0 100644
--- a/system/gd/hci/facade/le_advertising_manager_facade.cc
+++ b/system/gd/hci/facade/le_advertising_manager_facade.cc
@@ -96,6 +96,30 @@
config->tx_power = static_cast<uint8_t>(config_proto.tx_power());
config->legacy_pdus = true;
+
+ auto advertising_type = static_cast<::bluetooth::hci::AdvertisingType>(config_proto.advertising_type());
+
+ switch (advertising_type) {
+ case AdvertisingType::ADV_IND: {
+ config->connectable = true;
+ config->scannable = true;
+ } break;
+ case AdvertisingType::ADV_DIRECT_IND: {
+ config->connectable = true;
+ config->directed = true;
+ config->high_duty_directed_connectable = true;
+ } break;
+ case AdvertisingType::ADV_SCAN_IND: {
+ config->scannable = true;
+ } break;
+ case AdvertisingType::ADV_NONCONN_IND: {
+ } break;
+ case AdvertisingType::ADV_DIRECT_IND_LOW: {
+ config->directed = true;
+ config->connectable = true;
+ } break;
+ }
+
return true;
}