#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/client/client_telemetry_logger.h"
#include <memory>
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "remoting/base/telemetry_log_writer.h"
#if BUILDFLAG(IS_ANDROID)
#include <android/log.h>
#endif
namespace {
const char kSessionIdAlphabet[] = …;
const int kSessionIdLength = …;
const int kMaxSessionIdAgeDays = …;
}
namespace remoting {
struct ClientTelemetryLogger::HostInfo { … };
ClientTelemetryLogger::ClientTelemetryLogger(
ChromotingEventLogWriter* log_writer,
ChromotingEvent::Mode mode,
ChromotingEvent::SessionEntryPoint entry_point)
: … { … }
ClientTelemetryLogger::~ClientTelemetryLogger() { … }
void ClientTelemetryLogger::SetAuthMethod(
ChromotingEvent::AuthMethod auth_method) { … }
void ClientTelemetryLogger::SetHostInfo(const std::string& host_version,
ChromotingEvent::Os host_os,
const std::string& host_os_version) { … }
void ClientTelemetryLogger::SetTransportRoute(
const protocol::TransportRoute& route) { … }
void ClientTelemetryLogger::SetSignalStrategyType(
ChromotingEvent::SignalStrategyType signal_strategy_type) { … }
void ClientTelemetryLogger::LogSessionStateChange(
ChromotingEvent::SessionState state,
ChromotingEvent::ConnectionError error) { … }
void ClientTelemetryLogger::LogStatistics(
const protocol::PerformanceTracker& perf_tracker) { … }
void ClientTelemetryLogger::PrintLogStatistics(
const protocol::PerformanceTracker& perf_tracker) { … }
void ClientTelemetryLogger::SetSessionIdGenerationTimeForTest(
base::TimeTicks gen_time) { … }
ChromotingEvent::SessionState ClientTelemetryLogger::TranslateState(
protocol::ConnectionToHost::State current_state,
protocol::ConnectionToHost::State previous_state) { … }
ChromotingEvent::ConnectionError ClientTelemetryLogger::TranslateError(
protocol::ErrorCode error) { … }
ChromotingEvent::ConnectionType ClientTelemetryLogger::TranslateConnectionType(
protocol::TransportRoute::RouteType type) { … }
void ClientTelemetryLogger::FillEventContext(ChromotingEvent* event) const { … }
void ClientTelemetryLogger::GenerateSessionId() { … }
void ClientTelemetryLogger::RefreshSessionIdIfOutdated() { … }
ChromotingEvent ClientTelemetryLogger::MakeStatsEvent(
const protocol::PerformanceTracker& perf_tracker) { … }
ChromotingEvent ClientTelemetryLogger::MakeSessionStateChangeEvent(
ChromotingEvent::SessionState state,
ChromotingEvent::ConnectionError error) { … }
ChromotingEvent ClientTelemetryLogger::MakeSessionIdOldEvent() { … }
ChromotingEvent ClientTelemetryLogger::MakeSessionIdNewEvent() { … }
}