diff options
-rwxr-xr-x | tools/releasetools/ota_from_target_files | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index ba29f9b..cf5fb34 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -353,12 +353,17 @@ def WriteFullOTAPackage(input_zip, output_zip): # change very often. script = edify_generator.EdifyGenerator(2) + metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip), + "pre-device": GetBuildProp("ro.product.device", input_zip), + } + device_specific = common.DeviceSpecificParams( input_zip=input_zip, input_version=GetRecoveryAPIVersion(input_zip), output_zip=output_zip, script=script, - input_tmp=OPTIONS.input_tmp) + input_tmp=OPTIONS.input_tmp, + metadata=metadata) if not OPTIONS.omit_prereq: ts = GetBuildProp("ro.build.date.utc", input_zip) @@ -404,6 +409,13 @@ def WriteFullOTAPackage(input_zip, output_zip): script.UnmountAll() script.AddToZip(input_zip, output_zip) + WriteMetadata(metadata, output_zip) + + +def WriteMetadata(metadata, output_zip): + common.ZipWriteStr(output_zip, "META-INF/com/android/metadata", + "".join(["%s=%s\n" % kv + for kv in sorted(metadata.iteritems())])) class File(object): @@ -589,13 +601,17 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): else: raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,)) + metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip), + } + device_specific = common.DeviceSpecificParams( source_zip=source_zip, source_version=source_version, target_zip=target_zip, target_version=target_version, output_zip=output_zip, - script=script) + script=script, + metadata=metadata) print "Loading target..." target_data = LoadSystemFiles(target_zip) @@ -640,6 +656,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): source_fp = GetBuildProp("ro.build.fingerprint", source_zip) target_fp = GetBuildProp("ro.build.fingerprint", target_zip) + metadata["pre-build"] = source_fp + metadata["post-build"] = target_fp script.Mount("MTD", "system", "/system") script.AssertSomeFingerprint(source_fp, target_fp) @@ -818,6 +836,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): scirpt.AppendExtra(OPTIONS.extra_script) script.AddToZip(target_zip, output_zip) + WriteMetadata(metadata, output_zip) def main(argv): |