Only disable update downloads over expensive connections, not all transfers.
Previous to this CL, all network traffic was disabled from the update engine
if an update wasn't allowed. Instead, in this CL, we switch to only disable
the update application portion (downloading and applying the payload). This
is done by moving the detection logic from the mechanism (the network fetcher)
to the user of said mechanism i.e. the omaha request/response actions.
I have done a little refactoring of the unittests to make this CL easier to
test and found 1 bug in the http_fetcher_unittests where we weren't sending
either the right URL or handling a server not existing correctly.
This CL comes with one caveat:
Technically in the previous impl if a download started over wifi then got
disconnected / retried and bounced to a different connection type that
we couldn't update over, we'd stop the update. This would no longer be true
here if the http_fetcher recovered seamlessly.
BUG=chromium:379832
TEST=Unittests
Change-Id: I6b1a76e4c030d4e384e8ba0b519424a35406aafb
Reviewed-on: https://chromium-review.googlesource.com/202435
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index e80dcb0..7a30403 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -10,6 +10,7 @@
#include <base/strings/string_util.h>
#include <policy/device_policy.h>
+#include "update_engine/connection_manager.h"
#include "update_engine/constants.h"
#include "update_engine/delta_performer.h"
#include "update_engine/hardware_interface.h"
@@ -49,17 +50,6 @@
return;
}
- // Note: policy decision to not update to a version we rolled back from.
- string rollback_version =
- system_state_->payload_state()->GetRollbackVersion();
- if(!rollback_version.empty()) {
- LOG(INFO) << "Detected previous rollback from version " << rollback_version;
- if(rollback_version == response.version) {
- LOG(INFO) << "Received version that we rolled back from. Aborting.";
- return;
- }
- }
-
// All decisions as to which URL should be used have already been done. So,
// make the current URL as the download URL.
string current_url = system_state_->payload_state()->GetCurrentUrl();