Loading system/gd/metrics/metrics_state.cc +11 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,17 @@ void LEConnectionMetricState::AddStateChangedEvent( end_timepoint = current_timestamp; switch (state) { case LeConnectionState::STATE_LE_ACL_START: { int connection_type_cid = GetArgumentTypeFromList(argument_list, os::ArgumentType::L2CAP_CID); if (connection_type_cid != -1) { LeConnectionType connection_type = GetLeConnectionTypeFromCID(connection_type_cid); if (connection_type != LeConnectionType::CONNECTION_TYPE_UNSPECIFIED) { LOG_INFO("LEConnectionMetricsRemoteDevice: Populating the connection type\n"); input_connection_type = connection_type; } } break; } case LeConnectionState::STATE_LE_ACL_END: { int acl_status_code_from_args = GetArgumentTypeFromList(argument_list, os::ArgumentType::ACL_STATUS_CODE); Loading system/gd/metrics/utils.cc +23 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,29 @@ int GetArgumentTypeFromList( return -1; } os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid) { switch(fixed_cid) { case 3: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_AMP; } case 4: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_ATT; } case 5: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_LE_SIGNALLING; } case 6: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP; } case 7: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP_BR_EDR; } default: { return os::LeConnectionType::CONNECTION_TYPE_UNSPECIFIED; } } } } // namespace metrics Loading system/gd/metrics/utils.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,6 @@ namespace metrics { bool GetBootId(std::string* boot_id); int GetArgumentTypeFromList( std::vector<std::pair<os::ArgumentType, int>>& argument_list, os::ArgumentType argumentType); os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid); } // namespace metrics } // namespace bluetooth system/stack/l2cap/l2c_api.cc +12 −0 Original line number Diff line number Diff line Loading @@ -36,8 +36,10 @@ #include "gd/common/init_flags.h" #include "gd/hal/snoop_logger.h" #include "gd/os/system_properties.h" #include "gd/os/metrics.h" #include "hci/include/btsnoop.h" #include "main/shim/shim.h" #include "main/shim/metrics_api.h" #include "osi/include/allocator.h" #include "osi/include/log.h" #include "stack/btm/btm_sec.h" Loading Loading @@ -1354,6 +1356,16 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { } if (transport == BT_TRANSPORT_LE) { auto argument_list = std::vector<std::pair<bluetooth::os::ArgumentType, int>>(); argument_list.push_back(std::make_pair(bluetooth::os::ArgumentType::L2CAP_CID, fixed_cid)); bluetooth::shim::LogMetricBluetoothLEConnectionMetricEvent( rem_bda, android::bluetooth::le::LeConnectionOriginType::ORIGIN_NATIVE, android::bluetooth::le::LeConnectionType::CONNECTION_TYPE_LE_ACL, android::bluetooth::le::LeConnectionState::STATE_LE_ACL_START, argument_list); bool ret = l2cu_create_conn_le(p_lcb); if (!ret) { LOG_WARN("Unable to create fixed channel le connection fixed_cid:0x%04x", Loading Loading
system/gd/metrics/metrics_state.cc +11 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,17 @@ void LEConnectionMetricState::AddStateChangedEvent( end_timepoint = current_timestamp; switch (state) { case LeConnectionState::STATE_LE_ACL_START: { int connection_type_cid = GetArgumentTypeFromList(argument_list, os::ArgumentType::L2CAP_CID); if (connection_type_cid != -1) { LeConnectionType connection_type = GetLeConnectionTypeFromCID(connection_type_cid); if (connection_type != LeConnectionType::CONNECTION_TYPE_UNSPECIFIED) { LOG_INFO("LEConnectionMetricsRemoteDevice: Populating the connection type\n"); input_connection_type = connection_type; } } break; } case LeConnectionState::STATE_LE_ACL_END: { int acl_status_code_from_args = GetArgumentTypeFromList(argument_list, os::ArgumentType::ACL_STATUS_CODE); Loading
system/gd/metrics/utils.cc +23 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,29 @@ int GetArgumentTypeFromList( return -1; } os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid) { switch(fixed_cid) { case 3: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_AMP; } case 4: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_ATT; } case 5: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_LE_SIGNALLING; } case 6: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP; } case 7: { return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP_BR_EDR; } default: { return os::LeConnectionType::CONNECTION_TYPE_UNSPECIFIED; } } } } // namespace metrics Loading
system/gd/metrics/utils.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,6 @@ namespace metrics { bool GetBootId(std::string* boot_id); int GetArgumentTypeFromList( std::vector<std::pair<os::ArgumentType, int>>& argument_list, os::ArgumentType argumentType); os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid); } // namespace metrics } // namespace bluetooth
system/stack/l2cap/l2c_api.cc +12 −0 Original line number Diff line number Diff line Loading @@ -36,8 +36,10 @@ #include "gd/common/init_flags.h" #include "gd/hal/snoop_logger.h" #include "gd/os/system_properties.h" #include "gd/os/metrics.h" #include "hci/include/btsnoop.h" #include "main/shim/shim.h" #include "main/shim/metrics_api.h" #include "osi/include/allocator.h" #include "osi/include/log.h" #include "stack/btm/btm_sec.h" Loading Loading @@ -1354,6 +1356,16 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { } if (transport == BT_TRANSPORT_LE) { auto argument_list = std::vector<std::pair<bluetooth::os::ArgumentType, int>>(); argument_list.push_back(std::make_pair(bluetooth::os::ArgumentType::L2CAP_CID, fixed_cid)); bluetooth::shim::LogMetricBluetoothLEConnectionMetricEvent( rem_bda, android::bluetooth::le::LeConnectionOriginType::ORIGIN_NATIVE, android::bluetooth::le::LeConnectionType::CONNECTION_TYPE_LE_ACL, android::bluetooth::le::LeConnectionState::STATE_LE_ACL_START, argument_list); bool ret = l2cu_create_conn_le(p_lcb); if (!ret) { LOG_WARN("Unable to create fixed channel le connection fixed_cid:0x%04x", Loading