Move all blocking client calls to libupdate_engine_client

Change-Id: I27bc86ad2eef3a573c60fde1bb10b6b37af81c1c
Test: Affected commands continue to work
Bug: 26233663
Signed-off-by: Casey Dahlin <sadmac@google.com>
diff --git a/client_library/client_impl.cc b/client_library/client_impl.cc
index af9cb05..7b80025 100644
--- a/client_library/client_impl.cc
+++ b/client_library/client_impl.cc
@@ -66,6 +66,44 @@
   return StringToUpdateStatus(status_as_string, out_update_status);
 }
 
+bool UpdateEngineClientImpl::SetUpdateOverCellularPermission(bool allowed) {
+  return proxy_->SetUpdateOverCellularPermission(allowed, nullptr);
+}
+
+bool UpdateEngineClientImpl::GetUpdateOverCellularPermission(bool *allowed) {
+  return proxy_->GetUpdateOverCellularPermission(allowed, nullptr);
+}
+
+bool UpdateEngineClientImpl::SetP2PUpdatePermission(bool enabled) {
+  return proxy_->SetP2PUpdatePermission(enabled, nullptr);
+}
+
+bool UpdateEngineClientImpl::GetP2PUpdatePermission(bool* enabled) {
+  return proxy_->GetP2PUpdatePermission(enabled, nullptr);
+}
+
+bool UpdateEngineClientImpl::Rollback(bool powerwash) {
+  return proxy_->AttemptRollback(powerwash, nullptr);
+}
+
+bool UpdateEngineClientImpl::GetRollbackPartition(string* rollback_partition) {
+  return proxy_->GetRollbackPartition(rollback_partition, nullptr);
+}
+
+bool UpdateEngineClientImpl::GetPrevVersion(string* prev_version) {
+  return proxy_->GetPrevVersion(prev_version, nullptr);
+}
+
+void UpdateEngineClientImpl::RebootIfNeeded() {
+  bool ret = proxy_->RebootIfNeeded(nullptr);
+  if (!ret) {
+    // Reboot error code doesn't necessarily mean that a reboot
+    // failed. For example, D-Bus may be shutdown before we receive the
+    // result.
+    LOG(INFO) << "RebootIfNeeded() failure ignored.";
+  }
+}
+
 bool UpdateEngineClientImpl::ResetStatus() {
   return proxy_->ResetStatus(nullptr);
 }
diff --git a/client_library/client_impl.h b/client_library/client_impl.h
index c55f753..8c11ac2 100644
--- a/client_library/client_impl.h
+++ b/client_library/client_impl.h
@@ -44,6 +44,20 @@
                  std::string* out_new_version,
                  int64_t* out_new_size) override;
 
+  bool SetUpdateOverCellularPermission(bool allowed) override;
+  bool GetUpdateOverCellularPermission(bool* allowed) override;
+
+  bool SetP2PUpdatePermission(bool enabled) override;
+  bool GetP2PUpdatePermission(bool* enabled) override;
+
+  bool Rollback(bool powerwash) override;
+
+  bool GetRollbackPartition(std::string* rollback_partition) override;
+
+  void RebootIfNeeded() override;
+
+  bool GetPrevVersion(std::string* prev_version);
+
   bool ResetStatus() override;
 
   bool SetTargetChannel(const std::string& target_channel,
diff --git a/client_library/include/update_engine/client.h b/client_library/include/update_engine/client.h
index ffc4a8b..604cc5a 100644
--- a/client_library/include/update_engine/client.h
+++ b/client_library/include/update_engine/client.h
@@ -66,6 +66,27 @@
                          std::string* out_new_version,
                          int64_t* out_new_size) = 0;
 
+  // Getter and setter for the updates over cellular connections.
+  virtual bool SetUpdateOverCellularPermission(bool allowed) = 0;
+  virtual bool GetUpdateOverCellularPermission(bool* allowed) = 0;
+
+  // Getter and setter for the updates from P2P permission.
+  virtual bool SetP2PUpdatePermission(bool enabled) = 0;
+  virtual bool GetP2PUpdatePermission(bool* enabled) = 0;
+
+  // Attempt a rollback. Set 'powerwash' to reset the device while rolling
+  // back.
+  virtual bool Rollback(bool powerwash) = 0;
+
+  // Get the rollback partition if available. Gives empty string if not.
+  virtual bool GetRollbackPartition(std::string* rollback_partition) = 0;
+
+  // Reboot the system if needed.
+  virtual void RebootIfNeeded() = 0;
+
+  // Get the previous version
+  virtual bool GetPrevVersion(std::string* prev_version) = 0;
+
   // Resets the status of the Update Engine
   virtual bool ResetStatus() = 0;