update_engine: Use DBus protobuf capabilities in dlcservice API methods
DBus have the capability to pass protobuf message directly in the method
without the need for serializing it manually. This CL uses those types
of arguments which is almost used everywhere in the platform2 code base.
BUG=chromium:978672
TEST=precq
Cq-Depend: chromium:1672684
Change-Id: I6e34ee76ede0c7b0b8cd1bba603a5836743d67fc
Reviewed-on: https://chromium-review.googlesource.com/1672021
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/client_library/client_dbus.cc b/client_library/client_dbus.cc
index 48a563b..18ae23b 100644
--- a/client_library/client_dbus.cc
+++ b/client_library/client_dbus.cc
@@ -92,13 +92,8 @@
dlc_parameters.add_dlc_module_infos();
dlc_module_info->set_dlc_id(dlc_id);
}
- string dlc_request;
- if (dlc_parameters.SerializeToString(&dlc_request)) {
- return proxy_->AttemptInstall(dlc_request, nullptr /* brillo::ErrorPtr* */);
- } else {
- LOG(ERROR) << "Fail to serialize a protobuf to a string.";
- return false;
- }
+ return proxy_->AttemptInstall(dlc_parameters,
+ nullptr /* brillo::ErrorPtr* */);
}
bool DBusUpdateEngineClient::GetStatus(int64_t* out_last_checked_time,
diff --git a/client_library/client_dbus.h b/client_library/client_dbus.h
index 1b127e3..c9631cf 100644
--- a/client_library/client_dbus.h
+++ b/client_library/client_dbus.h
@@ -23,6 +23,7 @@
#include <vector>
#include <base/macros.h>
+#include <dlcservice/proto_bindings/dlcservice.pb.h>
#include <update_engine/proto_bindings/update_engine.pb.h>
#include "update_engine/client_library/include/update_engine/client.h"