Fix A2DP Metrics Logging Capacity
* Set the maximum number of wake events logged to 1000
* Stop logging wake log name as it takes too much memory
* Add counters for each of the repeated values in BluetoothLog so that
the true number of events can be determined while oldest event get
dropped
* Log Bluetooth session disconnect reasons using enum instead of string
in order to save memory usage
* Apply changes to bluetooth.proto in ag/1460462 on system/bt
Bug: 33694310
Test: Code compilation and unit tests
Change-Id: I2cc6f9304725938b63b211d615eb1941eac60edf
diff --git a/btif/src/btif_media_task.c b/btif/src/btif_media_task.c
index 62b4ea8..7179ffb 100644
--- a/btif/src/btif_media_task.c
+++ b/btif/src/btif_media_task.c
@@ -1527,7 +1527,7 @@
/* Clear media task flag */
media_task_running = MEDIA_TASK_STATE_OFF;
- metrics_log_bluetooth_session_end("A2DP_SHUTDOWN", 0);
+ metrics_log_bluetooth_session_end(DISCONNECT_REASON_UNKNOWN, 0);
}
/*******************************************************************************
diff --git a/osi/include/metrics.h b/osi/include/metrics.h
index ea3b74a..4ef12b2 100644
--- a/osi/include/metrics.h
+++ b/osi/include/metrics.h
@@ -51,6 +51,12 @@
CONNECTION_TECHNOLOGY_TYPE_BREDR,
} connection_tech_t;
+typedef enum {
+ DISCONNECT_REASON_UNKNOWN,
+ DISCONNECT_REASON_METRICS_DUMP,
+ DISCONNECT_REASON_NEXT_START_WITHOUT_END_PREVIOUS,
+} disconnect_reason_t;
+
typedef struct {
int64_t audio_duration_ms;
int32_t media_timer_min_ms;
@@ -75,7 +81,7 @@
void metrics_log_bluetooth_session_start(connection_tech_t connection_tech_type,
uint64_t timestamp_ms);
-void metrics_log_bluetooth_session_end(const char* disconnect_reason,
+void metrics_log_bluetooth_session_end(disconnect_reason_t disconnect_reason,
uint64_t timestamp_ms);
void metrics_log_bluetooth_session_device_info(uint32_t device_class,
diff --git a/osi/include/metrics_cpp.h b/osi/include/metrics_cpp.h
index 2f4a5ea..dcba21c 100644
--- a/osi/include/metrics_cpp.h
+++ b/osi/include/metrics_cpp.h
@@ -142,7 +142,7 @@
* timestamp_ms : the timestamp of session end, 0 means now
*
*/
- void LogBluetoothSessionEnd(const std::string& disconnect_reason,
+ void LogBluetoothSessionEnd(disconnect_reason_t disconnect_reason,
uint64_t timestamp_ms);
/*
@@ -186,6 +186,14 @@
*/
void Reset();
+ /*
+ * Maximum number of log entries for each session or event
+ */
+ static const size_t kMaxNumBluetoothSession = 50;
+ static const size_t kMaxNumPairEvent = 50;
+ static const size_t kMaxNumWakeEvent = 1000;
+ static const size_t kMaxNumScanEvent = 50;
+
private:
BluetoothMetricsLogger();
diff --git a/osi/src/metrics.cpp b/osi/src/metrics.cpp
index a9161a3..dd67c4c 100644
--- a/osi/src/metrics.cpp
+++ b/osi/src/metrics.cpp
@@ -45,6 +45,7 @@
using clearcut::connectivity::BluetoothLog;
using clearcut::connectivity::BluetoothSession;
using clearcut::connectivity::BluetoothSession_ConnectionTechnologyType;
+using clearcut::connectivity::BluetoothSession_DisconnectReasonType;
using clearcut::connectivity::DeviceInfo;
using clearcut::connectivity::DeviceInfo_DeviceType;
using clearcut::connectivity::PairEvent;
@@ -54,17 +55,6 @@
using clearcut::connectivity::WakeEvent;
using clearcut::connectivity::WakeEvent_WakeEventType;
-namespace {
-// Maximum number of log entries for each repeated field
-const size_t global_max_num_bluetooth_session = 50;
-const size_t global_max_num_pair_event = 50;
-const size_t global_max_num_wake_event = 50;
-const size_t global_max_num_scan_event = 50;
-const std::string global_next_session_start_without_ending_previous =
- "NEXT_SESSION_START_WITHOUT_ENDING_PREVIOUS";
-const std::string global_metrics_dump = "METRICS_DUMP";
-}
-
uint64_t metrics_time_get_os_boottime_us(void) {
struct timespec ts_now;
clock_gettime(CLOCK_BOOTTIME, &ts_now);
@@ -225,6 +215,22 @@
}
}
+static BluetoothSession_DisconnectReasonType get_disconnect_reason_type(
+ disconnect_reason_t type) {
+ switch (type) {
+ case DISCONNECT_REASON_METRICS_DUMP:
+ return BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_METRICS_DUMP;
+ case DISCONNECT_REASON_NEXT_START_WITHOUT_END_PREVIOUS:
+ return BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_NEXT_START_WITHOUT_END_PREVIOUS;
+ case DISCONNECT_REASON_UNKNOWN:
+ default:
+ return BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_UNKNOWN;
+ }
+}
+
struct BluetoothMetricsLogger::impl {
impl(size_t max_bluetooth_session, size_t max_pair_event,
size_t max_wake_event, size_t max_scan_event)
@@ -256,9 +262,8 @@
};
BluetoothMetricsLogger::BluetoothMetricsLogger()
- : pimpl_(new impl(global_max_num_bluetooth_session,
- global_max_num_pair_event, global_max_num_wake_event,
- global_max_num_scan_event)) {}
+ : pimpl_(new impl(kMaxNumBluetoothSession, kMaxNumPairEvent,
+ kMaxNumWakeEvent, kMaxNumScanEvent)) {}
void BluetoothMetricsLogger::LogPairEvent(uint32_t disconnect_reason,
uint64_t timestamp_ms,
@@ -271,6 +276,11 @@
event->set_disconnect_reason(disconnect_reason);
event->set_event_time_millis(timestamp_ms);
pimpl_->pair_event_queue_->Enqueue(event);
+ {
+ std::lock_guard<std::recursive_mutex> lock(pimpl_->bluetooth_log_lock_);
+ pimpl_->bluetooth_log_->set_num_pair_event(
+ pimpl_->bluetooth_log_->num_pair_event() + 1);
+ }
}
void BluetoothMetricsLogger::LogWakeEvent(wake_event_type_t type,
@@ -283,6 +293,11 @@
event->set_name(name);
event->set_event_time_millis(timestamp_ms);
pimpl_->wake_event_queue_->Enqueue(event);
+ {
+ std::lock_guard<std::recursive_mutex> lock(pimpl_->bluetooth_log_lock_);
+ pimpl_->bluetooth_log_->set_num_wake_event(
+ pimpl_->bluetooth_log_->num_wake_event() + 1);
+ }
}
void BluetoothMetricsLogger::LogScanEvent(bool start,
@@ -300,14 +315,19 @@
event->set_number_results(results);
event->set_event_time_millis(timestamp_ms);
pimpl_->scan_event_queue_->Enqueue(event);
+ {
+ std::lock_guard<std::recursive_mutex> lock(pimpl_->bluetooth_log_lock_);
+ pimpl_->bluetooth_log_->set_num_scan_event(
+ pimpl_->bluetooth_log_->num_scan_event() + 1);
+ }
}
void BluetoothMetricsLogger::LogBluetoothSessionStart(
connection_tech_t connection_tech_type, uint64_t timestamp_ms) {
std::lock_guard<std::recursive_mutex> lock(pimpl_->bluetooth_session_lock_);
if (pimpl_->bluetooth_session_ != nullptr) {
- LogBluetoothSessionEnd(global_next_session_start_without_ending_previous,
- 0);
+ LogBluetoothSessionEnd(DISCONNECT_REASON_NEXT_START_WITHOUT_END_PREVIOUS,
+ 0);
}
if (timestamp_ms == 0) {
timestamp_ms = time_get_os_boottime_ms();
@@ -319,7 +339,7 @@
}
void BluetoothMetricsLogger::LogBluetoothSessionEnd(
- const std::string& disconnect_reason, uint64_t timestamp_ms) {
+ disconnect_reason_t disconnect_reason, uint64_t timestamp_ms) {
std::lock_guard<std::recursive_mutex> lock(pimpl_->bluetooth_session_lock_);
if (pimpl_->bluetooth_session_ == nullptr) {
return;
@@ -330,9 +350,15 @@
int64_t session_duration_sec =
(timestamp_ms - pimpl_->bluetooth_session_start_time_ms_) / 1000;
pimpl_->bluetooth_session_->set_session_duration_sec(session_duration_sec);
- pimpl_->bluetooth_session_->set_disconnect_reason(disconnect_reason);
+ pimpl_->bluetooth_session_->set_disconnect_reason_type(
+ get_disconnect_reason_type(disconnect_reason));
pimpl_->bt_session_queue_->Enqueue(pimpl_->bluetooth_session_);
pimpl_->bluetooth_session_ = nullptr;
+ {
+ std::lock_guard<std::recursive_mutex> log_lock(pimpl_->bluetooth_log_lock_);
+ pimpl_->bluetooth_log_->set_num_bluetooth_session(
+ pimpl_->bluetooth_log_->num_bluetooth_session() + 1);
+ }
}
void BluetoothMetricsLogger::LogBluetoothSessionDeviceInfo(
@@ -416,7 +442,7 @@
new BluetoothSession(*pimpl_->bluetooth_session_);
new_bt_session->clear_a2dp_session();
new_bt_session->clear_rfcomm_session();
- LogBluetoothSessionEnd(global_metrics_dump, 0);
+ LogBluetoothSessionEnd(DISCONNECT_REASON_METRICS_DUMP, 0);
pimpl_->bluetooth_session_ = new_bt_session;
pimpl_->bluetooth_session_start_time_ms_ = time_get_os_boottime_ms();
pimpl_->a2dp_session_metrics_ = A2dpSessionMetrics();
@@ -514,11 +540,10 @@
connection_tech_type, 0);
}
-void metrics_log_bluetooth_session_end(const char* disconnect_reason,
+void metrics_log_bluetooth_session_end(disconnect_reason_t disconnect_reason,
uint64_t timestamp_ms) {
- std::string disconnect_reason_str(disconnect_reason);
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd(
- disconnect_reason_str, timestamp_ms);
+ disconnect_reason, timestamp_ms);
}
void metrics_log_bluetooth_session_device_info(uint32_t device_class,
diff --git a/osi/src/protos/bluetooth.proto b/osi/src/protos/bluetooth.proto
index 0ecfac1..14c1ef2 100644
--- a/osi/src/protos/bluetooth.proto
+++ b/osi/src/protos/bluetooth.proto
@@ -24,6 +24,21 @@
// Scan event information.
repeated ScanEvent scan_event = 4;
+
+ // Number of bonded devices.
+ optional int32 num_bonded_devices = 5;
+
+ // Number of BluetoothSession including discarded ones beyond capacity
+ optional int64 num_bluetooth_session = 6;
+
+ // Number of PairEvent including discarded ones beyond capacity
+ optional int64 num_pair_event = 7;
+
+ // Number of WakeEvent including discarded ones beyond capacity
+ optional int64 num_wake_event = 8;
+
+ // Number of ScanEvent including discarded ones beyond capacity
+ optional int64 num_scan_event = 9;
}
// The information about the device.
@@ -63,6 +78,17 @@
CONNECTION_TECHNOLOGY_TYPE_BREDR = 2;
}
+ enum DisconnectReasonType {
+ UNKNOWN = 0;
+
+ // A metrics dump takes a snapshot of current Bluetooth session and thus
+ // is not a real disconnect, but a discontinuation in metrics logging.
+ // This enum indicates this situation.
+ METRICS_DUMP = 1;
+
+ NEXT_START_WITHOUT_END_PREVIOUS = 2;
+ }
+
// Duration of the session.
optional int64 session_duration_sec = 2;
@@ -70,7 +96,7 @@
optional ConnectionTechnologyType connection_technology_type = 3;
// Reason for disconnecting.
- optional string disconnect_reason = 4;
+ optional string disconnect_reason = 4 [deprecated=true];
// The information about the device which it is connected to.
optional DeviceInfo device_connected_to = 5;
@@ -80,6 +106,9 @@
// The information about the A2DP audio session.
optional A2DPSession a2dp_session = 7;
+
+ // Numeric reason for disconnecting as defined in metrics.h
+ optional DisconnectReasonType disconnect_reason_type = 8;
}
message RFCommSession {
diff --git a/osi/src/wakelock.c b/osi/src/wakelock.c
index 2c79dcd..9681bd0 100644
--- a/osi/src/wakelock.c
+++ b/osi/src/wakelock.c
@@ -294,7 +294,7 @@
pthread_mutex_unlock(&monitor);
- metrics_log_wake_event(WAKE_EVENT_ACQUIRED, "", WAKE_LOCK_ID, now_ms);
+ metrics_log_wake_event(WAKE_EVENT_ACQUIRED, "", "", now_ms);
}
//
@@ -338,7 +338,7 @@
pthread_mutex_unlock(&monitor);
- metrics_log_wake_event(WAKE_EVENT_RELEASED, "", WAKE_LOCK_ID, now_ms);
+ metrics_log_wake_event(WAKE_EVENT_RELEASED, "", "", now_ms);
}
void wakelock_debug_dump(int fd) {
diff --git a/osi/test/metrics_test.cpp b/osi/test/metrics_test.cpp
index 8ed4948..597e4b3 100644
--- a/osi/test/metrics_test.cpp
+++ b/osi/test/metrics_test.cpp
@@ -39,6 +39,7 @@
using clearcut::connectivity::BluetoothLog;
using clearcut::connectivity::BluetoothSession;
using clearcut::connectivity::BluetoothSession_ConnectionTechnologyType;
+using clearcut::connectivity::BluetoothSession_DisconnectReasonType;
using clearcut::connectivity::DeviceInfo;
using clearcut::connectivity::DeviceInfo_DeviceType;
using clearcut::connectivity::PairEvent;
@@ -51,6 +52,10 @@
using system_bt_osi::BluetoothMetricsLogger;
using system_bt_osi::A2dpSessionMetrics;
+namespace {
+const size_t kMaxEventGenerationLimit = 5000;
+}
+
uint64_t metrics_time_get_os_boottime_us(void) {
struct timespec ts_now;
clock_gettime(CLOCK_BOOTTIME, &ts_now);
@@ -127,15 +132,16 @@
BluetoothSession* MakeBluetoothSession(
int64_t session_duration_sec,
BluetoothSession_ConnectionTechnologyType conn_type,
- const std::string& disconnect_reason, DeviceInfo* device_info,
- RFCommSession* rfcomm_session, A2DPSession* a2dp_session) {
+ BluetoothSession_DisconnectReasonType disconnect_reason,
+ DeviceInfo* device_info, RFCommSession* rfcomm_session,
+ A2DPSession* a2dp_session) {
BluetoothSession* session = new BluetoothSession();
if (a2dp_session) session->set_allocated_a2dp_session(a2dp_session);
if (rfcomm_session) session->set_allocated_rfcomm_session(rfcomm_session);
if (device_info) session->set_allocated_device_connected_to(device_info);
session->set_session_duration_sec(session_duration_sec);
session->set_connection_technology_type(conn_type);
- session->set_disconnect_reason(disconnect_reason);
+ session->set_disconnect_reason_type(disconnect_reason);
return session;
}
@@ -163,9 +169,9 @@
return bt_log;
}
-void GenerateWakeEvents(int start, int end,
+void GenerateWakeEvents(size_t start, size_t end,
std::vector<WakeEvent*>* wake_events) {
- for (int i = start; i < end; ++i) {
+ for (size_t i = start; i < end; ++i) {
wake_events->push_back(MakeWakeEvent(
i % 2 == 0 ? WakeEvent_WakeEventType::WakeEvent_WakeEventType_ACQUIRED
: WakeEvent_WakeEventType::WakeEvent_WakeEventType_RELEASED,
@@ -313,6 +319,10 @@
std::vector<WakeEvent*> wake_events_;
std::vector<ScanEvent*> scan_events_;
std::vector<BluetoothSession*> bt_sessions_;
+ int64_t num_pair_event_ = 0;
+ int64_t num_wake_event_ = 0;
+ int64_t num_scan_event_ = 0;
+ int64_t num_bt_session_ = 0;
BluetoothLog* bt_log_;
std::string bt_log_str_;
std::string bt_log_ascii_str_;
@@ -321,18 +331,38 @@
for (BluetoothSession* session : bt_sessions_) {
bt_log_->mutable_session()->AddAllocated(session);
}
+ if (num_bt_session_ > 0) {
+ bt_log_->set_num_bluetooth_session(num_bt_session_);
+ } else if (bt_sessions_.size() > 0) {
+ bt_log_->set_num_bluetooth_session(bt_sessions_.size());
+ }
bt_sessions_.clear();
for (PairEvent* event : pair_events_) {
bt_log_->mutable_pair_event()->AddAllocated(event);
}
+ if (num_pair_event_ > 0) {
+ bt_log_->set_num_pair_event(num_pair_event_);
+ } else if (pair_events_.size() > 0) {
+ bt_log_->set_num_pair_event(pair_events_.size());
+ }
pair_events_.clear();
for (WakeEvent* event : wake_events_) {
bt_log_->mutable_wake_event()->AddAllocated(event);
}
+ if (num_wake_event_ > 0) {
+ bt_log_->set_num_wake_event(num_wake_event_);
+ } else if (wake_events_.size() > 0) {
+ bt_log_->set_num_wake_event(wake_events_.size());
+ }
wake_events_.clear();
for (ScanEvent* event : scan_events_) {
bt_log_->mutable_scan_event()->AddAllocated(event);
}
+ if (num_scan_event_ > 0) {
+ bt_log_->set_num_scan_event(num_scan_event_);
+ } else if (scan_events_.size() > 0) {
+ bt_log_->set_num_scan_event(scan_events_.size());
+ }
scan_events_.clear();
bt_log_->SerializeToString(&bt_log_str_);
}
@@ -401,10 +431,13 @@
EXPECT_THAT(msg_str, StrEq(bt_log_str_));
}
-TEST_F(BluetoothMetricsLoggerTest, WakeEvent500Test) {
- GenerateWakeEvents(450, 500, &wake_events_);
+TEST_F(BluetoothMetricsLoggerTest, WakeEventOverrunTest) {
+ GenerateWakeEvents(kMaxEventGenerationLimit -
+ BluetoothMetricsLogger::kMaxNumWakeEvent,
+ kMaxEventGenerationLimit, &wake_events_);
+ num_wake_event_ = kMaxEventGenerationLimit;
UpdateLog();
- for (int i = 0; i < 500; ++i) {
+ for (size_t i = 0; i < kMaxEventGenerationLimit; ++i) {
BluetoothMetricsLogger::GetInstance()->LogWakeEvent(
i % 2 == 0 ? WAKE_EVENT_ACQUIRED : WAKE_EVENT_RELEASED,
"TEST_REQ", "TEST_NAME", i);
@@ -433,12 +466,14 @@
10,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_LE,
- "TEST_DISCONNECT", nullptr, nullptr, nullptr));
+ BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_UNKNOWN,
+ nullptr, nullptr, nullptr));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_LE, 123456);
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd(
- "TEST_DISCONNECT", 133456);
+ DISCONNECT_REASON_UNKNOWN, 133456);
std::string msg_str;
BluetoothMetricsLogger::GetInstance()->WriteString(&msg_str, true);
EXPECT_THAT(msg_str, StrEq(bt_log_str_));
@@ -449,7 +484,9 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_LE,
- "METRICS_DUMP", nullptr, nullptr, nullptr));
+ BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_METRICS_DUMP,
+ nullptr, nullptr, nullptr));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_LE, time_get_os_boottime_ms());
@@ -464,12 +501,16 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_UNKNOWN,
- "NEXT_SESSION_START_WITHOUT_ENDING_PREVIOUS", nullptr, nullptr, nullptr));
+ BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_NEXT_START_WITHOUT_END_PREVIOUS,
+ nullptr, nullptr, nullptr));
bt_sessions_.push_back(MakeBluetoothSession(
2,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_LE,
- "METRICS_DUMP", nullptr, nullptr, nullptr));
+ BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_METRICS_DUMP,
+ nullptr, nullptr, nullptr));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_UNKNOWN, 0);
@@ -531,7 +572,8 @@
10,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "TEST_DISCONNECT", info, nullptr, session));
+ BluetoothSession_DisconnectReasonType::BluetoothSession_DisconnectReasonType_UNKNOWN,
+ info, nullptr, session));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_BREDR, 123456);
@@ -540,7 +582,7 @@
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics1);
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics2);
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd(
- "TEST_DISCONNECT", 133456);
+ DISCONNECT_REASON_UNKNOWN, 133456);
std::string msg_str;
BluetoothMetricsLogger::GetInstance()->WriteString(&msg_str, true);
EXPECT_THAT(msg_str, StrEq(bt_log_str_));
@@ -587,7 +629,9 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "METRICS_DUMP", info, nullptr, session));
+ BluetoothSession_DisconnectReasonType::
+ BluetoothSession_DisconnectReasonType_METRICS_DUMP,
+ info, nullptr, session));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_BREDR, 0);
@@ -607,12 +651,13 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "TEST_DISCONNECT", info, nullptr, session));
+ BluetoothSession_DisconnectReasonType::BluetoothSession_DisconnectReasonType_UNKNOWN,
+ info, nullptr, session));
UpdateLog();
sleep_ms(1000);
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics2);
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd(
- "TEST_DISCONNECT", 0);
+ DISCONNECT_REASON_UNKNOWN, 0);
msg_str.clear();
BluetoothMetricsLogger::GetInstance()->WriteString(&msg_str, true);
EXPECT_THAT(msg_str, StrEq(bt_log_str_));
@@ -665,7 +710,8 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "METRICS_DUMP", info, nullptr, session));
+ BluetoothSession_DisconnectReasonType::BluetoothSession_DisconnectReasonType_METRICS_DUMP,
+ info, nullptr, session));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics1);
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics2);
@@ -724,7 +770,8 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "METRICS_DUMP", info, nullptr, nullptr));
+ BluetoothSession_DisconnectReasonType::BluetoothSession_DisconnectReasonType_METRICS_DUMP,
+ info, nullptr, nullptr));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart(
CONNECTION_TECHNOLOGY_TYPE_BREDR, 0);
@@ -743,13 +790,14 @@
1,
BluetoothSession_ConnectionTechnologyType::
BluetoothSession_ConnectionTechnologyType_CONNECTION_TECHNOLOGY_TYPE_BREDR,
- "TEST_DISCONNECT", info, nullptr, session));
+ BluetoothSession_DisconnectReasonType::BluetoothSession_DisconnectReasonType_UNKNOWN,
+ info, nullptr, session));
UpdateLog();
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics1);
BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics2);
sleep_ms(1000);
BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd(
- "TEST_DISCONNECT", 0);
+ DISCONNECT_REASON_UNKNOWN, 0);
msg_str.clear();
BluetoothMetricsLogger::GetInstance()->WriteString(&msg_str, true);
EXPECT_THAT(msg_str, StrEq(bt_log_str_));