aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Klyubin <klyubin@google.com>2015-12-04 09:21:08 -0800
committerAlex Klyubin <klyubin@google.com>2015-12-08 11:05:13 -0800
commiteb756d7b7b4949d2ec6a7053877815d2337beb7e (patch)
treead52c68d67a1ab7a8fd0f621861a452a5b787aee
parent914a568ba0b31fd0502b86b1d45abdf0f6ee49f1 (diff)
downloadbuild-eb756d7b7b4949d2ec6a7053877815d2337beb7e.tar.gz
Do not run zipalign when re-signing APKs.
Running zipalign is no longer needed because signapk takes care of alignment. Bug: 25794543 Change-Id: I1080240a67ea6f1b41585fff83d18d57fdcf44e2
-rw-r--r--tools/releasetools/common.py24
-rwxr-xr-xtools/releasetools/sign_target_files_apks.py2
2 files changed, 3 insertions, 23 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2c8bbc610e..3b2ce7292d 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -588,29 +588,16 @@ def GetKeyPasswords(keylist):
return key_passwords
-def SignFile(input_name, output_name, key, password, align=None,
- whole_file=False):
+def SignFile(input_name, output_name, key, password, whole_file=False):
"""Sign the input_name zip/jar/apk, producing output_name. Use the
given key and password (the latter may be None if the key does not
have a password.
- If align is an integer > 1, zipalign is run to align stored files in
- the output zip on 'align'-byte boundaries.
-
If whole_file is true, use the "-w" option to SignApk to embed a
signature that covers the whole file in the archive comment of the
zip file.
"""
- if align == 0 or align == 1:
- align = None
-
- if align:
- temp = tempfile.NamedTemporaryFile()
- sign_name = temp.name
- else:
- sign_name = output_name
-
cmd = [OPTIONS.java_path, OPTIONS.java_args, "-jar",
os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)]
cmd.extend(OPTIONS.extra_signapk_args)
@@ -618,7 +605,7 @@ def SignFile(input_name, output_name, key, password, align=None,
cmd.append("-w")
cmd.extend([key + OPTIONS.public_key_suffix,
key + OPTIONS.private_key_suffix,
- input_name, sign_name])
+ input_name, output_name])
p = Run(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if password is not None:
@@ -627,13 +614,6 @@ def SignFile(input_name, output_name, key, password, align=None,
if p.returncode != 0:
raise ExternalError("signapk.jar failed: return code %s" % (p.returncode,))
- if align:
- p = Run(["zipalign", "-f", "-p", str(align), sign_name, output_name])
- p.communicate()
- if p.returncode != 0:
- raise ExternalError("zipalign failed: return code %s" % (p.returncode,))
- temp.close()
-
def CheckSize(data, target, info_dict):
"""Check the data string passed against the max size limit, if
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index cbf78a1c8c..baf60f5c6e 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -134,7 +134,7 @@ def SignApk(data, keyname, pw):
signed = tempfile.NamedTemporaryFile()
- common.SignFile(unsigned.name, signed.name, keyname, pw, align=4)
+ common.SignFile(unsigned.name, signed.name, keyname, pw)
data = signed.read()
unsigned.close()