From f80e886273a18131a39bcd2f3fcd653f99c09cc0 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Fri, 20 Jan 2023 10:18:11 -0800 Subject: [PATCH] Fix non-AB OTA signing issue After aosp/2201756 , caller must explicitly pass signing key as a parameter to FinalizeMetadata . We forgot to update non_ab.py , therefore causing non-AB OTAs to be unsigned. Test: th Bug: 265895599 Change-Id: Ia54b1105f37b6574742b9b55d715fc9c61c223eb --- tools/releasetools/non_ab_ota.py | 4 ++-- tools/releasetools/ota_utils.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/non_ab_ota.py b/tools/releasetools/non_ab_ota.py index ac85aa4f1f..44bac28d1f 100644 --- a/tools/releasetools/non_ab_ota.py +++ b/tools/releasetools/non_ab_ota.py @@ -282,7 +282,7 @@ endif; needed_property_files = ( NonAbOtaPropertyFiles(), ) - FinalizeMetadata(metadata, staging_file, output_file, needed_property_files) + FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key) def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file): @@ -537,7 +537,7 @@ endif; needed_property_files = ( NonAbOtaPropertyFiles(), ) - FinalizeMetadata(metadata, staging_file, output_file, needed_property_files) + FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key) def GenerateNonAbOtaPackage(target_file, output_file, source_file=None): diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py index e36a2be126..e2ce31d590 100644 --- a/tools/releasetools/ota_utils.py +++ b/tools/releasetools/ota_utils.py @@ -132,8 +132,10 @@ def FinalizeMetadata(metadata, input_file, output_file, needed_property_files=No # Re-sign the package after updating the metadata entry. if no_signing: + logger.info(f"Signing disabled for output file {output_file}") shutil.copy(prelim_signing, output_file) else: + logger.info(f"Signing the output file {output_file} with key {package_key}") SignOutput(prelim_signing, output_file, package_key, pw) # Reopen the final signed zip to double check the streaming metadata.