Support calling verifyPayloadApplicable from update_engine_client.
Bug: None
Test: update_engine_client --verify
Change-Id: Iececa650470a0cd49c29385115635180f99d4de3
diff --git a/update_engine_client_android.cc b/update_engine_client_android.cc
index 267f6e9..82a9f84 100644
--- a/update_engine_client_android.cc
+++ b/update_engine_client_android.cc
@@ -124,6 +124,14 @@
"A list of key-value pairs, one element of the list per line. "
"Used when --update is passed.");
+ DEFINE_bool(verify,
+ false,
+ "Given payload metadata, verify if the payload is applicable.");
+ DEFINE_string(metadata,
+ "/data/ota_package/metadata",
+ "The path to the update payload metadata. "
+ "Used when --verify is passed.");
+
DEFINE_bool(suspend, false, "Suspend an ongoing update and exit.");
DEFINE_bool(resume, false, "Resume a suspended update.");
DEFINE_bool(cancel, false, "Cancel the ongoing update and exit.");
@@ -182,6 +190,15 @@
return ExitWhenIdle(service_->resetStatus());
}
+ if (FLAGS_verify) {
+ bool applicable = false;
+ Status status = service_->verifyPayloadApplicable(
+ android::String16{FLAGS_metadata.data(), FLAGS_metadata.size()},
+ &applicable);
+ LOG(INFO) << "Payload is " << (applicable ? "" : "not ") << "applicable.";
+ return ExitWhenIdle(status);
+ }
+
if (FLAGS_follow) {
// Register a callback object with the service.
callback_ = new UECallback(this);