Merge "metrics: Don't use the policy file."
diff --git a/metrics/include/metrics/metrics_library.h b/metrics/include/metrics/metrics_library.h
index a90f3e6..7508100 100644
--- a/metrics/include/metrics/metrics_library.h
+++ b/metrics/include/metrics/metrics_library.h
@@ -14,8 +14,6 @@
#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "policy/libpolicy.h"
-
class MetricsLibraryInterface {
public:
virtual void Init() = 0;
@@ -130,9 +128,6 @@
char* buffer, int buffer_size,
bool* result);
- // This function is used by tests only to mock the device policies.
- void SetPolicyProvider(policy::PolicyProvider* provider);
-
// Time at which we last checked if metrics were enabled.
static time_t cached_enabled_time_;
@@ -142,8 +137,6 @@
std::string uma_events_file_;
std::string consent_file_;
- scoped_ptr<policy::PolicyProvider> policy_provider_;
-
DISALLOW_COPY_AND_ASSIGN(MetricsLibrary);
};
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index 437787a..fb80354 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -16,8 +16,6 @@
#include "serialization/metric_sample.h"
#include "serialization/serialization_utils.h"
-#include "policy/device_policy.h"
-
static const char kAutotestPath[] = "/var/log/metrics/autotest-events";
static const char kUMAEventsPath[] = "/var/lib/metrics/uma-events";
static const char kConsentFile[] = "/home/chronos/Consent To Send Stats";
@@ -123,29 +121,7 @@
time_t this_check_time = time(nullptr);
if (this_check_time != cached_enabled_time_) {
cached_enabled_time_ = this_check_time;
-
- if (!policy_provider_.get())
- policy_provider_.reset(new policy::PolicyProvider());
- policy_provider_->Reload();
- // We initialize with the default value which is false and will be preserved
- // if the policy is not set.
- bool enabled = false;
- bool has_policy = false;
- if (policy_provider_->device_policy_is_loaded()) {
- has_policy =
- policy_provider_->GetDevicePolicy().GetMetricsEnabled(&enabled);
- }
- // If policy couldn't be loaded or the metrics policy is not set we should
- // still respect the consent file if it is present for migration purposes.
- // TODO(pastarmovj)
- if (!has_policy) {
- enabled = stat(consent_file_.c_str(), &stat_buffer) >= 0;
- }
-
- if (enabled && !IsGuestMode())
- cached_enabled_ = true;
- else
- cached_enabled_ = false;
+ cached_enabled_ = stat(consent_file_.c_str(), &stat_buffer) >= 0;
}
return cached_enabled_;
}
@@ -200,10 +176,6 @@
*metrics::MetricSample::CrashSample(crash_kind).get(), kUMAEventsPath);
}
-void MetricsLibrary::SetPolicyProvider(policy::PolicyProvider* provider) {
- policy_provider_.reset(provider);
-}
-
bool MetricsLibrary::SendCrosEventToUMA(const std::string& event) {
for (size_t i = 0; i < arraysize(kCrosEventNames); i++) {
if (strcmp(event.c_str(), kCrosEventNames[i]) == 0) {