Revert "update_engine: Deprecate major version 1"

This partially reverts commit 55c75417e22d5026971276997924a345d9973bbc.

It turns out that we forgot a scenario when we deprecated major version
1. We use update_engine in lab tests (specifically
autoupdate_EndToEndTests on stable channel) to update a DUT to an
old (very old) versions using actual update payloads so we can test that
they can get updated to newer versions. However, deprecating major
version 1 in the update_engine caused trouble because we no longer can
update from a newer version to a version before M72 (to prepare the
device for update test). We need to put this feature back until we find
a better solution for it.

On this CL, we only support major version 1 in the client and only for
test (non-official) images. We don't even bother adding paygen support
for it.

This CL should be reverted once we figured out what to do with
provisioning the autoupdate end to end tests.

BUG=chromium:1043428
TEST=FEATURES=test emerge-reef update_engine
TEST=cros deployed it, then cros flash using an m71 payload, it succeeded.

Change-Id: I1fecbe3ae845b2e419f0999adc53e4732b1f7696
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2013884
Reviewed-by: Tianjie Xu <xunchang@google.com>
Reviewed-by: Sen Jiang <senj@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/payload_consumer/payload_metadata.h b/payload_consumer/payload_metadata.h
index be43c41..3292351 100644
--- a/payload_consumer/payload_metadata.h
+++ b/payload_consumer/payload_metadata.h
@@ -26,6 +26,7 @@
 #include <brillo/secure_blob.h>
 
 #include "update_engine/common/error_code.h"
+#include "update_engine/common/hardware_interface.h"
 #include "update_engine/common/platform_constants.h"
 #include "update_engine/update_metadata.pb.h"
 
@@ -54,9 +55,11 @@
   // metadata. Returns kMetadataParseError if the metadata can't be parsed given
   // the payload.
   MetadataParseResult ParsePayloadHeader(const brillo::Blob& payload,
+                                         HardwareInterface* hardware,
                                          ErrorCode* error);
   // Simpler version of the above, returns true on success.
-  bool ParsePayloadHeader(const brillo::Blob& payload);
+  bool ParsePayloadHeader(const brillo::Blob& payload,
+                          HardwareInterface* hardware);
 
   // Given the |payload|, verifies that the signed hash of its metadata matches
   // |metadata_signature| (if present) or the metadata signature in payload
@@ -94,12 +97,14 @@
                         Signatures* metadata_signatures);
 
  private:
-  // Returns the byte offset at which the manifest protobuf begins in a payload.
-  uint64_t GetManifestOffset() const;
+  // Set |*out_offset| to the byte offset at which the manifest protobuf begins
+  // in a payload. Return true on success, false if the offset is unknown.
+  bool GetManifestOffset(uint64_t* out_offset) const;
 
-  // Returns the byte offset where the size of the metadata signature is stored
-  // in a payload.
-  uint64_t GetMetadataSignatureSizeOffset() const;
+  // Set |*out_offset| to the byte offset where the size of the metadata
+  // signature is stored in a payload. Return true on success, if this field is
+  // not present in the payload, return false.
+  bool GetMetadataSignatureSizeOffset(uint64_t* out_offset) const;
 
   uint64_t metadata_size_{0};
   uint64_t manifest_size_{0};