Add a binder function verifyPayloadApplicable().

This CL adds the following function to the Android binder service.

  boolean verifyPayloadApplicable(in String metadataFilename);

It verifies whether a payload (delegated by the payload metadta) can be
applied to the current device. A caller can download only the payload
metadata (from the start of the payload, past the last byte that
contains the metadata signature - the actual size is parsable from the
header). The metadata should be saved to a local file, and passed to
update_engine to query whether the payload can be applied.

This is useful for a caller to determine if a delta payload can be
applied to the device, by downloading minimal data (payload metadata
usually takes a few hundred KiB or less). On verification failures, the
caller can take better strategies (e.g. switching to a full payload).

Bug: 65283633
Test: Build and flash on walleye. Trigger a call to the Java API, then
      verify the logcat output.
Change-Id: I2e8d21d1073baa0da6faf1292497d61f60e6742f
diff --git a/binder_bindings/android/os/IUpdateEngine.aidl b/binder_bindings/android/os/IUpdateEngine.aidl
index 7e26752..c0e29f5 100644
--- a/binder_bindings/android/os/IUpdateEngine.aidl
+++ b/binder_bindings/android/os/IUpdateEngine.aidl
@@ -37,4 +37,6 @@
   void cancel();
   /** @hide */
   void resetStatus();
+  /** @hide */
+  boolean verifyPayloadApplicable(in String metadataFilename);
 }
diff --git a/binder_service_android.cc b/binder_service_android.cc
index 0305727..ccae3bf 100644
--- a/binder_service_android.cc
+++ b/binder_service_android.cc
@@ -139,6 +139,18 @@
   return Status::ok();
 }
 
+Status BinderUpdateEngineAndroidService::verifyPayloadApplicable(
+    const android::String16& metadata_filename, bool* return_value) {
+  const std::string payload_metadata{
+      android::String8{metadata_filename}.string()};
+  LOG(INFO) << "Received a request of verifying payload metadata in "
+            << payload_metadata << ".";
+
+  // FIXME: Do the actual verification work.
+  *return_value = true;
+  return Status::ok();
+}
+
 bool BinderUpdateEngineAndroidService::UnbindCallback(const IBinder* callback) {
   auto it = std::find_if(
       callbacks_.begin(),
diff --git a/binder_service_android.h b/binder_service_android.h
index eb36e4c..694b80a 100644
--- a/binder_service_android.h
+++ b/binder_service_android.h
@@ -65,6 +65,8 @@
   android::binder::Status resume() override;
   android::binder::Status cancel() override;
   android::binder::Status resetStatus() override;
+  android::binder::Status verifyPayloadApplicable(
+      const android::String16& metadata_filename, bool* return_value) override;
 
  private:
   // Remove the passed |callback| from the list of registered callbacks. Called