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
This commit is contained in:
Oleg Aravin 2020-06-02 16:02:38 -07:00
parent fa9ea4b8b0
commit 8046cb0a2c
1 changed files with 4 additions and 4 deletions

View File

@ -383,8 +383,8 @@ def CheckApkAndApexKeysAvailable(input_tf_zip, known_keys,
def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map,
is_compressed): is_compressed, apk_name):
unsigned = tempfile.NamedTemporaryFile() unsigned = tempfile.NamedTemporaryFile(suffix='_' + apk_name)
unsigned.write(data) unsigned.write(data)
unsigned.flush() unsigned.flush()
@ -402,7 +402,7 @@ def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map,
unsigned.close() unsigned.close()
unsigned = uncompressed 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 # 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 # minSdkVersion to avoid increasing incremental OTA update sizes. If an APK
@ -488,7 +488,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
if key not in common.SPECIAL_CERT_STRINGS: if key not in common.SPECIAL_CERT_STRINGS:
print(" signing: %-*s (%s)" % (maxsize, name, key)) print(" signing: %-*s (%s)" % (maxsize, name, key))
signed_data = SignApk(data, key, key_passwords[key], platform_api_level, 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) common.ZipWriteStr(output_tf_zip, out_info, signed_data)
else: else:
# an APK we're not supposed to sign. # an APK we're not supposed to sign.