diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 936ef888dc..a01e516632 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -137,6 +137,12 @@ Usage: sign_target_files_apks [flags] input_target_files output_target_files --android_jar_path Path to the android.jar to repack the apex file. + --prebuilts_path + Specify a path that contains one or more image files, to be added to the + signed_target-files.zip. Note, this directory must contain *only* .img + files that you want to add. All other files in the directory will be + added as well. + --allow_gsi_debug_sepolicy Allow the existence of the file 'userdebug_plat_sepolicy.cil' under (/system/system_ext|/system_ext)/etc/selinux. @@ -194,6 +200,7 @@ OPTIONS.gki_signing_key = None OPTIONS.gki_signing_algorithm = None OPTIONS.gki_signing_extra_args = None OPTIONS.android_jar_path = None +OPTIONS.prebuilts_path = "" OPTIONS.allow_gsi_debug_sepolicy = False @@ -1307,6 +1314,8 @@ def main(argv): OPTIONS.gki_signing_extra_args = a elif o == "--allow_gsi_debug_sepolicy": OPTIONS.allow_gsi_debug_sepolicy = True + elif o == "--prebuilts_path": + OPTIONS.prebuilts_path = a else: return False return True @@ -1358,6 +1367,7 @@ def main(argv): "gki_signing_algorithm=", "gki_signing_extra_args=", "allow_gsi_debug_sepolicy", + "prebuilts_path=", ], extra_option_handler=option_handler) @@ -1400,6 +1410,12 @@ def main(argv): platform_api_level, codename_to_api_level_map, compressed_extension) + if OPTIONS.prebuilts_path: + prebuilt_list = os.listdir(OPTIONS.prebuilts_path) + + for prebuilt_image in prebuilt_list: + common.ZipWrite(output_zip, os.path.join(OPTIONS.prebuilts_path, prebuilt_image), os.path.join("IMAGES/", prebuilt_image)) + common.ZipClose(input_zip) common.ZipClose(output_zip) @@ -1409,6 +1425,10 @@ def main(argv): # recovery patch is guaranteed to be regenerated there. if OPTIONS.rebuild_recovery: new_args.append("--rebuild_recovery") + + if OPTIONS.prebuilts_path: + new_args.append("--add_missing") + new_args.append(args[1]) add_img_to_target_files.main(new_args)