Allow on device spl downgrade check to be bypassed
Certain OEMs bootloader implementation allow SPL downgrades, therefore
provide an option to bypass on device SPL checks.
Test: th
Bug: 306271739
Change-Id: Iee70ac5bc716c4fed9869928ba6e41c00eab5fd5
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index e52f26a..d7cb2d2 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -311,6 +311,9 @@
install_plan_.powerwash_required =
GetHeaderAsBool(headers[kPayloadPropertyPowerwash], false);
+ install_plan_.spl_downgrade =
+ GetHeaderAsBool(headers[kPayloadPropertySplDowngrade], false);
+
if (!IsProductionBuild()) {
install_plan_.disable_vabc =
GetHeaderAsBool(headers[kPayloadDisableVABC], false);
diff --git a/common/constants.h b/common/constants.h
index 004d9d9..3fcf1f1 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -168,6 +168,7 @@
// Set "POWERWASH=1" to powerwash (factory data reset) the device after
// applying the update.
static constexpr const auto& kPayloadPropertyPowerwash = "POWERWASH";
+static constexpr const auto& kPayloadPropertySplDowngrade = "SPL_DOWNGRADE";
// The network id to pass to android_setprocnetwork before downloading.
// This can be used to zero-rate OTA traffic by sending it over the correct
// network.
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 267805e..8350825 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -485,7 +485,7 @@
block_size_ = manifest_.block_size();
- if (!CheckSPLDowngrade()) {
+ if (!install_plan_->spl_downgrade && !CheckSPLDowngrade()) {
*error = ErrorCode::kPayloadTimestampError;
return false;
}
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index 93aebce..bad34a0 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -171,6 +171,9 @@
// False otherwise.
bool powerwash_required{false};
+ // True if and only if this is an SPL downgrade OTA
+ bool spl_downgrade{false};
+
// True if the updated slot should be marked active on success.
// False otherwise.
bool switch_slot_on_reboot{true};