diff options
author | 2025-02-03 15:09:59 -0800 | |
---|---|---|
committer | 2025-02-20 13:26:36 -0800 | |
commit | 0503ef80d9d1f90c6ed28cda7dae07ec62706a9b (patch) | |
tree | 06bb0068c6f70775b1a364010b1fe542bf94b738 /system/test | |
parent | e7e402ea4f4580bc2a116b22ebd93fa7ae4e2e31 (diff) |
RFCOMM metrics V2: Add metrics functions
- Collect metrics when sdp fails for HFP and RFCOMM
- Collect metrics when port creation fails for HFP and RFCOMM
- Collect metrics when port closes
Bug: 374989690
Test: m com.android.bt
Flag: EXEMPT metrics no-op
Change-Id: Ie2de6f0305afad58ab7d2cd7fdcf988c21649a28
Diffstat (limited to 'system/test')
-rw-r--r-- | system/test/mock/mock_main_shim_metrics_api.cc | 13 | ||||
-rw-r--r-- | system/test/mock/mock_main_shim_metrics_api.h | 37 |
2 files changed, 50 insertions, 0 deletions
diff --git a/system/test/mock/mock_main_shim_metrics_api.cc b/system/test/mock/mock_main_shim_metrics_api.cc index ac64150797..908f258205 100644 --- a/system/test/mock/mock_main_shim_metrics_api.cc +++ b/system/test/mock/mock_main_shim_metrics_api.cc @@ -59,6 +59,7 @@ struct LogMetricLeConnectionStatus LogMetricLeConnectionStatus; struct LogMetricLeDeviceInAcceptList LogMetricLeDeviceInAcceptList; struct LogMetricLeConnectionLifecycle LogMetricLeConnectionLifecycle; struct LogMetricLeConnectionCompletion LogMetricLeConnectionCompletion; +struct LogMetricRfcommConnectionAtClose LogMetricRfcommConnectionAtClose; } // namespace main_shim_metrics_api } // namespace mock @@ -215,4 +216,16 @@ void bluetooth::shim::LogMetricLeConnectionCompletion(bluetooth::hci::Address ad test::mock::main_shim_metrics_api::LogMetricLeConnectionCompletion(address, reason, is_locally_initiated); } +void bluetooth::shim::LogMetricRfcommConnectionAtClose( + const RawAddress& raw_address, android::bluetooth::rfcomm::PortResult close_reason, + android::bluetooth::rfcomm::SocketConnectionSecurity security, + android::bluetooth::rfcomm::RfcommPortEvent last_event, + android::bluetooth::rfcomm::RfcommPortState previous_state, int32_t open_duration_ms, + int32_t uid, android::bluetooth::BtaStatus sdp_status, bool is_server, bool sdp_initiated, + int32_t sdp_duration_ms) { + inc_func_call_count(__func__); + test::mock::main_shim_metrics_api::LogMetricRfcommConnectionAtClose( + raw_address, close_reason, security, last_event, previous_state, open_duration_ms, uid, + sdp_status, is_server, sdp_initiated, sdp_duration_ms); +} // END mockcify generation diff --git a/system/test/mock/mock_main_shim_metrics_api.h b/system/test/mock/mock_main_shim_metrics_api.h index 6b8d8e5edf..7e8df3c3c8 100644 --- a/system/test/mock/mock_main_shim_metrics_api.h +++ b/system/test/mock/mock_main_shim_metrics_api.h @@ -367,6 +367,43 @@ struct LogMetricLeConnectionCompletion { }; extern struct LogMetricLeConnectionCompletion LogMetricLeConnectionCompletion; +// Name: LogMetricRfcommConnectionAtClose +// Params: const RawAddress& raw_address, android::bluetooth::rfcomm::PortResult close_reason, +// android::bluetooth::rfcomm::SocketConnectionSecurity security, +// android::bluetooth::rfcomm::RfcommPortEvent last_event, +// android::bluetooth::rfcomm::RfcommPortState previous_state, int32_t open_duration_ms, +// int32_t uid, android::bluetooth::BtaStatus sdp_status, bool is_server, +// bool sdp_initiated, int32_t sdp_duration_ms +// Returns: void +struct LogMetricRfcommConnectionAtClose { + std::function<void( + const RawAddress& raw_address, android::bluetooth::rfcomm::PortResult close_reason, + android::bluetooth::rfcomm::SocketConnectionSecurity security, + android::bluetooth::rfcomm::RfcommPortEvent last_event, + android::bluetooth::rfcomm::RfcommPortState previous_state, int32_t open_duration_ms, + int32_t uid, android::bluetooth::BtaStatus sdp_status, bool is_server, bool sdp_initiated, + int32_t sdp_duration_ms)> + body{[](const RawAddress& /* raw_address */, + android::bluetooth::rfcomm::PortResult /* close_reason */, + android::bluetooth::rfcomm::SocketConnectionSecurity /* security */, + android::bluetooth::rfcomm::RfcommPortEvent /* last_event */, + android::bluetooth::rfcomm::RfcommPortState /* previous_state */, + int32_t /* open_duration_ms */, int32_t /* uid */, + android::bluetooth::BtaStatus /* sdp_status */, bool /* is_server */, + bool /* sdp_initiated */, int32_t /* sdp_duration_ms */) {}}; + void operator()(const RawAddress& raw_address, + android::bluetooth::rfcomm::PortResult close_reason, + android::bluetooth::rfcomm::SocketConnectionSecurity security, + android::bluetooth::rfcomm::RfcommPortEvent last_event, + android::bluetooth::rfcomm::RfcommPortState previous_state, + int32_t open_duration_ms, int32_t uid, android::bluetooth::BtaStatus sdp_status, + bool is_server, bool sdp_initiated, int32_t sdp_duration_ms) { + body(raw_address, close_reason, security, last_event, previous_state, open_duration_ms, uid, + sdp_status, is_server, sdp_initiated, sdp_duration_ms); + } +}; +extern struct LogMetricRfcommConnectionAtClose LogMetricRfcommConnectionAtClose; + } // namespace main_shim_metrics_api } // namespace mock } // namespace test |