Parse and expose end-of-life flag.
Omaha update or noupdate response can include _key=value pairs with
arbitrary data. One of those key can be "_eol" with the one of the
values "supported", "security-only" or "eol" which notifies the device
the end-of-life status of the device with respect to updates. This
information is now exposed via GetEolStatus() to the client so it
can be properly displayed in the UI.
Bug: 27924505
TEST=Added unittest. Run `update_engine_client --eol_status` on link.
Change-Id: Icc15f25b4d0b19cc894f5afc52ac7c43c7818982
diff --git a/client_library/client_dbus.cc b/client_library/client_dbus.cc
index 0d6b783..5cb63a4 100644
--- a/client_library/client_dbus.cc
+++ b/client_library/client_dbus.cc
@@ -171,10 +171,7 @@
bool DBusUpdateEngineClient::UnregisterStatusUpdateHandler(
StatusUpdateHandler* handler) {
- auto it = handlers_.begin();
-
- for (; *it != handler && it != handlers_.end(); it++);
-
+ auto it = std::find(handlers_.begin(), handlers_.end(), handler);
if (it != handlers_.end()) {
handlers_.erase(it);
return true;
@@ -230,5 +227,9 @@
return proxy_->GetLastAttemptError(last_attempt_error, nullptr);
}
+bool DBusUpdateEngineClient::GetEolStatus(int32_t* eol_status) const {
+ return proxy_->GetEolStatus(eol_status, nullptr);
+}
+
} // namespace internal
} // namespace update_engine