metricsd: Expose the metrics status through weave.
metrics_daemon will export _metrics._AnalyticsReportingState containing
"enabled"/"disabled" depending on the current state and two weave
commands (_metrics._{enable,disable}AnalyticsReporting) to update it.
BUG: 24386281
TEST: manual. Enabled and disabled metrics reporting.
`metrics_client -c` reports the correct answer.
Change-Id: Ic4a5ffc1e9f9cbc0b47ee34d3af83584d95da155
diff --git a/metricsd/metrics_daemon.h b/metricsd/metrics_daemon.h
index 612dfe2..0a8f6a5 100644
--- a/metricsd/metrics_daemon.h
+++ b/metricsd/metrics_daemon.h
@@ -26,6 +26,7 @@
#include <base/files/file_path.h>
#include <base/memory/scoped_ptr.h>
#include <base/time/time.h>
+#include <buffet/dbus-proxies.h>
#include <chromeos/daemons/dbus_daemon.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -121,6 +122,21 @@
DBusMessage* message,
void* user_data);
+ // Callback for Weave commands.
+ void OnWeaveCommand(com::android::Weave::CommandProxy* command);
+
+ // Enables metrics reporting.
+ void OnEnableMetrics(com::android::Weave::CommandProxy* command);
+
+ // Disables metrics reporting.
+ void OnDisableMetrics(com::android::Weave::CommandProxy* command);
+
+ // Updates the weave device state.
+ void UpdateWeaveState(com::android::Weave::ManagerProxy* manager);
+
+ // Tells Weave that the state has changed.
+ void NotifyStateChanged();
+
// Updates the active use time and logs time between user-space
// process crashes.
void ProcessUserCrash();
@@ -301,6 +317,7 @@
std::string server_;
scoped_ptr<UploadService> upload_service_;
+ scoped_ptr<com::android::Weave::ObjectManagerProxy> weaved_object_mgr_;
};
#endif // METRICS_METRICS_DAEMON_H_