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/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 206daca..6153f4c 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -13,7 +13,6 @@
#include "update_engine/certificate_checker.h"
#include "update_engine/chrome_proxy_resolver.h"
#include "update_engine/dbus_interface.h"
-#include "update_engine/flimflam_proxy.h"
#include "update_engine/utils.h"
using google::protobuf::NewCallback;
@@ -42,15 +41,17 @@
}
// On error, returns false.
-bool LibcurlHttpFetcher::ConnectionIsExpensive() const {
- if (force_connection_type_)
- return forced_expensive_connection_;
+bool LibcurlHttpFetcher::IsUpdateAllowedOverCurrentConnection() const {
NetworkConnectionType type;
ConcreteDbusGlib dbus_iface;
- TEST_AND_RETURN_FALSE(FlimFlamProxy::GetConnectionType(&dbus_iface, &type));
+ ConnectionManager* connection_manager = system_state_->GetConnectionManager();
+ TEST_AND_RETURN_FALSE(connection_manager->GetConnectionType(&dbus_iface,
+ &type));
+ bool is_allowed = connection_manager->IsUpdateAllowedOver(type);
LOG(INFO) << "We are connected via "
- << FlimFlamProxy::StringForConnectionType(type);
- return FlimFlamProxy::IsExpensiveConnectionType(type);
+ << connection_manager->StringForConnectionType(type)
+ << ", Updates allowed: " << (is_allowed ? "Yes" : "No");
+ return is_allowed;
}
bool LibcurlHttpFetcher::IsOfficialBuild() const {
@@ -140,9 +141,9 @@
StaticLibcurlWrite), CURLE_OK);
string url_to_use(url_);
- if (ConnectionIsExpensive()) {
- LOG(INFO) << "Not initiating HTTP connection b/c we are on an expensive"
- << " connection";
+ if (!IsUpdateAllowedOverCurrentConnection()) {
+ LOG(INFO) << "Not initiating HTTP connection b/c updates are disabled "
+ << "over this connection";
url_to_use = ""; // Sabotage the URL
}