Android: Extend the API with the payload offset and size.
The payload offset and size of the CrAU binary file inside the .zip
file are required parameters to properly apply the payload so we
explicitly required them in the API.
The update_engine_client command was extended to support these two
parameters.
Bug: 25631767
TEST=`mmma system/update_engine` on aosp_arm-eng.
Change-Id: Id5ef2f45b711039309173cb0309b9fe5cc82e485
diff --git a/binder_bindings/android/os/IUpdateEngine.aidl b/binder_bindings/android/os/IUpdateEngine.aidl
index 1e8090e..4245254 100644
--- a/binder_bindings/android/os/IUpdateEngine.aidl
+++ b/binder_bindings/android/os/IUpdateEngine.aidl
@@ -20,6 +20,8 @@
interface IUpdateEngine {
void applyPayload(String url,
+ in long payload_offset,
+ in long payload_size,
in String[] headerKeyValuePairs);
boolean bind(IUpdateEngineCallback callback);
void suspend();
diff --git a/binder_service_android.cc b/binder_service_android.cc
index 144836a..98943a2 100644
--- a/binder_service_android.cc
+++ b/binder_service_android.cc
@@ -47,6 +47,8 @@
Status BinderUpdateEngineAndroidService::applyPayload(
const String16& url,
+ int64_t payload_offset,
+ int64_t payload_size,
const vector<String16>& header_kv_pairs) {
return Status::ok();
}
diff --git a/binder_service_android.h b/binder_service_android.h
index 2fb9ca1..4ab19b3 100644
--- a/binder_service_android.h
+++ b/binder_service_android.h
@@ -17,6 +17,8 @@
#ifndef UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
#define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
+#include <stdint.h>
+
#include <vector>
#include <utils/Errors.h>
@@ -53,6 +55,8 @@
// android::os::BnUpdateEngine overrides.
android::binder::Status applyPayload(
const android::String16& url,
+ int64_t payload_offset,
+ int64_t payload_size,
const std::vector<android::String16>& header_kv_pairs) override;
android::binder::Status bind(
diff --git a/update_engine_client_android.cc b/update_engine_client_android.cc
index 5cbcd33..3485807 100644
--- a/update_engine_client_android.cc
+++ b/update_engine_client_android.cc
@@ -110,9 +110,16 @@
DEFINE_string(payload,
"http://127.0.0.1:8080/payload",
"The URI to the update payload to use.");
+ DEFINE_int64(offset, 0,
+ "The offset in the payload where the CrAU update starts. "
+ "Used when --update is passed.");
+ DEFINE_int64(size, 0,
+ "The size of the CrAU part of the payload. If 0 is passed, it "
+ "will be autodetected. Used when --update is passed.");
DEFINE_string(headers,
"",
- "A list of key-value pairs, one element of the list per line.");
+ "A list of key-value pairs, one element of the list per line. "
+ "Used when --update is passed.");
DEFINE_bool(suspend, false, "Suspend an ongoing update and exit.");
DEFINE_bool(resume, false, "Resume a suspended update.");
@@ -187,6 +194,8 @@
}
Status status = service_->applyPayload(
android::String16{FLAGS_payload.data(), FLAGS_payload.size()},
+ FLAGS_offset,
+ FLAGS_size,
and_headers);
if (!status.isOk())
return ExitWhenIdle(status);