Only prevent boot image downgrade if sysprop set.
Only return timestamp error if ro.build.ab_update.gki.prevent_downgrade_version is set.
Otherwise, log warning message and continue the update.
This allows devices that does not support GKI updates to install OTA packages where
the boot image has a lower version than the existing, which is supported before.
Bug: 162623577
Test: apply OTA on devices with and without sysprop set
Change-Id: Ie98fb49ffaae1aa60fc94766f53a6fbbae519a5b
diff --git a/hardware_android.h b/hardware_android.h
index b670447..552cb53 100644
--- a/hardware_android.h
+++ b/hardware_android.h
@@ -70,9 +70,15 @@
private:
FRIEND_TEST(HardwareAndroidTest, IsKernelUpdateValid);
- // Helper for IsPartitionUpdateValid.
+ // Helper for IsPartitionUpdateValid. Check an update from |old_release|
+ // to |new_release| is valid or not.
+ // - If |new_release| is invalid, return kDownloadManifestParseError
+ // - If downgrade detected, kPayloadTimestampError if |prevent_downgrade| is
+ // set to true, or kSuccess if |prevent_downgrade| is set to false
+ // - If update is valid, kSuccess.
static ErrorCode IsKernelUpdateValid(const std::string& old_release,
- const std::string& new_release);
+ const std::string& new_release,
+ bool prevent_downgrade);
DISALLOW_COPY_AND_ASSIGN(HardwareAndroid);
};