Allow OEMs to bypass the on device SPL downgrade check

Certain OEMs bootloader implementation allow SPL downgrade. Allow on
device SPL downgrade check to be bypassed.

Test: th
Bug: 306271739
Change-Id: Iba991e12d36291e2d0547c94ef54c750d87f35fb
This commit is contained in:
Kelvin Zhang 2023-10-23 10:03:02 -07:00
parent 2d57e36a39
commit d51332c82f
2 changed files with 10 additions and 7 deletions

View file

@ -995,7 +995,7 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
metadata = GetPackageMetadata(target_info, source_info)
# Generate payload.
payload = PayloadGenerator(
wipe_user_data=OPTIONS.wipe_user_data, minor_version=OPTIONS.force_minor_version, is_partial_update=OPTIONS.partial)
wipe_user_data=OPTIONS.wipe_user_data, minor_version=OPTIONS.force_minor_version, is_partial_update=OPTIONS.partial, spl_downgrade=OPTIONS.spl_downgrade)
partition_timestamps_flags = []
# Enforce a max timestamp this payload can be applied on top of.

View file

@ -791,7 +791,7 @@ class PayloadGenerator(object):
SECONDARY_PAYLOAD_BIN = 'secondary/payload.bin'
SECONDARY_PAYLOAD_PROPERTIES_TXT = 'secondary/payload_properties.txt'
def __init__(self, secondary=False, wipe_user_data=False, minor_version=None, is_partial_update=False):
def __init__(self, secondary=False, wipe_user_data=False, minor_version=None, is_partial_update=False, spl_downgrade=False):
"""Initializes a Payload instance.
Args:
@ -803,6 +803,7 @@ class PayloadGenerator(object):
self.wipe_user_data = wipe_user_data
self.minor_version = minor_version
self.is_partial_update = is_partial_update
self.spl_downgrade = spl_downgrade
def _Run(self, cmd): # pylint: disable=no-self-use
# Don't pipe (buffer) the output if verbose is set. Let
@ -912,13 +913,15 @@ class PayloadGenerator(object):
"--properties_file=" + properties_file]
self._Run(cmd)
if self.secondary:
with open(properties_file, "a") as f:
f.write("SWITCH_SLOT_ON_REBOOT=0\n")
if self.wipe_user_data:
with open(properties_file, "a") as f:
with open(properties_file, "a") as f:
if self.wipe_user_data:
f.write("POWERWASH=1\n")
if self.secondary:
f.write("SWITCH_SLOT_ON_REBOOT=0\n")
if self.spl_downgrade:
f.write("SPL_DOWNGRADE=1\n")
self.payload_properties = properties_file