Loading btaa/src/activity_attribution.cc +9 −3 Original line number Diff line number Diff line Loading @@ -69,18 +69,24 @@ void ActivityAttributionImpl::onWakeup( bool success, const std::vector<std::string>& wakeupReasons) {} Status WakelockCallback::notifyAcquired(void) { if (instance) { instance->onWakelockAcquired(); } return Status::ok(); } Status WakelockCallback::notifyReleased(void) { if (instance) { instance->onWakelockReleased(); } return Status::ok(); } Status WakeupCallback::notifyWakeup( bool success, const std::vector<std::string>& wakeupReasons) { if (instance) { instance->onWakeup(success, wakeupReasons); } return Status::ok(); } Loading system/btif/src/btif_activity_attribution.cc +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "btaa/include/activity_attribution.h" #include "btif/include/btif_common.h" #include "gd/common/init_flags.h" #include "stack/include/btu.h" using base::Bind; Loading @@ -37,6 +38,11 @@ class ActivityAttributionInterfaceImpl : public ActivityAttributionCallbacks, ~ActivityAttributionInterfaceImpl() override = default; void Init(ActivityAttributionCallbacks* callbacks) override { if (!bluetooth::common::InitFlags::BtaaHciLogEnabled()) { LOG(INFO) << __func__ << " BTAA not enabled!"; return; } this->callbacks = callbacks; ActivityAttribution::Initialize(this); } Loading system/gd/cert/captures.py +20 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,20 @@ class HalCaptures(object): class HciCaptures(object): @staticmethod def ReadLocalOobDataCompleteCapture(): return Capture( HciMatchers.CommandComplete(hci_packets.OpCode.READ_LOCAL_OOB_DATA), lambda packet: HciMatchers.ExtractMatchingCommandComplete(packet.event, hci_packets.OpCode.READ_LOCAL_OOB_DATA) ) @staticmethod def ReadLocalOobExtendedDataCompleteCapture(): return Capture( HciMatchers.CommandComplete(hci_packets.OpCode.READ_LOCAL_OOB_EXTENDED_DATA), lambda packet: HciMatchers.ExtractMatchingCommandComplete(packet.event, hci_packets.OpCode.READ_LOCAL_OOB_EXTENDED_DATA) ) @staticmethod def ReadBdAddrCompleteCapture(): return Capture( Loading Loading @@ -95,6 +109,12 @@ class HciCaptures(object): return Capture(HciMatchers.LeConnectionComplete(), lambda packet: HciMatchers.ExtractLeConnectionComplete(packet.event)) @staticmethod def SimplePairingCompleteCapture(): return Capture(HciMatchers.EventWithCode(hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE), lambda packet: hci_packets.SimplePairingCompleteView( HciMatchers.ExtractEventWithCode(packet.event, hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE))) class L2capCaptures(object): Loading system/gd/cert/matchers.py +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ # limitations under the License. import bluetooth_packets_python3 as bt_packets import logging from bluetooth_packets_python3 import hci_packets from bluetooth_packets_python3.hci_packets import EventCode from bluetooth_packets_python3 import l2cap_packets Loading Loading @@ -109,6 +111,10 @@ class HciMatchers(object): return hci_packets.LeEnhancedConnectionCompleteView( HciMatchers._extract_matching_le_event(packet_bytes, hci_packets.SubeventCode.ENHANCED_CONNECTION_COMPLETE)) @staticmethod def LogEventCode(): return lambda event: logging.info("Received event: %x" % hci_packets.EventPacketView(bt_packets.PacketViewLittleEndian(list(event.event))).GetEventCode()) @staticmethod def LinkKeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) Loading Loading @@ -153,6 +159,10 @@ class HciMatchers(object): def DisconnectionComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) @staticmethod def RemoteOobDataRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) class NeighborMatchers(object): Loading system/gd/cert/py_hal.py +4 −4 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ class PyHal(Closable): def __init__(self, device): self.device = device self.hci_event_stream = EventStream(self.device.hal.FetchHciEvent(empty_proto.Empty())) self.acl_stream = EventStream(self.device.hal.FetchHciAcl(empty_proto.Empty())) self.hci_event_stream = EventStream(self.device.hal.StreamEvents(empty_proto.Empty())) self.acl_stream = EventStream(self.device.hal.StreamAcl(empty_proto.Empty())) # We don't deal with SCO for now Loading @@ -42,7 +42,7 @@ class PyHal(Closable): return self.acl_stream def send_hci_command(self, command): self.device.hal.SendHciCommand(hal_facade.HciCommandPacket(payload=bytes(command))) self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command))) def send_acl(self, acl): self.device.hal.SendHciAcl(hal_facade.HciAclPacket(payload=bytes(acl))) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl))) Loading
btaa/src/activity_attribution.cc +9 −3 Original line number Diff line number Diff line Loading @@ -69,18 +69,24 @@ void ActivityAttributionImpl::onWakeup( bool success, const std::vector<std::string>& wakeupReasons) {} Status WakelockCallback::notifyAcquired(void) { if (instance) { instance->onWakelockAcquired(); } return Status::ok(); } Status WakelockCallback::notifyReleased(void) { if (instance) { instance->onWakelockReleased(); } return Status::ok(); } Status WakeupCallback::notifyWakeup( bool success, const std::vector<std::string>& wakeupReasons) { if (instance) { instance->onWakeup(success, wakeupReasons); } return Status::ok(); } Loading
system/btif/src/btif_activity_attribution.cc +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "btaa/include/activity_attribution.h" #include "btif/include/btif_common.h" #include "gd/common/init_flags.h" #include "stack/include/btu.h" using base::Bind; Loading @@ -37,6 +38,11 @@ class ActivityAttributionInterfaceImpl : public ActivityAttributionCallbacks, ~ActivityAttributionInterfaceImpl() override = default; void Init(ActivityAttributionCallbacks* callbacks) override { if (!bluetooth::common::InitFlags::BtaaHciLogEnabled()) { LOG(INFO) << __func__ << " BTAA not enabled!"; return; } this->callbacks = callbacks; ActivityAttribution::Initialize(this); } Loading
system/gd/cert/captures.py +20 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,20 @@ class HalCaptures(object): class HciCaptures(object): @staticmethod def ReadLocalOobDataCompleteCapture(): return Capture( HciMatchers.CommandComplete(hci_packets.OpCode.READ_LOCAL_OOB_DATA), lambda packet: HciMatchers.ExtractMatchingCommandComplete(packet.event, hci_packets.OpCode.READ_LOCAL_OOB_DATA) ) @staticmethod def ReadLocalOobExtendedDataCompleteCapture(): return Capture( HciMatchers.CommandComplete(hci_packets.OpCode.READ_LOCAL_OOB_EXTENDED_DATA), lambda packet: HciMatchers.ExtractMatchingCommandComplete(packet.event, hci_packets.OpCode.READ_LOCAL_OOB_EXTENDED_DATA) ) @staticmethod def ReadBdAddrCompleteCapture(): return Capture( Loading Loading @@ -95,6 +109,12 @@ class HciCaptures(object): return Capture(HciMatchers.LeConnectionComplete(), lambda packet: HciMatchers.ExtractLeConnectionComplete(packet.event)) @staticmethod def SimplePairingCompleteCapture(): return Capture(HciMatchers.EventWithCode(hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE), lambda packet: hci_packets.SimplePairingCompleteView( HciMatchers.ExtractEventWithCode(packet.event, hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE))) class L2capCaptures(object): Loading
system/gd/cert/matchers.py +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ # limitations under the License. import bluetooth_packets_python3 as bt_packets import logging from bluetooth_packets_python3 import hci_packets from bluetooth_packets_python3.hci_packets import EventCode from bluetooth_packets_python3 import l2cap_packets Loading Loading @@ -109,6 +111,10 @@ class HciMatchers(object): return hci_packets.LeEnhancedConnectionCompleteView( HciMatchers._extract_matching_le_event(packet_bytes, hci_packets.SubeventCode.ENHANCED_CONNECTION_COMPLETE)) @staticmethod def LogEventCode(): return lambda event: logging.info("Received event: %x" % hci_packets.EventPacketView(bt_packets.PacketViewLittleEndian(list(event.event))).GetEventCode()) @staticmethod def LinkKeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) Loading Loading @@ -153,6 +159,10 @@ class HciMatchers(object): def DisconnectionComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) @staticmethod def RemoteOobDataRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) class NeighborMatchers(object): Loading
system/gd/cert/py_hal.py +4 −4 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ class PyHal(Closable): def __init__(self, device): self.device = device self.hci_event_stream = EventStream(self.device.hal.FetchHciEvent(empty_proto.Empty())) self.acl_stream = EventStream(self.device.hal.FetchHciAcl(empty_proto.Empty())) self.hci_event_stream = EventStream(self.device.hal.StreamEvents(empty_proto.Empty())) self.acl_stream = EventStream(self.device.hal.StreamAcl(empty_proto.Empty())) # We don't deal with SCO for now Loading @@ -42,7 +42,7 @@ class PyHal(Closable): return self.acl_stream def send_hci_command(self, command): self.device.hal.SendHciCommand(hal_facade.HciCommandPacket(payload=bytes(command))) self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command))) def send_acl(self, acl): self.device.hal.SendHciAcl(hal_facade.HciAclPacket(payload=bytes(acl))) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl)))