Merge "Use the update-binary in the source build for downgrade OTAs."

am: 6be54d774b

* commit '6be54d774ba13c79e96b12b797e95bd5bdba0344':
  Use the update-binary in the source build for downgrade OTAs.
This commit is contained in:
Tao Bao 2016-03-09 03:32:44 +00:00 committed by android-build-merger
commit e6caa33438
1 changed files with 15 additions and 3 deletions

View File

@ -74,7 +74,8 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
build to an older one (based on timestamp comparison). "post-timestamp"
will be replaced by "ota-downgrade=yes" in the metadata file. A data
wipe will always be enforced, so "ota-wipe=yes" will also be included in
the metadata file.
the metadata file. The update-binary in the source build will be used in
the OTA package, unless --binary flag is specified.
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
@ -1056,7 +1057,12 @@ endif;
""" % bcb_dev)
script.SetProgress(1)
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
# For downgrade OTAs, we prefer to use the update-binary in the source
# build that is actually newer than the one in the target build.
if OPTIONS.downgrade:
script.AddToZip(source_zip, output_zip, input_path=OPTIONS.updater_binary)
else:
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
metadata["ota-required-cache"] = str(script.required_cache)
WriteMetadata(metadata, output_zip)
@ -1804,7 +1810,13 @@ endif;
script.Unmount("/vendor")
script.Mount("/vendor", recovery_mount_options)
vendor_diff.EmitExplicitTargetVerification(script)
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
# For downgrade OTAs, we prefer to use the update-binary in the source
# build that is actually newer than the one in the target build.
if OPTIONS.downgrade:
script.AddToZip(source_zip, output_zip, input_path=OPTIONS.updater_binary)
else:
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
metadata["ota-required-cache"] = str(script.required_cache)
WriteMetadata(metadata, output_zip)