| Index: components/metrics/metrics_reporting_scheduler.cc
|
| diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc
|
| index 53c0cc553f26bac20f89bc18339caadd4d01ef60..da6caf32387575200c9630bcd6373abe0ac64aad 100644
|
| --- a/components/metrics/metrics_reporting_scheduler.cc
|
| +++ b/components/metrics/metrics_reporting_scheduler.cc
|
| @@ -38,6 +38,7 @@ const int kUnsentLogsIntervalSeconds = 15;
|
| // Standard interval between log uploads, in seconds.
|
| #if defined(OS_ANDROID) || defined(OS_IOS)
|
| const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes.
|
| +const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Five minutes.
|
| #else
|
| const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes.
|
| #endif
|
| @@ -194,10 +195,35 @@ void MetricsReportingScheduler::BackOffUploadInterval() {
|
|
|
| base::TimeDelta MetricsReportingScheduler::GetStandardUploadInterval() {
|
| #if defined(OS_ANDROID)
|
| - return GetUploadIntervalFromExperiment();
|
| -#else
|
| - return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
|
| + if (IsCellularEnabledByExperiment() && IsCellularConnection())
|
| + return TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds);
|
| #endif
|
| + return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
|
| +}
|
| +
|
| +void MetricsReportingScheduler::SetNetworkMetricsProvider(
|
| + const metrics::NetworkMetricsProvider* network_metrics_provider) {
|
| + network_metrics_provider_= network_metrics_provider;
|
| +}
|
| +
|
| +bool MetricsReportingScheduler::IsCellularConnection() {
|
| + SystemProfileProto::Network::ConnectionType connection_type =
|
| + network_metrics_provider_->GetConnectionType();
|
| +
|
| + switch (connection_type) {
|
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_2G:
|
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_3G:
|
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_4G:
|
| + return true;
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +bool MetricsReportingScheduler::IsCellularEnabledByExperiment() {
|
| + const std::string group_name =
|
| + base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload");
|
| + return group_name == "Enabled";
|
| }
|
|
|
| } // namespace metrics
|
|
|