Copy a version of download action for ChromeOS
DownloadAction contains many cros specific stuff, such as p2p, system
state. Many of these cros bits are used in a fragile way in aosp. It's
better if we maintain two independent download actions.
Test: treehugger
Bug: 175042161
Change-Id: Iaaed269b3886a068bfcb4bcac12aca99b9cf6970
diff --git a/cros/update_attempter.cc b/cros/update_attempter.cc
index 2fa6a80..e039480 100644
--- a/cros/update_attempter.cc
+++ b/cros/update_attempter.cc
@@ -56,6 +56,7 @@
#include "update_engine/common/subprocess.h"
#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
+#include "update_engine/cros/download_action_chromeos.h"
#include "update_engine/cros/omaha_request_action.h"
#include "update_engine/cros/omaha_request_params.h"
#include "update_engine/cros/omaha_response_handler_action.h"
@@ -765,12 +766,12 @@
if (interactive)
download_fetcher->set_max_retry_count(kDownloadMaxRetryCountInteractive);
download_fetcher->SetHeader(kXGoogleUpdateSessionId, session_id_);
- auto download_action =
- std::make_unique<DownloadAction>(prefs_,
- SystemState::Get()->boot_control(),
- SystemState::Get()->hardware(),
- download_fetcher, // passes ownership
- interactive);
+ auto download_action = std::make_unique<DownloadActionChromeos>(
+ prefs_,
+ SystemState::Get()->boot_control(),
+ SystemState::Get()->hardware(),
+ download_fetcher, // passes ownership
+ interactive);
download_action->set_delegate(this);
auto download_finished_action = std::make_unique<OmahaRequestAction>(
@@ -1248,9 +1249,10 @@
// actions (update download as well as the initial update check
// actions).
const string type = action->Type();
- if (type == DownloadAction::StaticType()) {
+ if (type == DownloadActionChromeos::StaticType()) {
download_progress_ = 0.0;
- DownloadAction* download_action = static_cast<DownloadAction*>(action);
+ DownloadActionChromeos* download_action =
+ static_cast<DownloadActionChromeos*>(action);
http_response_code_ = download_action->GetHTTPResponseCode();
} else if (type == OmahaRequestAction::StaticType()) {
OmahaRequestAction* omaha_request_action =