Continue to pass in --signing_helper for avbtool.
BUG: 152424931
Test: Tested Locally
Change-Id: I4e93a899b9055c937980a496f20b35c01ccbb4c1
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 9e27d29..ae9b793 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -52,7 +52,7 @@
self.key_passwords = key_passwords
self.codename_to_api_level_map = codename_to_api_level_map
- def ProcessApexFile(self, apk_keys, payload_key):
+ def ProcessApexFile(self, apk_keys, payload_key, signing_args=None):
"""Scans and signs the apk files and repack the apex
Args:
@@ -87,7 +87,7 @@
logger.info('No apk file has been signed in %s', self.apex_path)
return self.apex_path
- return self.RepackApexPayload(payload_dir, payload_key)
+ return self.RepackApexPayload(payload_dir, payload_key, signing_args)
def ExtractApexPayloadAndSignApks(self, apk_entries, apk_keys):
"""Extracts the payload image and signs the containing apk files."""
@@ -115,7 +115,7 @@
has_signed_apk = True
return payload_dir, has_signed_apk
- def RepackApexPayload(self, payload_dir, payload_key):
+ def RepackApexPayload(self, payload_dir, payload_key, signing_args=None):
"""Rebuilds the apex file with the updated payload directory."""
apex_dir = common.MakeTempDir()
# Extract the apex file and reuse its meta files as repack parameters.
@@ -145,6 +145,12 @@
os.getenv('PATH')]
for key, val in arguments_dict.items():
generate_image_cmd.extend(['--' + key, val])
+
+ # Add quote to the signing_args as we will pass
+ # --signing_args "--signing_helper_with_files=%path" to apexer
+ if signing_args:
+ generate_image_cmd.extend(['--signing_args', '"{}"'.format(signing_args)])
+
# optional arguments for apex repacking
manifest_json = os.path.join(apex_dir, 'apex_manifest.json')
if os.path.exists(manifest_json):
@@ -303,7 +309,7 @@
# the apex file after signing.
apk_signer = ApexApkSigner(apex_file, container_pw,
codename_to_api_level_map)
- apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key)
+ apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key, signing_args)
# 2a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
# payload_key.