PolicyManager: New DevicePolicy provider.
This provider gives access to the members of the DevicePolicy
protobuf using the libpolicy to access it. The libpolicy doesn't
provide a way to get a notification when the policy was updated, but
that could be fixed on the future monitoring the file on disk. This
patch attempts to refresh the device policy every hour and updates
all the variables accordingly.
The variables exposed by this provider are only those used by the
update_engine code currently. If new variables need to be exposed
this can easily extended.
To achieve this, a new generic Variable class is introduce, named
AsyncCopyVariable, that allows you to Set or Unset the current value
of the variable and notify the subscribed observers while doing that.
BUG=chromium:358326
TEST=Unit tests added and pass.
Change-Id: Ieee6c9b33160f7dfe40c033db685a79d8fd57fe7
Reviewed-on: https://chromium-review.googlesource.com/194179
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/real_system_state.h b/real_system_state.h
index b9c0a26..32d972b 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -8,8 +8,8 @@
#include "update_engine/system_state.h"
#include <policy/device_policy.h>
+#include <metrics/metrics_library.h>
-#include "metrics/metrics_library.h"
#include "update_engine/clock.h"
#include "update_engine/connection_manager.h"
#include "update_engine/gpio_handler.h"
@@ -144,6 +144,8 @@
chromeos_policy_manager::PolicyManager policy_manager_;
+ policy::PolicyProvider policy_provider_;
+
// If true, this is the first instance of the update engine since the system
// rebooted. Important for tracking whether you are running instance of the
// update engine on first boot or due to a crash/restart.