1 /*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18 * Generated mock file from original source file
19 * Functions generated:12
20 *
21 * mockcify.pl ver 0.2
22 */
23 // Mock include file to share data between tests and mock
24 #include "test/mock/mock_main_shim_metrics_api.h"
25
26 #include <cstdint>
27 #include <string>
28
29 // Original included files, if any
30 #include "main/shim/metrics_api.h"
31 #include "test/common/mock_functions.h"
32 #include "types/raw_address.h"
33
34 // Mocked compile conditionals, if any
35 // Mocked internal structures, if any
36
37 namespace test {
38 namespace mock {
39 namespace main_shim_metrics_api {
40
41 // Function state capture and return values, if needed
42 struct LogMetricLinkLayerConnectionEvent LogMetricLinkLayerConnectionEvent;
43 struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
44 struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
45 struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
46 struct LogMetricA2dpSessionMetricsEvent LogMetricA2dpSessionMetricsEvent;
47 struct LogMetricHfpPacketLossStats LogMetricHfpPacketLossStats;
48 struct LogMetricMmcTranscodeRttStats LogMetricMmcTranscodeRttStats;
49 struct LogMetricReadRssiResult LogMetricReadRssiResult;
50 struct LogMetricReadFailedContactCounterResult LogMetricReadFailedContactCounterResult;
51 struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
52 struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
53 struct LogMetricLePairingFail LogMetricLePairingFail;
54 struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
55 struct LogMetricSdpAttribute LogMetricSdpAttribute;
56 struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
57 struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
58 struct LogMetricLeConnectionStatus LogMetricLeConnectionStatus;
59 struct LogMetricLeDeviceInAcceptList LogMetricLeDeviceInAcceptList;
60 struct LogMetricLeConnectionLifecycle LogMetricLeConnectionLifecycle;
61 struct LogMetricLeConnectionCompletion LogMetricLeConnectionCompletion;
62 struct LogMetricRfcommConnectionAtClose LogMetricRfcommConnectionAtClose;
63 struct LogMetricLeConnectionRejected LogMetricLeConnectionRejected;
64 struct LogMetricHfpAgVersion LogMetricHfpAgVersion;
65 struct LogMetricHfpHfVersion LogMetricHfpHfVersion;
66 struct LogMetricHfpRfcommChannelFail LogMetricHfpRfcommChannelFail;
67 struct LogMetricHfpRfcommCollisionFail LogMetricHfpRfcommCollisionFail;
68 struct LogMetricHfpRfcommAgOpenFail LogMetricHfpRfcommAgOpenFail;
69 struct LogMetricHfpSlcFail LogMetricHfpSlcFail;
70 struct LogMetricScoCodec LogMetricScoCodec;
71 struct LogMetricScoLinkCreated LogMetricScoLinkCreated;
72 struct LogMetricScoLinkRemoved LogMetricScoLinkRemoved;
73
74 } // namespace main_shim_metrics_api
75 } // namespace mock
76 } // namespace test
77
78 // Mocked functions, if any
LogMetricLinkLayerConnectionEvent(const RawAddress * raw_address,uint32_t connection_handle,android::bluetooth::DirectionEnum direction,uint16_t link_type,uint32_t hci_cmd,uint16_t hci_event,uint16_t hci_ble_event,uint16_t cmd_status,uint16_t reason_code)79 void bluetooth::shim::LogMetricLinkLayerConnectionEvent(const RawAddress* raw_address,
80 uint32_t connection_handle,
81 android::bluetooth::DirectionEnum direction,
82 uint16_t link_type, uint32_t hci_cmd,
83 uint16_t hci_event, uint16_t hci_ble_event,
84 uint16_t cmd_status, uint16_t reason_code) {
85 inc_func_call_count(__func__);
86 test::mock::main_shim_metrics_api::LogMetricLinkLayerConnectionEvent(
87 raw_address, connection_handle, direction, link_type, hci_cmd, hci_event, hci_ble_event,
88 cmd_status, reason_code);
89 }
LogMetricA2dpAudioUnderrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_missing_pcm_bytes)90 void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(const RawAddress& raw_address,
91 uint64_t encoding_interval_millis,
92 int num_missing_pcm_bytes) {
93 inc_func_call_count(__func__);
94 test::mock::main_shim_metrics_api::LogMetricA2dpAudioUnderrunEvent(
95 raw_address, encoding_interval_millis, num_missing_pcm_bytes);
96 }
LogMetricA2dpAudioOverrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_dropped_buffers,int num_dropped_encoded_frames,int num_dropped_encoded_bytes)97 void bluetooth::shim::LogMetricA2dpAudioOverrunEvent(const RawAddress& raw_address,
98 uint64_t encoding_interval_millis,
99 int num_dropped_buffers,
100 int num_dropped_encoded_frames,
101 int num_dropped_encoded_bytes) {
102 inc_func_call_count(__func__);
103 test::mock::main_shim_metrics_api::LogMetricA2dpAudioOverrunEvent(
104 raw_address, encoding_interval_millis, num_dropped_buffers, num_dropped_encoded_frames,
105 num_dropped_encoded_bytes);
106 }
LogMetricA2dpPlaybackEvent(const RawAddress & raw_address,int playback_state,int audio_coding_mode)107 void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address, int playback_state,
108 int audio_coding_mode) {
109 inc_func_call_count(__func__);
110 test::mock::main_shim_metrics_api::LogMetricA2dpPlaybackEvent(raw_address, playback_state,
111 audio_coding_mode);
112 }
LogMetricA2dpSessionMetricsEvent(const RawAddress & raw_address,int64_t audio_duration_ms,int media_timer_min_ms,int media_timer_max_ms,int,int total_scheduling_count,int buffer_overruns_max_count,int buffer_overruns_total,float buffer_underruns_average,int buffer_underruns_count,int64_t codec_index,bool is_a2dp_offload)113 void bluetooth::shim::LogMetricA2dpSessionMetricsEvent(
114 const RawAddress& raw_address, int64_t audio_duration_ms, int media_timer_min_ms,
115 int media_timer_max_ms, int /* media_timer_avg_ms */, int total_scheduling_count,
116 int buffer_overruns_max_count, int buffer_overruns_total, float buffer_underruns_average,
117 int buffer_underruns_count, int64_t codec_index, bool is_a2dp_offload) {
118 inc_func_call_count(__func__);
119 test::mock::main_shim_metrics_api::LogMetricA2dpSessionMetricsEvent(
120 raw_address, audio_duration_ms, media_timer_min_ms, media_timer_max_ms, audio_duration_ms,
121 total_scheduling_count, buffer_overruns_max_count, buffer_overruns_total,
122 buffer_underruns_average, buffer_underruns_count, codec_index, is_a2dp_offload);
123 }
LogMetricHfpPacketLossStats(const RawAddress & raw_address,int num_decoded_frames,double packet_loss_ratio,uint16_t codec_type)124 void bluetooth::shim::LogMetricHfpPacketLossStats(const RawAddress& raw_address,
125 int num_decoded_frames, double packet_loss_ratio,
126 uint16_t codec_type) {
127 inc_func_call_count(__func__);
128 test::mock::main_shim_metrics_api::LogMetricHfpPacketLossStats(raw_address, num_decoded_frames,
129 packet_loss_ratio, codec_type);
130 }
LogMetricMmcTranscodeRttStats(int maximum_rtt,double mean_rtt,int num_requests,int codec_type)131 void bluetooth::shim::LogMetricMmcTranscodeRttStats(int maximum_rtt, double mean_rtt,
132 int num_requests, int codec_type) {
133 inc_func_call_count(__func__);
134 test::mock::main_shim_metrics_api::LogMetricMmcTranscodeRttStats(maximum_rtt, mean_rtt,
135 num_requests, codec_type);
136 }
LogMetricReadRssiResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int8_t rssi)137 void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address, uint16_t handle,
138 uint32_t cmd_status, int8_t rssi) {
139 inc_func_call_count(__func__);
140 test::mock::main_shim_metrics_api::LogMetricReadRssiResult(raw_address, handle, cmd_status, rssi);
141 }
LogMetricReadFailedContactCounterResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t failed_contact_counter)142 void bluetooth::shim::LogMetricReadFailedContactCounterResult(const RawAddress& raw_address,
143 uint16_t handle, uint32_t cmd_status,
144 int32_t failed_contact_counter) {
145 inc_func_call_count(__func__);
146 test::mock::main_shim_metrics_api::LogMetricReadFailedContactCounterResult(
147 raw_address, handle, cmd_status, failed_contact_counter);
148 }
LogMetricReadTxPowerLevelResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t transmit_power_level)149 void bluetooth::shim::LogMetricReadTxPowerLevelResult(const RawAddress& raw_address,
150 uint16_t handle, uint32_t cmd_status,
151 int32_t transmit_power_level) {
152 inc_func_call_count(__func__);
153 test::mock::main_shim_metrics_api::LogMetricReadTxPowerLevelResult(
154 raw_address, handle, cmd_status, transmit_power_level);
155 }
LogMetricSmpPairingEvent(const RawAddress & raw_address,uint16_t smp_cmd,android::bluetooth::DirectionEnum direction,uint16_t smp_fail_reason)156 void bluetooth::shim::LogMetricSmpPairingEvent(const RawAddress& raw_address, uint16_t smp_cmd,
157 android::bluetooth::DirectionEnum direction,
158 uint16_t smp_fail_reason) {
159 inc_func_call_count(__func__);
160 test::mock::main_shim_metrics_api::LogMetricSmpPairingEvent(raw_address, smp_cmd, direction,
161 smp_fail_reason);
162 }
LogMetricLePairingFail(const RawAddress & raw_address,uint8_t failure_reason,bool is_outgoing)163 void bluetooth::shim::LogMetricLePairingFail(const RawAddress& raw_address, uint8_t failure_reason,
164 bool is_outgoing) {
165 inc_func_call_count(__func__);
166 test::mock::main_shim_metrics_api::LogMetricLePairingFail(raw_address, failure_reason,
167 is_outgoing);
168 }
LogMetricClassicPairingEvent(const RawAddress & raw_address,uint16_t handle,uint32_t hci_cmd,uint16_t hci_event,uint16_t cmd_status,uint16_t reason_code,int64_t event_value)169 void bluetooth::shim::LogMetricClassicPairingEvent(const RawAddress& raw_address, uint16_t handle,
170 uint32_t hci_cmd, uint16_t hci_event,
171 uint16_t cmd_status, uint16_t reason_code,
172 int64_t event_value) {
173 inc_func_call_count(__func__);
174 test::mock::main_shim_metrics_api::LogMetricClassicPairingEvent(
175 raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code, event_value);
176 }
LogMetricSdpAttribute(const RawAddress & raw_address,uint16_t protocol_uuid,uint16_t attribute_id,size_t attribute_size,const char * attribute_value)177 void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address, uint16_t protocol_uuid,
178 uint16_t attribute_id, size_t attribute_size,
179 const char* attribute_value) {
180 inc_func_call_count(__func__);
181 test::mock::main_shim_metrics_api::LogMetricSdpAttribute(raw_address, protocol_uuid, attribute_id,
182 attribute_size, attribute_value);
183 }
LogMetricSocketConnectionState(const RawAddress & raw_address,int port,int type,android::bluetooth::SocketConnectionstateEnum connection_state,int64_t tx_bytes,int64_t rx_bytes,int uid,int server_port,android::bluetooth::SocketRoleEnum socket_role,uint64_t connection_duration_ms,android::bluetooth::SocketErrorEnum error_code,bool is_hardware_offload)184 void bluetooth::shim::LogMetricSocketConnectionState(
185 const RawAddress& raw_address, int port, int type,
186 android::bluetooth::SocketConnectionstateEnum connection_state, int64_t tx_bytes,
187 int64_t rx_bytes, int uid, int server_port, android::bluetooth::SocketRoleEnum socket_role,
188 uint64_t connection_duration_ms, android::bluetooth::SocketErrorEnum error_code,
189 bool is_hardware_offload) {
190 inc_func_call_count(__func__);
191 test::mock::main_shim_metrics_api::LogMetricSocketConnectionState(
192 raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid, server_port,
193 socket_role, connection_duration_ms, error_code, is_hardware_offload);
194 }
LogMetricManufacturerInfo(const RawAddress & raw_address,android::bluetooth::AddressTypeEnum address_type,android::bluetooth::DeviceInfoSrcEnum source_type,const std::string & source_name,const std::string & manufacturer,const std::string & model,const std::string & hardware_version,const std::string & software_version)195 void bluetooth::shim::LogMetricManufacturerInfo(
196 const RawAddress& raw_address, android::bluetooth::AddressTypeEnum address_type,
197 android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name,
198 const std::string& manufacturer, const std::string& model,
199 const std::string& hardware_version, const std::string& software_version) {
200 inc_func_call_count(__func__);
201 test::mock::main_shim_metrics_api::LogMetricManufacturerInfo(
202 raw_address, address_type, source_type, source_name, manufacturer, model,
203 hardware_version, software_version);
204 }
CountCounterMetrics(int32_t,int64_t)205 bool bluetooth::shim::CountCounterMetrics(int32_t /* key */, int64_t /* count */) {
206 inc_func_call_count(__func__);
207 return false;
208 }
LogMetricLeConnectionStatus(bluetooth::hci::Address address,bool is_connect,bluetooth::hci::ErrorCode reason)209 void bluetooth::shim::LogMetricLeConnectionStatus(bluetooth::hci::Address address, bool is_connect,
210 bluetooth::hci::ErrorCode reason) {
211 inc_func_call_count(__func__);
212 test::mock::main_shim_metrics_api::LogMetricLeConnectionStatus(address, is_connect, reason);
213 }
LogMetricLeDeviceInAcceptList(bluetooth::hci::Address address,bool is_add)214 void bluetooth::shim::LogMetricLeDeviceInAcceptList(bluetooth::hci::Address address, bool is_add) {
215 inc_func_call_count(__func__);
216 test::mock::main_shim_metrics_api::LogMetricLeDeviceInAcceptList(address, is_add);
217 }
LogMetricLeConnectionLifecycle(bluetooth::hci::Address address,bool is_connect,bool is_direct)218 void bluetooth::shim::LogMetricLeConnectionLifecycle(bluetooth::hci::Address address,
219 bool is_connect, bool is_direct) {
220 inc_func_call_count(__func__);
221 test::mock::main_shim_metrics_api::LogMetricLeConnectionLifecycle(address, is_connect, is_direct);
222 }
LogMetricLeConnectionCompletion(bluetooth::hci::Address address,bluetooth::hci::ErrorCode reason,bool is_locally_initiated)223 void bluetooth::shim::LogMetricLeConnectionCompletion(bluetooth::hci::Address address,
224 bluetooth::hci::ErrorCode reason,
225 bool is_locally_initiated) {
226 inc_func_call_count(__func__);
227 test::mock::main_shim_metrics_api::LogMetricLeConnectionCompletion(address, reason,
228 is_locally_initiated);
229 }
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)230 void bluetooth::shim::LogMetricRfcommConnectionAtClose(
231 const RawAddress& raw_address, android::bluetooth::rfcomm::PortResult close_reason,
232 android::bluetooth::rfcomm::SocketConnectionSecurity security,
233 android::bluetooth::rfcomm::RfcommPortEvent last_event,
234 android::bluetooth::rfcomm::RfcommPortState previous_state, int32_t open_duration_ms,
235 int32_t uid, android::bluetooth::BtaStatus sdp_status, bool is_server, bool sdp_initiated,
236 int32_t sdp_duration_ms) {
237 inc_func_call_count(__func__);
238 test::mock::main_shim_metrics_api::LogMetricRfcommConnectionAtClose(
239 raw_address, close_reason, security, last_event, previous_state, open_duration_ms, uid,
240 sdp_status, is_server, sdp_initiated, sdp_duration_ms);
241 }
242
LogMetricLeConnectionRejected(bluetooth::hci::Address address)243 void bluetooth::shim::LogMetricLeConnectionRejected(bluetooth::hci::Address address) {
244 inc_func_call_count(__func__);
245 test::mock::main_shim_metrics_api::LogMetricLeConnectionRejected(address);
246 }
247
LogMetricHfpAgVersion(bluetooth::hci::Address address,uint16_t version)248 void bluetooth::shim::LogMetricHfpAgVersion(bluetooth::hci::Address address, uint16_t version) {
249 inc_func_call_count(__func__);
250 test::mock::main_shim_metrics_api::LogMetricHfpAgVersion(address, version);
251 }
252
LogMetricHfpHfVersion(bluetooth::hci::Address address,uint16_t version)253 void bluetooth::shim::LogMetricHfpHfVersion(bluetooth::hci::Address address, uint16_t version) {
254 inc_func_call_count(__func__);
255 test::mock::main_shim_metrics_api::LogMetricHfpHfVersion(address, version);
256 }
257
LogMetricHfpRfcommChannelFail(bluetooth::hci::Address address)258 void bluetooth::shim::LogMetricHfpRfcommChannelFail(bluetooth::hci::Address address) {
259 inc_func_call_count(__func__);
260 test::mock::main_shim_metrics_api::LogMetricHfpRfcommChannelFail(address);
261 }
262
LogMetricHfpRfcommCollisionFail(bluetooth::hci::Address address)263 void bluetooth::shim::LogMetricHfpRfcommCollisionFail(bluetooth::hci::Address address) {
264 inc_func_call_count(__func__);
265 test::mock::main_shim_metrics_api::LogMetricHfpRfcommCollisionFail(address);
266 }
267
LogMetricHfpRfcommAgOpenFail(bluetooth::hci::Address address)268 void bluetooth::shim::LogMetricHfpRfcommAgOpenFail(bluetooth::hci::Address address) {
269 inc_func_call_count(__func__);
270 test::mock::main_shim_metrics_api::LogMetricHfpRfcommAgOpenFail(address);
271 }
272
LogMetricHfpSlcFail(bluetooth::hci::Address address)273 void bluetooth::shim::LogMetricHfpSlcFail(bluetooth::hci::Address address) {
274 inc_func_call_count(__func__);
275 test::mock::main_shim_metrics_api::LogMetricHfpSlcFail(address);
276 }
277
LogMetricScoCodec(bluetooth::hci::Address address,uint16_t codec)278 void bluetooth::shim::LogMetricScoCodec(bluetooth::hci::Address address, uint16_t codec) {
279 inc_func_call_count(__func__);
280 test::mock::main_shim_metrics_api::LogMetricScoCodec(address, codec);
281 }
282
LogMetricScoLinkCreated(bluetooth::hci::Address address)283 void bluetooth::shim::LogMetricScoLinkCreated(bluetooth::hci::Address address) {
284 inc_func_call_count(__func__);
285 test::mock::main_shim_metrics_api::LogMetricScoLinkCreated(address);
286 }
287
LogMetricScoLinkRemoved(bluetooth::hci::Address address)288 void bluetooth::shim::LogMetricScoLinkRemoved(bluetooth::hci::Address address) {
289 inc_func_call_count(__func__);
290 test::mock::main_shim_metrics_api::LogMetricScoLinkRemoved(address);
291 }
292
293 // END mockcify generation
294