UpdateEngine-side changes to allow updates over 3G based on device policy.
Some enterprise chromebooks have only 3G and hence they need the ability
to update over 3G if the enterprise policy allows that. This CL adds
the support in update_engine to enable that.
BUG=chromium-os:31099
TEST=Tested E2E on 3G, added unit tests and did regression testing.
CQ-DEPEND=I1a55a392f3dc0f12d917eb45dcf0456b57735514
Change-Id: I121bda35e54fa6c35e002a76db198d13b72b650e
Reviewed-on: https://gerrit.chromium.org/gerrit/25470
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 52d6e4c..68c1417 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -32,6 +32,7 @@
#include "update_engine/postinstall_runner_action.h"
#include "update_engine/prefs_interface.h"
#include "update_engine/subprocess.h"
+#include "update_engine/system_state.h"
#include "update_engine/update_check_scheduler.h"
using base::TimeDelta;
@@ -39,6 +40,7 @@
using google::protobuf::NewPermanentCallback;
using std::make_pair;
using std::tr1::shared_ptr;
+using std::set;
using std::string;
using std::vector;
@@ -217,6 +219,21 @@
if (new_scatter_factor_in_secs < 0) // sanitize input, just in case.
new_scatter_factor_in_secs = 0;
scatter_factor_ = TimeDelta::FromSeconds(new_scatter_factor_in_secs);
+
+ system_state_->SetDevicePolicy(&device_policy);
+
+ set<string> allowed_types;
+ string allowed_types_str;
+ if (device_policy.GetAllowedConnectionTypesForUpdate(&allowed_types)) {
+ set<string>::const_iterator iter;
+ for (iter = allowed_types.begin(); iter != allowed_types.end(); ++iter)
+ allowed_types_str += *iter + " ";
+ }
+
+ LOG(INFO) << "Networks over which updates are allowed per policy : "
+ << (allowed_types_str.empty() ? "all" : allowed_types_str);
+ } else {
+ LOG(INFO) << "No device policies present.";
}
bool is_scatter_enabled = false;