analytics: Add adv_dis_result to analytics_recorder for onStartAdvertising and onStartDiscovery

PiperOrigin-RevId: 704277617
This commit is contained in:
Edwin Wu
2024-12-09 07:27:43 -08:00
committed by Copybara-Service
parent 9c34330939
commit ca35adcd4d
4 changed files with 241 additions and 121 deletions
@@ -38,6 +38,7 @@
#include "internal/platform/single_thread_executor.h"
#include "internal/proto/analytics/connections_log.pb.h"
#include "proto/connections_enums.pb.h"
#include "google/protobuf/repeated_ptr_field.h"
namespace nearby {
namespace analytics {
@@ -203,6 +204,8 @@ void AnalyticsRecorder::ResetClientSessionLoggingResoucesLocked() {
void AnalyticsRecorder::OnStartAdvertising(
connections::Strategy strategy, const std::vector<Medium> &mediums,
const std::vector<ConnectionsLog::OperationResultWithMedium>
&operation_result_with_mediums,
bool is_extended_advertisement_supported, int connected_ap_frequency,
bool is_nfc_available) {
MutexLock lock(&mutex_);
@@ -223,6 +226,9 @@ void AnalyticsRecorder::OnStartAdvertising(
std::make_unique<ConnectionsLog::AdvertisingPhase>();
absl::c_copy(mediums, RepeatedFieldBackInserter(
current_advertising_phase_->mutable_medium()));
absl::c_copy(operation_result_with_mediums,
RepeatedFieldBackInserter(
current_advertising_phase_->mutable_adv_dis_result()));
// Set a AdvertisingMetadata.
auto *advertising_metadata =
current_advertising_phase_->mutable_advertising_metadata();
@@ -242,6 +248,8 @@ void AnalyticsRecorder::OnStopAdvertising() {
void AnalyticsRecorder::OnStartDiscovery(
connections::Strategy strategy, const std::vector<Medium> &mediums,
const std::vector<ConnectionsLog::OperationResultWithMedium>
&operation_result_with_mediums,
bool is_extended_advertisement_supported, int connected_ap_frequency,
bool is_nfc_available) {
MutexLock lock(&mutex_);
@@ -262,6 +270,9 @@ void AnalyticsRecorder::OnStartDiscovery(
current_discovery_phase_ = std::make_unique<ConnectionsLog::DiscoveryPhase>();
absl::c_copy(mediums, RepeatedFieldBackInserter(
current_discovery_phase_->mutable_medium()));
absl::c_copy(operation_result_with_mediums,
RepeatedFieldBackInserter(
current_discovery_phase_->mutable_adv_dis_result()));
// Set a DiscoveryMetadata.
auto *discovery_metadata =
current_discovery_phase_->mutable_discovery_metadata();
@@ -55,6 +55,9 @@ class AnalyticsRecorder {
void OnStartAdvertising(
connections::Strategy strategy,
const std::vector<location::nearby::proto::connections::Medium> &mediums,
const std::vector<location::nearby::analytics::proto::ConnectionsLog::
OperationResultWithMedium>
&operation_result_with_medium,
bool is_extended_advertisement_supported = false,
int connected_ap_frequency = 0, bool is_nfc_available = false)
ABSL_LOCKS_EXCLUDED(mutex_);
@@ -69,6 +72,9 @@ class AnalyticsRecorder {
void OnStartDiscovery(
connections::Strategy strategy,
const std::vector<location::nearby::proto::connections::Medium> &mediums,
const std::vector<location::nearby::analytics::proto::ConnectionsLog::
OperationResultWithMedium>
&operation_result_with_medium,
bool is_extended_advertisement_supported = false,
int connected_ap_frequency = 0, bool is_nfc_available = false)
ABSL_LOCKS_EXCLUDED(mutex_);
@@ -59,6 +59,7 @@ using ::location::nearby::proto::connections::INCOMING;
using ::location::nearby::proto::connections::INITIAL;
using ::location::nearby::proto::connections::LOCAL_DISCONNECTION;
using ::location::nearby::proto::connections::Medium;
using ::location::nearby::proto::connections::OperationResultCategory;
using ::location::nearby::proto::connections::OperationResultCode;
using ::location::nearby::proto::connections::RESULT_ERROR;
using ::location::nearby::proto::connections::RESULT_SUCCESS;
@@ -167,36 +168,54 @@ TEST(AnalyticsRecorderTest, SetFieldsCorrectlyForNestedAdvertisingCalls) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLE, BLUETOOTH});
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLE, BLUETOOTH},
{operation_result});
analytics_recorder.OnStopAdvertising();
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLUETOOTH});
operation_result.set_medium(BLE);
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLUETOOTH},
{operation_result});
analytics_recorder.LogSession();
ASSERT_TRUE(client_session_done_latch.Await(kDefaultTimeout).result());
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: ADVERTISER
advertising_phase <
advertising_phase {
medium: BLE
medium: BLUETOOTH
advertising_metadata <
advertising_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
>
advertising_phase <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
}
advertising_phase {
medium: BLUETOOTH
advertising_metadata <
advertising_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
>
>)pb");
}
adv_dis_result {
medium: BLE
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
(EqualsProto(strategy_session_proto)));
@@ -210,15 +229,26 @@ TEST(AnalyticsRecorderTest, SetFieldsCorrectlyForNestedDiscoveryCalls) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
ConnectionsLog::OperationResultWithMedium operation_result2;
operation_result2.set_medium(BLE);
operation_result2.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result2.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartDiscovery(
strategy, /*mediums=*/{BLE, BLUETOOTH},
{operation_result, operation_result2},
/*is_extended_advertisement_supported=*/true,
/*connected_ap_frequency=*/1, /*is_nfc_available=*/false);
analytics_recorder.OnStopDiscovery();
analytics_recorder.OnEndpointFound(BLUETOOTH);
analytics_recorder.OnEndpointFound(BLE);
analytics_recorder.OnStartDiscovery(
strategy, /*mediums=*/{BLUETOOTH},
strategy, /*mediums=*/{BLUETOOTH}, {operation_result},
/*is_extended_advertisement_supported=*/true,
/*connected_ap_frequency=*/1, /*is_nfc_available=*/false);
@@ -227,29 +257,44 @@ TEST(AnalyticsRecorderTest, SetFieldsCorrectlyForNestedDiscoveryCalls) {
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: DISCOVERER
discovery_phase <
discovery_phase {
medium: BLE
medium: BLUETOOTH
discovered_endpoint < medium: BLUETOOTH >
discovered_endpoint < medium: BLE >
discovery_metadata <
discovered_endpoint { medium: BLUETOOTH }
discovered_endpoint { medium: BLE }
discovery_metadata {
supports_extended_ble_advertisements: true
connected_ap_frequency: 1
supports_nfc_technology: false
>
>
discovery_phase <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
adv_dis_result {
medium: BLE
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
}
discovery_phase {
medium: BLUETOOTH
discovery_metadata <
discovery_metadata {
supports_extended_ble_advertisements: true
connected_ap_frequency: 1
supports_nfc_technology: false
>
>
>)pb");
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -265,16 +310,16 @@ TEST(AnalyticsRecorderTest,
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(strategy, mediums);
analytics_recorder.OnStartDiscovery(strategy, mediums);
analytics_recorder.OnStartAdvertising(strategy, mediums, {});
analytics_recorder.OnStartDiscovery(strategy, mediums, {});
analytics_recorder.OnStopAdvertising();
analytics_recorder.OnStopDiscovery();
analytics_recorder.OnStartAdvertising(strategy, mediums);
analytics_recorder.OnStartAdvertising(strategy, mediums, {});
analytics_recorder.OnStopAdvertising();
analytics_recorder.OnStartDiscovery(strategy, mediums);
analytics_recorder.OnStartDiscovery(strategy, mediums, {});
analytics_recorder.OnStopDiscovery();
analytics_recorder.OnStartDiscovery(strategy, mediums);
analytics_recorder.OnStartAdvertising(strategy, mediums);
analytics_recorder.OnStartDiscovery(strategy, mediums, {});
analytics_recorder.OnStartAdvertising(strategy, mediums, {});
analytics_recorder.OnStopDiscovery();
analytics_recorder.OnStopAdvertising();
@@ -362,8 +407,14 @@ TEST(AnalyticsRecorderTest, AdvertiserConnectionRequestsWorks) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLE);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH},
{operation_result});
analytics_recorder.OnConnectionRequestReceived(endpoint_id_0);
analytics_recorder.OnLocalEndpointAccepted(endpoint_id_0);
analytics_recorder.OnRemoteEndpointAccepted(endpoint_id_0);
@@ -385,35 +436,40 @@ TEST(AnalyticsRecorderTest, AdvertiserConnectionRequestsWorks) {
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: ADVERTISER
advertising_phase <
advertising_phase {
medium: BLE
medium: BLUETOOTH
advertising_metadata <
advertising_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
received_connection_request <
}
adv_dis_result {
medium: BLE
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
received_connection_request {
local_response: ACCEPTED
remote_response: ACCEPTED
>
received_connection_request <
}
received_connection_request {
local_response: ACCEPTED
remote_response: REJECTED
>
received_connection_request <
}
received_connection_request {
local_response: REJECTED
remote_response: ACCEPTED
>
received_connection_request <
}
received_connection_request {
local_response: REJECTED
remote_response: REJECTED
>
>
>)pb");
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -430,8 +486,14 @@ TEST(AnalyticsRecorderTest, DiscoveryConnectionRequestsWorks) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH},
{operation_result});
analytics_recorder.OnConnectionRequestSent(endpoint_id_0);
analytics_recorder.OnLocalEndpointAccepted(endpoint_id_0);
@@ -454,35 +516,40 @@ TEST(AnalyticsRecorderTest, DiscoveryConnectionRequestsWorks) {
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: DISCOVERER
discovery_phase <
discovery_phase {
medium: BLE
medium: BLUETOOTH
discovery_metadata <
discovery_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
sent_connection_request <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
sent_connection_request {
local_response: ACCEPTED
remote_response: ACCEPTED
>
sent_connection_request <
}
sent_connection_request {
local_response: ACCEPTED
remote_response: REJECTED
>
sent_connection_request <
}
sent_connection_request {
local_response: REJECTED
remote_response: ACCEPTED
>
sent_connection_request <
}
sent_connection_request {
local_response: REJECTED
remote_response: REJECTED
>
>
>)pb");
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -499,8 +566,14 @@ TEST(AnalyticsRecorderTest,
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH},
{operation_result});
// Ignored by local.
analytics_recorder.OnConnectionRequestReceived(endpoint_id_0);
analytics_recorder.OnRemoteEndpointAccepted(endpoint_id_0);
@@ -517,31 +590,36 @@ TEST(AnalyticsRecorderTest,
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: ADVERTISER
advertising_phase <
advertising_phase {
medium: BLE
medium: BLUETOOTH
advertising_metadata <
advertising_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
received_connection_request <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
received_connection_request {
local_response: IGNORED
remote_response: ACCEPTED
>
received_connection_request <
}
received_connection_request {
local_response: ACCEPTED
remote_response: IGNORED
>
received_connection_request <
}
received_connection_request {
local_response: IGNORED
remote_response: IGNORED
>
>
>)pb");
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -558,8 +636,14 @@ TEST(AnalyticsRecorderTest,
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH},
{operation_result});
// Ignored by local.
analytics_recorder.OnConnectionRequestSent(endpoint_id_0);
@@ -577,31 +661,36 @@ TEST(AnalyticsRecorderTest,
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: DISCOVERER
discovery_phase <
discovery_phase {
medium: BLE
medium: BLUETOOTH
discovery_metadata <
discovery_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
sent_connection_request <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
sent_connection_request {
local_response: IGNORED
remote_response: ACCEPTED
>
sent_connection_request <
}
sent_connection_request {
local_response: ACCEPTED
remote_response: IGNORED
>
sent_connection_request <
}
sent_connection_request {
local_response: IGNORED
remote_response: IGNORED
>
>
>)pb");
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -613,8 +702,14 @@ TEST(AnalyticsRecorderTest, SuccessfulIncomingConnectionAttempt) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
ConnectionsLog::OperationResultWithMedium operation_result;
operation_result.set_medium(BLUETOOTH);
operation_result.set_result_code(OperationResultCode::DETAIL_SUCCESS);
operation_result.set_result_category(
OperationResultCategory::CATEGORY_SUCCESS);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH},
{operation_result});
auto connections_attempt_metadata_params =
std::make_unique<ConnectionAttemptMetadataParams>();
@@ -630,25 +725,30 @@ TEST(AnalyticsRecorderTest, SuccessfulIncomingConnectionAttempt) {
ConnectionsLog::ClientSession strategy_session_proto =
ParseTextProtoOrDie(R"pb(
strategy_session <
strategy_session {
strategy: P2P_STAR
role: ADVERTISER
advertising_phase <
advertising_phase {
medium: BLE
medium: BLUETOOTH
advertising_metadata <
advertising_metadata {
supports_extended_ble_advertisements: false
connected_ap_frequency: 0
supports_nfc_technology: false
>
>
connection_attempt <
}
adv_dis_result {
medium: BLUETOOTH
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
}
}
connection_attempt {
type: INITIAL
direction: INCOMING
medium: BLUETOOTH
attempt_result: RESULT_SUCCESS
connection_token: ""
connection_attempt_metadata <
connection_attempt_metadata {
technology: CONNECTION_TECHNOLOGY_UNKNOWN_TECHNOLOGY
band: CONNECTION_BAND_UNKNOWN_BAND
frequency: -1
@@ -660,13 +760,13 @@ TEST(AnalyticsRecorderTest, SuccessfulIncomingConnectionAttempt) {
max_tx_speed: 0
max_rx_speed: 0
wifi_channel_width: -1
>
operation_result <
}
operation_result {
result_category: CATEGORY_SUCCESS
result_code: DETAIL_SUCCESS
>
>
>)pb");
}
}
})pb");
EXPECT_THAT(event_logger.GetLoggedClientSession(),
EqualsProto(strategy_session_proto));
@@ -693,7 +793,7 @@ TEST(AnalyticsRecorderTest,
/*max_wifi_rx_speed*/ 0, /*channel_width*/ 0,
OperationResultCode::CONNECTIVITY_BT_CLIENT_SOCKET_CREATION_FAILURE);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnConnectionRequestSent(endpoint_id);
analytics_recorder.OnOutgoingConnectionAttempt(
endpoint_id, INITIAL, BLUETOOTH, RESULT_ERROR, absl::Duration{},
@@ -760,7 +860,7 @@ TEST(AnalyticsRecorderTest, UnfinishedEstablishedConnectionsAddedAsUnfinished) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnConnectionEstablished(endpoint_id, BLUETOOTH,
connection_token);
analytics_recorder.OnConnectionClosed(
@@ -823,7 +923,7 @@ TEST(AnalyticsRecorderTest, OutgoingPayloadUpgraded) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnConnectionEstablished(endpoint_id, BLUETOOTH,
connection_token);
analytics_recorder.OnOutgoingPayloadStarted(
@@ -921,7 +1021,7 @@ TEST(AnalyticsRecorderTest, UpgradeAttemptWorks) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnBandwidthUpgradeStarted(endpoint_id, BLE, WIFI_LAN,
INCOMING, connection_token);
@@ -1069,7 +1169,7 @@ TEST(AnalyticsRecorderTest, SetErrorCodeFieldsCorrectly) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{WEB_RTC});
/*mediums=*/{WEB_RTC}, {});
ErrorCodeParams error_code_params = ErrorCodeRecorder::BuildErrorCodeParams(
WEB_RTC, DISCONNECT, DISCONNECT_NETWORK_FAILED,
@@ -1097,7 +1197,7 @@ TEST(AnalyticsRecorderTest, SetErrorCodeFieldsCorrectlyForUnknownDescription) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLUETOOTH});
/*mediums=*/{BLUETOOTH}, {});
ErrorCodeParams error_code_params;
// Skip setting error_code_params.description
@@ -1128,7 +1228,7 @@ TEST(AnalyticsRecorderTest, SetErrorCodeFieldsCorrectlyForCommonError) {
/*no_record_time_millis=*/true);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLUETOOTH});
/*mediums=*/{BLUETOOTH}, {});
ErrorCodeParams error_code_params = ErrorCodeRecorder::BuildErrorCodeParams(
BLUETOOTH, START_DISCOVERING, INVALID_PARAMETER,
@@ -1258,7 +1358,7 @@ TEST(AnalyticsRecorderTest,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnConnectionRequestReceived(endpoint_id_0);
analytics_recorder.OnLocalEndpointAccepted(endpoint_id_0);
analytics_recorder.OnRemoteEndpointAccepted(endpoint_id_0);
@@ -1362,7 +1462,7 @@ TEST(AnalyticsRecorderTest,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartDiscovery(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnConnectionRequestSent(endpoint_id_0);
analytics_recorder.OnLocalEndpointAccepted(endpoint_id_0);
@@ -1468,7 +1568,7 @@ TEST(AnalyticsRecorderTest, ClearcActiveConnectionsAfterSessionWasLogged) {
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(strategy, mediums);
analytics_recorder.OnStartAdvertising(strategy, mediums, {});
analytics_recorder.OnConnectionEstablished(endpoint_id, BLUETOOTH,
connection_token);
@@ -1575,7 +1675,7 @@ TEST(AnalyticsRecorderTest,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnBandwidthUpgradeStarted(endpoint_id, BLE, WIFI_LAN,
INCOMING, connection_token);
@@ -1745,7 +1845,7 @@ TEST(AnalyticsRecorderTest,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLUETOOTH});
/*mediums=*/{BLUETOOTH}, {});
analytics_recorder.OnStopAdvertising();
// LogSession
@@ -1768,7 +1868,7 @@ TEST(AnalyticsRecorderTest,
// LogSession again
CountDownLatch new_client_session_done_latch(1);
event_logger.SetClientSessionDoneLatch(new_client_session_done_latch);
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLUETOOTH});
analytics_recorder.OnStartAdvertising(strategy, /*mediums=*/{BLUETOOTH}, {});
analytics_recorder.OnStopAdvertising();
analytics_recorder.LogSession();
@@ -1790,7 +1890,7 @@ TEST(AnalyticsRecorderTest,
// Via OnStartAdvertising, current_strategy_session_is set in
// UpdateStrategySessionLocked.
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnStopAdvertising();
// LogSession
@@ -1844,9 +1944,9 @@ TEST(AnalyticsRecorderTest,
AnalyticsRecorder analytics_recorder(&event_logger,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartAdvertising(
connections::Strategy::kP2pStar,
/*mediums=*/{BLUETOOTH}); // set current_advertising_phase_
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLUETOOTH},
{}); // set current_advertising_phase_
analytics_recorder.OnStopAdvertising();
// LogSession
@@ -1925,7 +2025,7 @@ TEST(AnalyticsRecorderTest,
/*no_record_time_millis=*/true);
analytics_recorder.OnStartDiscovery(
strategy, {BLUETOOTH}, /*is_extended_advertisement_supported=*/true,
strategy, {BLUETOOTH}, {}, /*is_extended_advertisement_supported=*/true,
/*connected_ap_frequency=*/1,
/*is_nfc_available=*/false); // set current_discovery_phase_
analytics_recorder.OnStopDiscovery();
@@ -2010,7 +2110,7 @@ TEST(AnalyticsRecorderOnConnectionClosedTest,
// via OnStartAdvertising, current_strategy_session_ is set in
// UpdateStrategySessionLocked.
analytics_recorder.OnStartAdvertising(connections::Strategy::kP2pStar,
/*mediums=*/{BLE, BLUETOOTH});
/*mediums=*/{BLE, BLUETOOTH}, {});
analytics_recorder.OnStopAdvertising();
// LogSession
+5 -2
View File
@@ -240,7 +240,9 @@ void ClientProxy::StartedAdvertising(
const std::vector<location::nearby::proto::connections::Medium> medium_vector(
mediums.begin(), mediums.end());
analytics_recorder_->OnStartAdvertising(strategy, medium_vector, false, 0);
// TODO(edwinwu): Implement to pass real values for OperatoinResultWithMedium.
analytics_recorder_->OnStartAdvertising(strategy, medium_vector, {}, false,
0);
}
void ClientProxy::StoppedAdvertising() {
@@ -366,7 +368,8 @@ void ClientProxy::StartedDiscovery(
const std::vector<location::nearby::proto::connections::Medium> medium_vector(
mediums.begin(), mediums.end());
analytics_recorder_->OnStartDiscovery(strategy, medium_vector, false, 0);
// TODO(edwinwu): Implement to pass real values for OperatoinResultWithMedium.
analytics_recorder_->OnStartDiscovery(strategy, medium_vector, {}, false, 0);
}
void ClientProxy::StoppedDiscovery() {