OSDN Git Service

Fix ro.build.product not found by ota_from_target_files in some cases
authordhacker29 <dhackerdvm@gmail.com>
Tue, 2 Dec 2014 07:01:56 +0000 (02:01 -0500)
committerMichael Bestas <mikeioannina@gmail.com>
Sun, 1 Jan 2017 15:12:12 +0000 (17:12 +0200)
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

core/Makefile
tools/releasetools/ota_from_target_files.py

index eb454dc..c968bdb 100644 (file)
@@ -2065,6 +2065,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)
index ef33313..686d906 100755 (executable)
@@ -469,10 +469,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)
@@ -1566,11 +1563,16 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
     oem_dict = common.LoadDictionaryFromLines(
         open(OPTIONS.oem_source).readlines())
 
-  metadata = {
-      "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
-                                   OPTIONS.source_info_dict),
-      "ota-type": "FILE",
-  }
+  if OPTIONS.override_prop:
+    metadata = {
+        "ota-type": "FILE",
+    }
+  else:
+    metadata = {
+        "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
+                                     OPTIONS.source_info_dict),
+        "ota-type": "FILE",
+    }
 
   post_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.target_info_dict)
   pre_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.source_info_dict)