summaryrefslogtreecommitdiff
path: root/service_delegate_android_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'service_delegate_android_interface.h')
-rw-r--r--service_delegate_android_interface.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/service_delegate_android_interface.h b/service_delegate_android_interface.h
index 5267bb06..34a97123 100644
--- a/service_delegate_android_interface.h
+++ b/service_delegate_android_interface.h
@@ -19,6 +19,7 @@
#include <inttypes.h>
+#include <memory>
#include <string>
#include <vector>
@@ -26,6 +27,18 @@
namespace chromeos_update_engine {
+// See ServiceDelegateAndroidInterface.CleanupSuccessfulUpdate
+// Wraps a IUpdateEngineCallback binder object used specifically for
+// CleanupSuccessfulUpdate.
+class CleanupSuccessfulUpdateCallbackInterface {
+ public:
+ virtual ~CleanupSuccessfulUpdateCallbackInterface() {}
+ virtual void OnCleanupProgressUpdate(double progress) = 0;
+ virtual void OnCleanupComplete(int32_t error_code) = 0;
+ // Call RegisterForDeathNotifications on the internal binder object.
+ virtual void RegisterForDeathNotifications(base::Closure unbind) = 0;
+};
+
// This class defines the interface exposed by the Android version of the
// daemon service. This interface only includes the method calls that such
// daemon exposes. For asynchronous events initiated by a class implementing
@@ -47,6 +60,13 @@ class ServiceDelegateAndroidInterface {
const std::vector<std::string>& key_value_pair_headers,
brillo::ErrorPtr* 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;
+
// 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.
@@ -76,6 +96,28 @@ class ServiceDelegateAndroidInterface {
virtual bool VerifyPayloadApplicable(const std::string& metadata_filename,
brillo::ErrorPtr* error) = 0;
+ // Allocates space for a payload.
+ // Returns 0 if space is successfully preallocated.
+ // Return non-zero if not enough space is not available; returned value is
+ // the total space required (in bytes) to be free on the device for this
+ // update to be applied, and |error| is unset.
+ // In case of error, returns 0, and sets |error| accordingly.
+ //
+ // This function may block for several minutes in the worst case.
+ virtual uint64_t AllocateSpaceForPayload(
+ const std::string& metadata_filename,
+ const std::vector<std::string>& key_value_pair_headers,
+ brillo::ErrorPtr* error) = 0;
+
+ // Wait for merge to complete, then clean up merge after an update has been
+ // successful.
+ //
+ // This function returns immediately. Progress updates are provided in
+ // |callback|.
+ virtual void CleanupSuccessfulUpdate(
+ std::unique_ptr<CleanupSuccessfulUpdateCallbackInterface> callback,
+ brillo::ErrorPtr* error) = 0;
+
protected:
ServiceDelegateAndroidInterface() = default;
};