Loading system/gd/hci/hci_layer.cc +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "os/metrics.h" #include "os/queue.h" #include "packet/packet_builder.h" #include "storage/storage_module.h" namespace bluetooth { namespace hci { Loading Loading @@ -294,7 +295,7 @@ struct HciLayer::impl { void on_hci_event(EventView event) { ASSERT(event.IsValid()); log_hci_event(command_queue_.front().command_view, event); log_hci_event(command_queue_.front().command_view, event, module_.GetDependency<storage::StorageModule>()); EventCode event_code = event.GetEventCode(); // Root Inflamation is a special case, since it aborts here if (event_code == EventCode::VENDOR_SPECIFIC) { Loading Loading @@ -520,6 +521,7 @@ const ModuleFactory HciLayer::Factory = ModuleFactory([]() { return new HciLayer void HciLayer::ListDependencies(ModuleList* list) { list->add<hal::HciHal>(); list->add<storage::StorageModule>(); } void HciLayer::Start() { Loading system/gd/hci/hci_metrics_logging.cc +37 −3 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include "common/strings.h" #include "hci/hci_metrics_logging.h" #include "os/metrics.h" #include "storage/device.h" namespace bluetooth { namespace hci { void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView event_view) { void log_hci_event( std::unique_ptr<CommandView>& command_view, EventView event_view, storage::StorageModule* storage_module) { ASSERT(event_view.IsValid()); EventCode event_code = event_view.GetEventCode(); switch (event_code) { Loading @@ -47,7 +50,7 @@ void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView event_v break; } default: log_link_layer_connection_other_hci_event(event_view); log_link_layer_connection_other_hci_event(event_view, storage_module); log_classic_pairing_other_hci_event(event_view); } } Loading Loading @@ -312,7 +315,7 @@ void log_link_layer_connection_command_complete(EventView event_view, std::uniqu static_cast<uint16_t>(reason)); } void log_link_layer_connection_other_hci_event(EventView packet) { void log_link_layer_connection_other_hci_event(EventView packet, storage::StorageModule* storage_module) { EventCode event_code = packet.GetEventCode(); Address address = Address::kEmpty; uint32_t connection_handle = bluetooth::os::kUnknownConnectionHandle; Loading @@ -329,6 +332,9 @@ void log_link_layer_connection_other_hci_event(EventView packet) { connection_handle = connection_complete_view.GetConnectionHandle(); link_type = static_cast<uint16_t>(connection_complete_view.GetLinkType()); status = connection_complete_view.GetStatus(); // besides log link layer connection events, also log remote device manufacturer info log_remote_device_information(address, connection_handle, status, storage_module); break; } case EventCode::CONNECTION_REQUEST: { Loading Loading @@ -839,5 +845,33 @@ void log_classic_pairing_command_complete(EventView event_view, std::unique_ptr< value); } void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { if (address.IsEmpty()) { return; } const storage::Device device = storage_module->GetDeviceByLegacyKey(address); // log ManufacturerInfo std::stringstream sdp_di_vendor_id_source; // [N - native]::SDP::[DIP - Device ID Profile] sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); os::LogMetricManufacturerInfo( address, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, sdp_di_vendor_id_source.str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiModel().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiHardwareVersion().value_or(0)).c_str(), ""); // log RemoteVersionInfo os::LogMetricRemoteVersionInfo( connection_handle, static_cast<uint16_t>(status), device.GetLmpVersion().value_or(-1), device.GetManufacturerCode().value_or(-1), device.GetLmpSubVersion().value_or(-1)); } } // namespace hci } // namespace bluetooth No newline at end of file system/gd/hci/hci_metrics_logging.h +6 −2 Original line number Diff line number Diff line Loading @@ -17,18 +17,22 @@ #pragma once #include "hci/hci_packets.h" #include "storage/storage_module.h" namespace bluetooth { namespace hci { void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView packet); void log_hci_event( std::unique_ptr<CommandView>& command_view, EventView packet, storage::StorageModule* storage_module); void log_link_layer_connection_command_status(std::unique_ptr<CommandView>& command_view, ErrorCode status); void log_link_layer_connection_command_complete(EventView event, std::unique_ptr<CommandView>& command_view); void log_link_layer_connection_event_le_meta(LeMetaEventView le_meta_event_view); void log_link_layer_connection_other_hci_event(EventView packet); void log_link_layer_connection_other_hci_event(EventView packet, storage::StorageModule* storage_module); void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_view, ErrorCode status); void log_classic_pairing_command_complete(EventView event, std::unique_ptr<CommandView>& command_view); void log_classic_pairing_other_hci_event(EventView packet); void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module); } // namespace hci } // namespace bluetooth No newline at end of file system/gd/storage/device.h +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ class Device { GENERATE_PROPERTY_GETTER_SETTER_REMOVER(ManufacturerCode, uint16_t, "Manufacturer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(LmpVersion, uint8_t, "LmpVer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(LmpSubVersion, uint16_t, "LmpSubVer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiManufacturer, uint16_t, "SdpDiManufacturer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiModel, uint16_t, "SdpDiModel"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiHardwareVersion, uint16_t, "SdpDiHardwareVersion"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiVendorIdSource, uint16_t, "SdpDiVendorIdSource"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(MetricsId, int, "MetricsId"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(PinLength, int, "PinLength"); // unix timestamp in seconds from epoch Loading Loading
system/gd/hci/hci_layer.cc +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "os/metrics.h" #include "os/queue.h" #include "packet/packet_builder.h" #include "storage/storage_module.h" namespace bluetooth { namespace hci { Loading Loading @@ -294,7 +295,7 @@ struct HciLayer::impl { void on_hci_event(EventView event) { ASSERT(event.IsValid()); log_hci_event(command_queue_.front().command_view, event); log_hci_event(command_queue_.front().command_view, event, module_.GetDependency<storage::StorageModule>()); EventCode event_code = event.GetEventCode(); // Root Inflamation is a special case, since it aborts here if (event_code == EventCode::VENDOR_SPECIFIC) { Loading Loading @@ -520,6 +521,7 @@ const ModuleFactory HciLayer::Factory = ModuleFactory([]() { return new HciLayer void HciLayer::ListDependencies(ModuleList* list) { list->add<hal::HciHal>(); list->add<storage::StorageModule>(); } void HciLayer::Start() { Loading
system/gd/hci/hci_metrics_logging.cc +37 −3 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include "common/strings.h" #include "hci/hci_metrics_logging.h" #include "os/metrics.h" #include "storage/device.h" namespace bluetooth { namespace hci { void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView event_view) { void log_hci_event( std::unique_ptr<CommandView>& command_view, EventView event_view, storage::StorageModule* storage_module) { ASSERT(event_view.IsValid()); EventCode event_code = event_view.GetEventCode(); switch (event_code) { Loading @@ -47,7 +50,7 @@ void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView event_v break; } default: log_link_layer_connection_other_hci_event(event_view); log_link_layer_connection_other_hci_event(event_view, storage_module); log_classic_pairing_other_hci_event(event_view); } } Loading Loading @@ -312,7 +315,7 @@ void log_link_layer_connection_command_complete(EventView event_view, std::uniqu static_cast<uint16_t>(reason)); } void log_link_layer_connection_other_hci_event(EventView packet) { void log_link_layer_connection_other_hci_event(EventView packet, storage::StorageModule* storage_module) { EventCode event_code = packet.GetEventCode(); Address address = Address::kEmpty; uint32_t connection_handle = bluetooth::os::kUnknownConnectionHandle; Loading @@ -329,6 +332,9 @@ void log_link_layer_connection_other_hci_event(EventView packet) { connection_handle = connection_complete_view.GetConnectionHandle(); link_type = static_cast<uint16_t>(connection_complete_view.GetLinkType()); status = connection_complete_view.GetStatus(); // besides log link layer connection events, also log remote device manufacturer info log_remote_device_information(address, connection_handle, status, storage_module); break; } case EventCode::CONNECTION_REQUEST: { Loading Loading @@ -839,5 +845,33 @@ void log_classic_pairing_command_complete(EventView event_view, std::unique_ptr< value); } void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { if (address.IsEmpty()) { return; } const storage::Device device = storage_module->GetDeviceByLegacyKey(address); // log ManufacturerInfo std::stringstream sdp_di_vendor_id_source; // [N - native]::SDP::[DIP - Device ID Profile] sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); os::LogMetricManufacturerInfo( address, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, sdp_di_vendor_id_source.str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiModel().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiHardwareVersion().value_or(0)).c_str(), ""); // log RemoteVersionInfo os::LogMetricRemoteVersionInfo( connection_handle, static_cast<uint16_t>(status), device.GetLmpVersion().value_or(-1), device.GetManufacturerCode().value_or(-1), device.GetLmpSubVersion().value_or(-1)); } } // namespace hci } // namespace bluetooth No newline at end of file
system/gd/hci/hci_metrics_logging.h +6 −2 Original line number Diff line number Diff line Loading @@ -17,18 +17,22 @@ #pragma once #include "hci/hci_packets.h" #include "storage/storage_module.h" namespace bluetooth { namespace hci { void log_hci_event(std::unique_ptr<CommandView>& command_view, EventView packet); void log_hci_event( std::unique_ptr<CommandView>& command_view, EventView packet, storage::StorageModule* storage_module); void log_link_layer_connection_command_status(std::unique_ptr<CommandView>& command_view, ErrorCode status); void log_link_layer_connection_command_complete(EventView event, std::unique_ptr<CommandView>& command_view); void log_link_layer_connection_event_le_meta(LeMetaEventView le_meta_event_view); void log_link_layer_connection_other_hci_event(EventView packet); void log_link_layer_connection_other_hci_event(EventView packet, storage::StorageModule* storage_module); void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_view, ErrorCode status); void log_classic_pairing_command_complete(EventView event, std::unique_ptr<CommandView>& command_view); void log_classic_pairing_other_hci_event(EventView packet); void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module); } // namespace hci } // namespace bluetooth No newline at end of file
system/gd/storage/device.h +5 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ class Device { GENERATE_PROPERTY_GETTER_SETTER_REMOVER(ManufacturerCode, uint16_t, "Manufacturer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(LmpVersion, uint8_t, "LmpVer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(LmpSubVersion, uint16_t, "LmpSubVer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiManufacturer, uint16_t, "SdpDiManufacturer"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiModel, uint16_t, "SdpDiModel"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiHardwareVersion, uint16_t, "SdpDiHardwareVersion"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(SdpDiVendorIdSource, uint16_t, "SdpDiVendorIdSource"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(MetricsId, int, "MetricsId"); GENERATE_PROPERTY_GETTER_SETTER_REMOVER(PinLength, int, "PinLength"); // unix timestamp in seconds from epoch Loading