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/client_library/client_binder.cc b/client_library/client_binder.cc
index e98c225..fecd9a3 100644
--- a/client_library/client_binder.cc
+++ b/client_library/client_binder.cc
@@ -143,18 +143,18 @@
}
Status BinderUpdateEngineClient::StatusUpdateCallback::HandleStatusUpdate(
- int64_t last_checked_time,
- double progress,
- const String16& current_operation,
- const String16& new_version,
- int64_t new_size) {
+ const ParcelableUpdateEngineStatus& status) {
UpdateStatus update_status;
- StringToUpdateStatus(String8{current_operation}.string(), &update_status);
+ StringToUpdateStatus(String8{status.current_operation_}.string(),
+ &update_status);
for (auto& handler : client_->handlers_) {
- handler->HandleStatusUpdate(last_checked_time, progress, update_status,
- String8{new_version}.string(), new_size);
+ handler->HandleStatusUpdate(status.last_checked_time_,
+ status.progress_,
+ update_status,
+ String8{status.new_version_}.string(),
+ status.new_size_);
}
return Status::ok();
diff --git a/client_library/client_binder.h b/client_library/client_binder.h
index b1b34da..17f2beb 100644
--- a/client_library/client_binder.h
+++ b/client_library/client_binder.h
@@ -94,11 +94,7 @@
: client_(client) {}
android::binder::Status HandleStatusUpdate(
- int64_t last_checked_time,
- double progress,
- const android::String16& current_operation,
- const android::String16& new_version,
- int64_t new_size) override;
+ const android::brillo::ParcelableUpdateEngineStatus& status) override;
private:
BinderUpdateEngineClient* client_;
diff --git a/client_library/include/update_engine/update_status.h b/client_library/include/update_engine/update_status.h
index 3e9af5b..76dd865 100644
--- a/client_library/include/update_engine/update_status.h
+++ b/client_library/include/update_engine/update_status.h
@@ -17,6 +17,8 @@
#ifndef UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
#define UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
+#include <string>
+
namespace update_engine {
enum class UpdateStatus {
@@ -32,6 +34,25 @@
DISABLED,
};
+struct UpdateEngineStatus {
+ // When the update_engine last checked for updates (ms since Epoch)
+ int64_t last_checked_time_ms;
+ // the current status/operation of the update_engine
+ UpdateStatus status;
+ // the current product version (oem bundle id)
+ std::string current_version;
+ // the current system version
+ std::string current_system_version;
+ // The current progress (0.0f-1.0f).
+ double progress;
+ // the size of the update (bytes)
+ uint64_t new_size_bytes;
+ // the new product version
+ std::string new_version;
+ // the new system version, if there is one (empty, otherwise)
+ std::string new_system_version;
+};
+
} // namespace update_engine
#endif // UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_