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
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 1ce08ea..bd86acf 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -361,11 +361,7 @@
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 @@
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 @@
'--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