Attach apk_name as a suffix for the temporary files
With this change the name of the signed and unsigned APK will be something like 'tmpadrbpp9f/tmpvl0lf2kr/tmpknja6mca_MyApk.apk' instead of 'tmpadrbpp9f/tmpvl0lf2kr/tmpknja6mca'.
The motivation for this change is a better logging and transparency what is being signed in the underlying client.
Change-Id: I32b0e93d5859ca3fb712e426705f16d329d71f0e
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 47360c9..c2bfd32 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -383,8 +383,8 @@
def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map,
- is_compressed):
- unsigned = tempfile.NamedTemporaryFile()
+ is_compressed, apk_name):
+ unsigned = tempfile.NamedTemporaryFile(suffix='_' + apk_name)
unsigned.write(data)
unsigned.flush()
@@ -402,7 +402,7 @@
unsigned.close()
unsigned = uncompressed
- signed = tempfile.NamedTemporaryFile()
+ signed = tempfile.NamedTemporaryFile(suffix='_' + apk_name)
# For pre-N builds, don't upgrade to SHA-256 JAR signatures based on the APK's
# minSdkVersion to avoid increasing incremental OTA update sizes. If an APK
@@ -488,7 +488,7 @@
if key not in common.SPECIAL_CERT_STRINGS:
print(" signing: %-*s (%s)" % (maxsize, name, key))
signed_data = SignApk(data, key, key_passwords[key], platform_api_level,
- codename_to_api_level_map, is_compressed)
+ codename_to_api_level_map, is_compressed, name)
common.ZipWriteStr(output_tf_zip, out_info, signed_data)
else:
# an APK we're not supposed to sign.