Skip to content

Commit

Permalink
Fix ro.build.product not found by ota_from_target_files in some cases
Browse files Browse the repository at this point in the history
After I5dccba2172dade3dacc55d832a2042fce306b5f5 it was possible that
if override_prop was set and override_device was not set the script
was looking for a prop that did not exist.

Change-Id: I444a33de5bcb59f129bdcf631c2a6540c5926545
  • Loading branch information
dhacker29 authored and andi34 committed Aug 8, 2016
1 parent 33bb89f commit afd0710
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,9 @@ endif

ifneq ($(TARGET_UNIFIED_DEVICE),)
$(INTERNAL_OTA_PACKAGE_TARGET): override_prop := --override_prop=true
ifeq ($(TARGET_OTA_ASSERT_DEVICE),)
$(INTERNAL_OTA_PACKAGE_TARGET): override_device := $(TARGET_DEVICE)
endif
endif

$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
Expand Down
20 changes: 11 additions & 9 deletions tools/releasetools/ota_from_target_files
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,7 @@ def AppendAssertions(script, info_dict, oem_dict = None):
oem_props = info_dict.get("oem_fingerprint_properties")
if oem_props is None or len(oem_props) == 0:
if OPTIONS.override_device == "auto":
if OPTIONS.override_prop:
device = GetBuildProp("ro.build.product", info_dict)
else:
device = GetBuildProp("ro.product.device", info_dict)
device = GetBuildProp("ro.product.device", info_dict)
else:
device = OPTIONS.override_device
script.AssertDevice(device)
Expand Down Expand Up @@ -1091,11 +1088,16 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(open(OPTIONS.oem_source).readlines())

metadata = {"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
OPTIONS.source_info_dict),
"post-timestamp": GetBuildProp("ro.build.date.utc",
OPTIONS.target_info_dict),
}
if OPTIONS.override_prop:
metadata = {"post-timestamp": GetBuildProp("ro.build.date.utc",
OPTIONS.target_info_dict),
}
else:
metadata = {"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
OPTIONS.source_info_dict),
"post-timestamp": GetBuildProp("ro.build.date.utc",
OPTIONS.target_info_dict),
}

device_specific = common.DeviceSpecificParams(
source_zip=source_zip,
Expand Down

0 comments on commit afd0710

Please sign in to comment.