PolicyManager: New Config provider.
This patch adds a new Config provider to the Policy Manager. This
provider reads a fixed set of config options from a file on /etc.
On dev mode, if the file is present on the stateful partition, it
will read it from there instead.
Currently, the only enabled setting consists on the OOBE enabled bit.
This setting states whether the board/device has an OOBE or not.
BUG=chromium:359674
TEST=Unit tests added and passing.
Change-Id: I86c64ab4c447409ef7aeccf0ed374906edf450e7
Reviewed-on: https://chromium-review.googlesource.com/195542
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/state.h b/policy_manager/state.h
index b81a88e..23c2d6e 100644
--- a/policy_manager/state.h
+++ b/policy_manager/state.h
@@ -6,6 +6,7 @@
#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_H_
#include "update_engine/policy_manager/device_policy_provider.h"
+#include "update_engine/policy_manager/config_provider.h"
#include "update_engine/policy_manager/random_provider.h"
#include "update_engine/policy_manager/shill_provider.h"
#include "update_engine/policy_manager/system_provider.h"
@@ -19,10 +20,14 @@
class State {
public:
virtual ~State() {}
- State(DevicePolicyProvider* device_policy_provider,
- RandomProvider* random_provider, ShillProvider* shill_provider,
- SystemProvider* system_provider, TimeProvider* time_provider,
+ State(ConfigProvider* config_provider,
+ DevicePolicyProvider* device_policy_provider,
+ RandomProvider* random_provider,
+ ShillProvider* shill_provider,
+ SystemProvider* system_provider,
+ TimeProvider* time_provider,
UpdaterProvider* updater_provider) :
+ config_provider_(config_provider),
device_policy_provider_(device_policy_provider),
random_provider_(random_provider),
shill_provider_(shill_provider),
@@ -31,6 +36,7 @@
updater_provider_(updater_provider) {}
// These methods return the given provider.
+ virtual ConfigProvider* config_provider() { return config_provider_.get(); }
virtual DevicePolicyProvider* device_policy_provider() {
return device_policy_provider_.get();
}
@@ -44,6 +50,7 @@
private:
// Instances of the providers.
+ scoped_ptr<ConfigProvider> config_provider_;
scoped_ptr<DevicePolicyProvider> device_policy_provider_;
scoped_ptr<RandomProvider> random_provider_;
scoped_ptr<ShillProvider> shill_provider_;