From f9be5eeb4442b90b17e737dcb57c8cdfaadf4d79 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Thu, 22 Jul 2021 18:21:25 +0900 Subject: [PATCH] cleanup: remove unnecessary steps in apex_utils `zipalign` before `signapk -a 4096` is unnecessary step since `signapk -a 4096` does the same thing. And, compressed APEX files don't need entries to be aligned. Bug: 193362313 Test: atest --host releasetools_test Change-Id: I0758d1162f7c3eb8cc9c73978b5ae5484f007a3a --- tools/releasetools/apex_utils.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 1ce08ea86f..bd86acf69a 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -361,11 +361,7 @@ def SignUncompressedApex(avbtool, apex_file, payload_key, container_key, common.ZipWrite(apex_zip, payload_public_key, arcname=APEX_PUBKEY) common.ZipClose(apex_zip) - # 3. Align the files at page boundary (same as in apexer). - aligned_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex') - common.RunAndCheckOutput(['zipalign', '-f', '4096', apex_file, aligned_apex]) - - # 4. Sign the APEX container with container_key. + # 3. Sign the APEX container with container_key. signed_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex') # Specify the 4K alignment when calling SignApk. @@ -374,7 +370,7 @@ def SignUncompressedApex(avbtool, apex_file, payload_key, container_key, password = container_pw.get(container_key) if container_pw else None common.SignFile( - aligned_apex, + apex_file, signed_apex, container_key, password, @@ -434,26 +430,17 @@ def SignCompressedApex(avbtool, apex_file, payload_key, container_key, '--input', signed_original_apex_file, '--output', compressed_apex_file]) - # 4. Align apex - aligned_apex = common.MakeTempFile(prefix='apex-container-', suffix='.capex') - common.RunAndCheckOutput(['zipalign', '-f', '4096', compressed_apex_file, - aligned_apex]) - - # 5. Sign the APEX container with container_key. + # 4. Sign the APEX container with container_key. signed_apex = common.MakeTempFile(prefix='apex-container-', suffix='.capex') - # Specify the 4K alignment when calling SignApk. - extra_signapk_args = OPTIONS.extra_signapk_args[:] - extra_signapk_args.extend(['-a', '4096']) - password = container_pw.get(container_key) if container_pw else None common.SignFile( - aligned_apex, + compressed_apex_file, signed_apex, container_key, password, codename_to_api_level_map=codename_to_api_level_map, - extra_signapk_args=extra_signapk_args) + extra_signapk_args=OPTIONS.extra_signapk_args) return signed_apex