Update API: initial support
Initial pieces of the Update API callback framework.
- move the status callback params to a new object, UpdateEngineStatus to
allow for the easier addition of new params in the future.
- switch the IUpdateEngineStatusCallback to provide a
ParcelableUpdateEngineStatus instead of a series of individual params
- move the various GetStatus() methods to use the UpdateEngineStatus
object instead of a series of params (which will need future expansion)
- Add current and new product/os versions to both the UpdateEngineStatus
and the ParcelableUpdateEngineStatus.
Bug: 64808702
Test: unit tests, and performing OTAs via a test app calling
IUpdateEngine::AttemptUpdate() via UpdateManager::performUpdateNow()
Change-Id: I53f66f3511049f0809855814e1e758023cd8cc08
(cherry picked from commit 4f96ebf85022837603f2e10100a044d234b7d86f)
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 5765329..e9502fe 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -50,6 +50,7 @@
using std::shared_ptr;
using std::string;
using std::vector;
+using update_engine::UpdateEngineStatus;
namespace chromeos_update_engine {
@@ -432,9 +433,12 @@
status_ = status;
size_t payload_size =
install_plan_.payloads.empty() ? 0 : install_plan_.payloads[0].size;
+ UpdateEngineStatus status_to_send = {.status = status_,
+ .progress = download_progress_,
+ .new_size_bytes = payload_size};
+
for (auto observer : daemon_state_->service_observers()) {
- observer->SendStatusUpdate(
- 0, download_progress_, status_, "", payload_size);
+ observer->SendStatusUpdate(status_to_send);
}
last_notify_time_ = TimeTicks::Now();
}