Replacing Brillo Error

Creating our own error struct to remove libchrome dependancy. This also
allows us to propogate the error up and send more useful error messages

Test: m update_engine
Change-Id: I1bb651d9b7e759c9f902590685c1910b97c4ab5d
diff --git a/aosp/service_delegate_android_interface.h b/aosp/service_delegate_android_interface.h
index b3660ab..981689d 100644
--- a/aosp/service_delegate_android_interface.h
+++ b/aosp/service_delegate_android_interface.h
@@ -23,7 +23,8 @@
 #include <string>
 #include <vector>
 
-#include <brillo/errors/error.h>
+#include "base/callback_forward.h"
+#include "common/error.h"
 
 namespace chromeos_update_engine {
 
@@ -58,54 +59,54 @@
       int64_t payload_offset,
       int64_t payload_size,
       const std::vector<std::string>& key_value_pair_headers,
-      brillo::ErrorPtr* error) = 0;
+      Error* error) = 0;
 
   virtual bool ApplyPayload(
       int fd,
       int64_t payload_offset,
       int64_t payload_size,
       const std::vector<std::string>& key_value_pair_headers,
-      brillo::ErrorPtr* error) = 0;
+      Error* error) = 0;
 
   // Suspend an ongoing update. Returns true if there was an update ongoing and
   // it was suspended. In case of failure, it returns false and sets |error|
   // accordingly.
-  virtual bool SuspendUpdate(brillo::ErrorPtr* error) = 0;
+  virtual bool SuspendUpdate(Error* error) = 0;
 
   // Resumes an update suspended with SuspendUpdate(). The update can't be
   // suspended after it finished and this method will fail in that case.
   // Returns whether the resume operation was successful, which only implies
   // that there was a suspended update. In case of error, returns false and sets
   // |error| accordingly.
-  virtual bool ResumeUpdate(brillo::ErrorPtr* error) = 0;
+  virtual bool ResumeUpdate(Error* error) = 0;
 
   // Cancel the ongoing update. The update could be running or suspended, but it
   // can't be canceled after it was done. In case of error, returns false and
   // sets |error| accordingly.
-  virtual bool CancelUpdate(brillo::ErrorPtr* error) = 0;
+  virtual bool CancelUpdate(Error* error) = 0;
 
   // Reset the already applied update back to an idle state. This method can
   // only be called when no update attempt is going on, and it will reset the
   // status back to idle, deleting the currently applied update if any. In case
   // of error, returns false and sets |error| accordingly.
-  virtual bool ResetStatus(brillo::ErrorPtr* error) = 0;
+  virtual bool ResetStatus(Error* error) = 0;
 
   // Verifies whether a payload (delegated by the payload metadata) can be
   // applied to the current device. Returns whether the payload is applicable.
   // In case of error, returns false and sets |error| accordingly.
   virtual bool VerifyPayloadApplicable(const std::string& metadata_filename,
-                                       brillo::ErrorPtr* error) = 0;
+                                       Error* error) = 0;
   // Sets the A/B slot switch for the next boot after applying an ota update.
   // If applyPayload hasn't switched the slot by itself, the client can call
   // this API to switch the slot and apply the update on next boot. Returns
   // true on success.
   virtual bool setShouldSwitchSlotOnReboot(const std::string& metadata_filename,
-                                           brillo::ErrorPtr* error) = 0;
+                                           Error* error) = 0;
 
   // Resets the boot slot to the source/current slot, without cancelling the
   // update progress. This can be called after the update is installed, and to
   // prevent the device from accidentally taking the update when it reboots.
-  virtual bool resetShouldSwitchSlotOnReboot(brillo::ErrorPtr* error) = 0;
+  virtual bool resetShouldSwitchSlotOnReboot(Error* error) = 0;
 
   // Allocates space for a payload.
   // Returns 0 if space is successfully preallocated.
@@ -118,7 +119,7 @@
   virtual uint64_t AllocateSpaceForPayload(
       const std::string& metadata_filename,
       const std::vector<std::string>& key_value_pair_headers,
-      brillo::ErrorPtr* error) = 0;
+      Error* error) = 0;
 
   // Wait for merge to complete, then clean up merge after an update has been
   // successful.
@@ -127,7 +128,7 @@
   // |callback|.
   virtual void CleanupSuccessfulUpdate(
       std::unique_ptr<CleanupSuccessfulUpdateCallbackInterface> callback,
-      brillo::ErrorPtr* error) = 0;
+      Error* error) = 0;
 
  protected:
   ServiceDelegateAndroidInterface() = default;