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:36
20  */
21 
22 #include <map>
23 #include <string>
24 
25 extern std::map<std::string, int> mock_function_count_map;
26 
27 #include "common/metrics.h"
28 
29 #if 0
30 #include <base/base64.h>
31 #include <base/logging.h>
32 #include <include/hardware/bt_av.h>
33 #include <statslog.h>
34 #include <unistd.h>
35 #include <algorithm>
36 #include <array>
37 #include <cerrno>
38 #include <chrono>
39 #include <cstdint>
40 #include <cstring>
41 #include <memory>
42 #include <mutex>
43 #include "address_obfuscator.h"
44 #include "bluetooth/metrics/bluetooth.pb.h"
45 #include "leaky_bonded_queue.h"
46 #include "metric_id_allocator.h"
47 #include "osi/include/osi.h"
48 #include "stack/include/btm_api_types.h"
49 #include "time_util.h"
50 #endif
51 
52 #ifndef UNUSED_ATTR
53 #define UNUSED_ATTR
54 #endif
55 
56 namespace bluetooth {
57 namespace common {
58 
Update(const A2dpSessionMetrics & metrics)59 void A2dpSessionMetrics::Update(const A2dpSessionMetrics& metrics) {
60   mock_function_count_map[__func__]++;
61 }
62 
63 struct BluetoothMetricsLogger::impl {
64   int mock{123};
65 };
66 
BluetoothMetricsLogger()67 BluetoothMetricsLogger::BluetoothMetricsLogger() {}
Build()68 void BluetoothMetricsLogger::Build() { mock_function_count_map[__func__]++; }
CutoffSession()69 void BluetoothMetricsLogger::CutoffSession() {
70   mock_function_count_map[__func__]++;
71 }
LogA2dpSession(const A2dpSessionMetrics & a2dp_session_metrics)72 void BluetoothMetricsLogger::LogA2dpSession(
73     const A2dpSessionMetrics& a2dp_session_metrics) {
74   mock_function_count_map[__func__]++;
75 }
LogBluetoothSessionDeviceInfo(uint32_t device_class,device_type_t device_type)76 void BluetoothMetricsLogger::LogBluetoothSessionDeviceInfo(
77     uint32_t device_class, device_type_t device_type) {
78   mock_function_count_map[__func__]++;
79 }
LogBluetoothSessionEnd(disconnect_reason_t disconnect_reason,uint64_t timestamp_ms)80 void BluetoothMetricsLogger::LogBluetoothSessionEnd(
81     disconnect_reason_t disconnect_reason, uint64_t timestamp_ms) {
82   mock_function_count_map[__func__]++;
83 }
LogBluetoothSessionStart(connection_tech_t connection_tech_type,uint64_t timestamp_ms)84 void BluetoothMetricsLogger::LogBluetoothSessionStart(
85     connection_tech_t connection_tech_type, uint64_t timestamp_ms) {
86   mock_function_count_map[__func__]++;
87 }
LogHeadsetProfileRfcConnection(tBTA_SERVICE_ID service_id)88 void BluetoothMetricsLogger::LogHeadsetProfileRfcConnection(
89     tBTA_SERVICE_ID service_id) {
90   mock_function_count_map[__func__]++;
91 }
LogPairEvent(uint32_t disconnect_reason,uint64_t timestamp_ms,uint32_t device_class,device_type_t device_type)92 void BluetoothMetricsLogger::LogPairEvent(uint32_t disconnect_reason,
93                                           uint64_t timestamp_ms,
94                                           uint32_t device_class,
95                                           device_type_t device_type) {
96   mock_function_count_map[__func__]++;
97 }
LogScanEvent(bool start,const std::string & initator,scan_tech_t type,uint32_t results,uint64_t timestamp_ms)98 void BluetoothMetricsLogger::LogScanEvent(bool start,
99                                           const std::string& initator,
100                                           scan_tech_t type, uint32_t results,
101                                           uint64_t timestamp_ms) {
102   mock_function_count_map[__func__]++;
103 }
LogWakeEvent(wake_event_type_t type,const std::string & requestor,const std::string & name,uint64_t timestamp_ms)104 void BluetoothMetricsLogger::LogWakeEvent(wake_event_type_t type,
105                                           const std::string& requestor,
106                                           const std::string& name,
107                                           uint64_t timestamp_ms) {
108   mock_function_count_map[__func__]++;
109 }
Reset()110 void BluetoothMetricsLogger::Reset() { mock_function_count_map[__func__]++; }
ResetLog()111 void BluetoothMetricsLogger::ResetLog() { mock_function_count_map[__func__]++; }
ResetSession()112 void BluetoothMetricsLogger::ResetSession() {
113   mock_function_count_map[__func__]++;
114 }
WriteBase64(int fd)115 void BluetoothMetricsLogger::WriteBase64(int fd) {
116   mock_function_count_map[__func__]++;
117 }
WriteBase64String(std::string * serialized)118 void BluetoothMetricsLogger::WriteBase64String(std::string* serialized) {
119   mock_function_count_map[__func__]++;
120 }
WriteString(std::string * serialized)121 void BluetoothMetricsLogger::WriteString(std::string* serialized) {
122   mock_function_count_map[__func__]++;
123 }
LogA2dpAudioOverrunEvent(const RawAddress & address,uint64_t encoding_interval_millis,int num_dropped_buffers,int num_dropped_encoded_frames,int num_dropped_encoded_bytes)124 void LogA2dpAudioOverrunEvent(const RawAddress& address,
125                               uint64_t encoding_interval_millis,
126                               int num_dropped_buffers,
127                               int num_dropped_encoded_frames,
128                               int num_dropped_encoded_bytes) {
129   mock_function_count_map[__func__]++;
130 }
LogA2dpAudioUnderrunEvent(const RawAddress & address,uint64_t encoding_interval_millis,int num_missing_pcm_bytes)131 void LogA2dpAudioUnderrunEvent(const RawAddress& address,
132                                uint64_t encoding_interval_millis,
133                                int num_missing_pcm_bytes) {
134   mock_function_count_map[__func__]++;
135 }
LogA2dpPlaybackEvent(const RawAddress & address,int playback_state,int audio_coding_mode)136 void LogA2dpPlaybackEvent(const RawAddress& address, int playback_state,
137                           int audio_coding_mode) {
138   mock_function_count_map[__func__]++;
139 }
LogBluetoothHalCrashReason(const RawAddress & address,uint32_t error_code,uint32_t vendor_error_code)140 void LogBluetoothHalCrashReason(const RawAddress& address, uint32_t error_code,
141                                 uint32_t vendor_error_code) {
142   mock_function_count_map[__func__]++;
143 }
LogClassicPairingEvent(const RawAddress & address,uint16_t handle,uint32_t hci_cmd,uint16_t hci_event,uint16_t cmd_status,uint16_t reason_code,int64_t event_value)144 void LogClassicPairingEvent(const RawAddress& address, uint16_t handle,
145                             uint32_t hci_cmd, uint16_t hci_event,
146                             uint16_t cmd_status, uint16_t reason_code,
147                             int64_t event_value) {
148   mock_function_count_map[__func__]++;
149 }
LogHciTimeoutEvent(uint32_t hci_cmd)150 void LogHciTimeoutEvent(uint32_t hci_cmd) {
151   mock_function_count_map[__func__]++;
152 }
LogLinkLayerConnectionEvent(const RawAddress * 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)153 void LogLinkLayerConnectionEvent(const RawAddress* address,
154                                  uint32_t connection_handle,
155                                  android::bluetooth::DirectionEnum direction,
156                                  uint16_t link_type, uint32_t hci_cmd,
157                                  uint16_t hci_event, uint16_t hci_ble_event,
158                                  uint16_t cmd_status, uint16_t reason_code) {
159   mock_function_count_map[__func__]++;
160 }
LogManufacturerInfo(const RawAddress & address,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)161 void LogManufacturerInfo(const RawAddress& address,
162                          android::bluetooth::DeviceInfoSrcEnum source_type,
163                          const std::string& source_name,
164                          const std::string& manufacturer,
165                          const std::string& model,
166                          const std::string& hardware_version,
167                          const std::string& software_version) {
168   mock_function_count_map[__func__]++;
169 }
LogReadFailedContactCounterResult(const RawAddress & address,uint16_t handle,uint32_t cmd_status,int32_t failed_contact_counter)170 void LogReadFailedContactCounterResult(const RawAddress& address,
171                                        uint16_t handle, uint32_t cmd_status,
172                                        int32_t failed_contact_counter) {
173   mock_function_count_map[__func__]++;
174 }
LogReadRssiResult(const RawAddress & address,uint16_t handle,uint32_t cmd_status,int8_t rssi)175 void LogReadRssiResult(const RawAddress& address, uint16_t handle,
176                        uint32_t cmd_status, int8_t rssi) {
177   mock_function_count_map[__func__]++;
178 }
LogReadTxPowerLevelResult(const RawAddress & address,uint16_t handle,uint32_t cmd_status,int32_t transmit_power_level)179 void LogReadTxPowerLevelResult(const RawAddress& address, uint16_t handle,
180                                uint32_t cmd_status,
181                                int32_t transmit_power_level) {
182   mock_function_count_map[__func__]++;
183 }
LogRemoteVersionInfo(uint16_t handle,uint8_t status,uint8_t version,uint16_t manufacturer_name,uint16_t subversion)184 void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
185                           uint16_t manufacturer_name, uint16_t subversion) {
186   mock_function_count_map[__func__]++;
187 }
LogSdpAttribute(const RawAddress & address,uint16_t protocol_uuid,uint16_t attribute_id,size_t attribute_size,const char * attribute_value)188 void LogSdpAttribute(const RawAddress& address, uint16_t protocol_uuid,
189                      uint16_t attribute_id, size_t attribute_size,
190                      const char* attribute_value) {
191   mock_function_count_map[__func__]++;
192 }
LogSmpPairingEvent(const RawAddress & address,uint8_t smp_cmd,android::bluetooth::DirectionEnum direction,uint8_t smp_fail_reason)193 void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd,
194                         android::bluetooth::DirectionEnum direction,
195                         uint8_t smp_fail_reason) {
196   mock_function_count_map[__func__]++;
197 }
LogSocketConnectionState(const RawAddress & 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)198 void LogSocketConnectionState(
199     const RawAddress& address, int port, int type,
200     android::bluetooth::SocketConnectionstateEnum connection_state,
201     int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
202     android::bluetooth::SocketRoleEnum socket_role) {
203   mock_function_count_map[__func__]++;
204 }
205 
206 }  // namespace common
207 }  // namespace bluetooth
208