Make change and version bump to QP1A.181127.001

Change-Id: I1e6cd3b5d4d5219b5432b47f3e8060a5a4343770
diff --git a/core/Makefile b/core/Makefile
index 8d4a199..6db4b2b 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -415,11 +415,13 @@
 	        bash $(BUILDINFO_SH) >> $@
 	$(hide) $(foreach file,$(system_prop_file), \
 		if [ -f "$(file)" ]; then \
-			echo "#" >> $@; \
 			echo Target buildinfo from: "$(file)"; \
+			echo "" >> $@; \
+			echo "#" >> $@; \
 			echo "# from $(file)" >> $@; \
 			echo "#" >> $@; \
 			cat $(file) >> $@; \
+			echo "# end of $(file)" >> $@; \
 		fi;)
 	$(if $(FINAL_BUILD_PROPERTIES), \
 		$(hide) echo >> $@; \
@@ -486,22 +488,38 @@
 INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
 
+ifdef TARGET_PRODUCT_PROP
+product_prop_files := $(TARGET_PRODUCT_PROP)
+else
+product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
+endif
+
 FINAL_PRODUCT_PROPERTIES += \
     $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
 FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
     $(FINAL_PRODUCT_PROPERTIES),=)
 
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
 	@echo Target product buildinfo: $@
 	@mkdir -p $(dir $@)
 	$(hide) echo > $@
 ifdef BOARD_USES_PRODUCTIMAGE
 	$(hide) $(call generate-common-build-props,product,$@)
 endif  # BOARD_USES_PRODUCTIMAGE
+	$(hide) $(foreach file,$(product_prop_files), \
+		if [ -f "$(file)" ]; then \
+			echo Target product properties from: "$(file)"; \
+			echo "" >> $@; \
+			echo "#" >> $@; \
+			echo "# from $(file)" >> $@; \
+			echo "#" >> $@; \
+			cat $(file) >> $@; \
+			echo "# end of $(file)" >> $@; \
+		fi;)
 	$(hide) echo "#" >> $@; \
 	        echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
 	        echo "#" >> $@; \
-          echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
+	        echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
 	$(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
 		echo "$(line)" >> $@;)
 	$(hide) build/make/tools/post_process_props.py $@
diff --git a/core/build_id.mk b/core/build_id.mk
index d101beb..905ba62 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,4 +18,4 @@
 # (like "CRB01").  It must be a single word, and is
 # capitalized by convention.
 
-BUILD_ID=QP1A.181126.003
+BUILD_ID=QP1A.181127.001
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index b0dd0f8..2d91b60 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -260,11 +260,7 @@
     args = OPTIONS.info_dict.get("avb_dtbo_add_hash_footer_args")
     if args and args.strip():
       cmd.extend(shlex.split(args))
-    proc = common.Run(cmd)
-    output, _ = proc.communicate()
-    assert proc.returncode == 0, \
-        "Failed to call 'avbtool add_hash_footer' for {}:\n{}".format(
-            img.name, output)
+    common.RunAndCheckOutput(cmd)
 
   img.Write()
   return img.name
@@ -331,8 +327,8 @@
       info_dict[image_blocks_key] = int(image_size) / 4096 - 1
 
   use_dynamic_size = (
-    info_dict.get("use_dynamic_partition_size") == "true" and
-    what in shlex.split(info_dict.get("dynamic_partition_list", "").strip()))
+      info_dict.get("use_dynamic_partition_size") == "true" and
+      what in shlex.split(info_dict.get("dynamic_partition_list", "").strip()))
   if use_dynamic_size:
     info_dict.update(build_image.GlobalDictFromImageProp(image_props, what))
 
@@ -463,10 +459,7 @@
         assert found, 'Failed to find {}'.format(image_path)
     cmd.extend(split_args)
 
-  proc = common.Run(cmd)
-  stdoutdata, _ = proc.communicate()
-  assert proc.returncode == 0, \
-      "avbtool make_vbmeta_image failed:\n{}".format(stdoutdata)
+  common.RunAndCheckOutput(cmd)
   img.Write()
   return img.name
 
@@ -493,11 +486,7 @@
   args = OPTIONS.info_dict.get("board_bpt_make_table_args")
   if args:
     cmd.extend(shlex.split(args))
-
-  proc = common.Run(cmd)
-  stdoutdata, _ = proc.communicate()
-  assert proc.returncode == 0, \
-      "bpttool make_table failed:\n{}".format(stdoutdata)
+  common.RunAndCheckOutput(cmd)
 
   img.Write()
   bpt.Write()
@@ -612,10 +601,7 @@
 
   temp_care_map = common.MakeTempFile(prefix="caremap-", suffix=".pb")
   care_map_gen_cmd = ["care_map_generator", temp_care_map_text, temp_care_map]
-  proc = common.Run(care_map_gen_cmd)
-  output, _ = proc.communicate()
-  assert proc.returncode == 0, \
-      "Failed to generate the care_map proto message:\n{}".format(output)
+  common.RunAndCheckOutput(care_map_gen_cmd)
 
   care_map_path = "META/care_map.pb"
   if output_zip and care_map_path not in output_zip.namelist():
@@ -665,11 +651,7 @@
   cmd = [OPTIONS.info_dict['lpmake']]
   cmd += shlex.split(OPTIONS.info_dict['lpmake_args'].strip())
   cmd += ['--output', img.name]
-
-  proc = common.Run(cmd)
-  stdoutdata, _ = proc.communicate()
-  assert proc.returncode == 0, \
-      "lpmake tool failed:\n{}".format(stdoutdata)
+  common.RunAndCheckOutput(cmd)
 
   img.Write()
 
@@ -715,10 +697,7 @@
 
   cmd += ['--output', outdir.name]
 
-  proc = common.Run(cmd)
-  stdoutdata, _ = proc.communicate()
-  assert proc.returncode == 0, \
-      "lpmake tool failed:\n{}".format(stdoutdata)
+  common.RunAndCheckOutput(cmd)
 
   for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
     img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index ad22b72..d2a274d 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -40,11 +40,7 @@
 
     # Calls an external binary to convert the proto message.
     cmd = ["care_map_generator", "--parse_proto", file_name, text_file]
-    proc = common.Run(cmd)
-    output, _ = proc.communicate()
-    self.assertEqual(
-        0, proc.returncode,
-        "Failed to run care_map_generator:\n{}".format(output))
+    common.RunAndCheckOutput(cmd)
 
     with open(text_file, 'r') as verify_fp:
       plain_text = verify_fp.read()