HardwareInterface::IsPartitionUpdateValid: fine grained error

Let the function emit an error code instead of a boolean to indicate
details of the error that is encountered.

For every partition, if downgrade is detected, emit
kPayloadTimestampError. In this case, still check other partitions for
more severe errors before returning this error.

In some cases, e.g. DeltaArchiveManifest carries a version field that is
not a recognized format, or timestamp sysprops in Android is not an
integer, report a more severe error.

If only downgrade errors are encountered, AllowDowngrade() can still
override the result, and proceed with the update; but, AllowDowngrade
cannot override those severe errors.

Test: update_engine_unittest
Bug: 162623577
Bug: 162553432

Change-Id: Ifc2a6fcd66239c755fb4f6528c3d8c6848afcb27
diff --git a/hardware_android.h b/hardware_android.h
index 2e55f97..d8fbbbe 100644
--- a/hardware_android.h
+++ b/hardware_android.h
@@ -23,6 +23,7 @@
 #include <base/macros.h>
 #include <base/time/time.h>
 
+#include "update_engine/common/error_code.h"
 #include "update_engine/common/hardware.h"
 #include "update_engine/common/hardware_interface.h"
 
@@ -61,7 +62,7 @@
   void SetWarmReset(bool warm_reset) override;
   [[nodiscard]] std::string GetVersionForLogging(
       const std::string& partition_name) const override;
-  [[nodiscard]] bool IsPartitionUpdateValid(
+  [[nodiscard]] ErrorCode IsPartitionUpdateValid(
       const std::string& partition_name,
       const std::string& new_version) const override;