diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2021-02-10 09:13:26 -0500 |
---|---|---|
committer | Kelvin Zhang <zhangkelvin@google.com> | 2021-02-25 10:15:45 -0500 |
commit | 05ff7055b6d1a62cad87f179f605f624ce2b2c63 (patch) | |
tree | 02d84e098913961989000c9832208f14c37a6409 /tools/releasetools/ota_utils.py | |
parent | 3f631cf2aba0296f1156b7bfa9dc6808697829cf (diff) | |
download | platform_build-05ff7055b6d1a62cad87f179f605f624ce2b2c63.tar.gz platform_build-05ff7055b6d1a62cad87f179f605f624ce2b2c63.tar.bz2 platform_build-05ff7055b6d1a62cad87f179f605f624ce2b2c63.zip |
Add spl-downgrade field to ota metadata
In aosp/1581143 , we banned generation of SPL downgrade OTAs. However,
caller of OTA script can still force an SPL downgrade OTA by passing
--spl_downgrade flag. If this flag is specified, we propagate it to OTA
metadata so that GOTA server can properly honor this flag.
Test: th
Change-Id: Ic8cdc850d2210f4149ad9121fa4ed2e5a4f59bcc
Diffstat (limited to 'tools/releasetools/ota_utils.py')
-rw-r--r-- | tools/releasetools/ota_utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py index 6bbcc923bb..104f02f35e 100644 --- a/tools/releasetools/ota_utils.py +++ b/tools/releasetools/ota_utils.py @@ -39,6 +39,8 @@ OPTIONS.boot_variable_file = None METADATA_NAME = 'META-INF/com/android/metadata' METADATA_PROTO_NAME = 'META-INF/com/android/metadata.pb' UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*'] +SECURITY_PATCH_LEVEL_PROP_NAME = "ro.build.version.security_patch" + def FinalizeMetadata(metadata, input_file, output_file, needed_property_files): """Finalizes the metadata and signs an A/B OTA package. @@ -168,7 +170,7 @@ def UpdateDeviceState(device_state, build_info, boot_variable_values, build_info_set = ComputeRuntimeBuildInfos(build_info, boot_variable_values) assert "ab_partitions" in build_info.info_dict,\ - "ab_partitions property required for ab update." + "ab_partitions property required for ab update." ab_partitions = set(build_info.info_dict.get("ab_partitions")) # delta_generator will error out on unused timestamps, @@ -317,6 +319,8 @@ def BuildLegacyOtaMetadata(metadata_proto): metadata_dict['pre-build'] = separator.join(pre_build.build) metadata_dict['pre-build-incremental'] = pre_build.build_incremental + if metadata_proto.spl_downgrade: + metadata_dict['spl-downgrade'] = 'yes' metadata_dict.update(metadata_proto.property_files) return metadata_dict @@ -330,6 +334,9 @@ def HandleDowngradeMetadata(metadata_proto, target_info, source_info): pre_timestamp = source_info.GetBuildProp("ro.build.date.utc") is_downgrade = int(post_timestamp) < int(pre_timestamp) + if OPTIONS.spl_downgrade: + metadata_proto.spl_downgrade = True + if OPTIONS.downgrade: if not is_downgrade: raise RuntimeError( |