resolved conflicts for merge of 4c178ebc to lmp-mr1-dev-plus-aosp

Change-Id: If84527e9333b855d406dc7ac317868f4cfd3f1f2
diff --git a/core/envsetup.mk b/core/envsetup.mk
index cfc9650..43774ea 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -381,8 +381,6 @@
 TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
 TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
 
-TARGET_FACTORY_RAMDISK_OUT := $(PRODUCT_OUT)/factory_ramdisk
-
 COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES
 
 ifeq (,$(strip $(DIST_DIR)))
diff --git a/core/main.mk b/core/main.mk
index 3400f55..981ecef 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -840,12 +840,6 @@
 .PHONY: ramdisk
 ramdisk: $(INSTALLED_RAMDISK_TARGET)
 
-.PHONY: factory_ramdisk
-factory_ramdisk: $(INSTALLED_FACTORY_RAMDISK_TARGET)
-
-.PHONY: factory_bundle
-factory_bundle: $(INSTALLED_FACTORY_BUNDLE_TARGET)
-
 .PHONY: systemtarball
 systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
 
@@ -955,8 +949,6 @@
     $(BUILT_TARGET_FILES_PACKAGE) \
     $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
     $(INSTALLED_RAMDISK_TARGET) \
-    $(INSTALLED_FACTORY_RAMDISK_TARGET) \
-    $(INSTALLED_FACTORY_BUNDLE_TARGET) \
    )
 
   # Put a copy of the radio/bootloader files in the dist dir.
diff --git a/core/product.mk b/core/product.mk
index 3c0bfc3..13324dd 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -96,8 +96,6 @@
     PRODUCT_DEFAULT_DEV_CERTIFICATE \
     PRODUCT_RESTRICT_VENDOR_FILES \
     PRODUCT_VENDOR_KERNEL_HEADERS \
-    PRODUCT_FACTORY_RAMDISK_MODULES \
-    PRODUCT_FACTORY_BUNDLE_MODULES \
     PRODUCT_BOOT_JARS \
     PRODUCT_SUPPORTS_VERITY \
     PRODUCT_OEM_PROPERTIES \
diff --git a/core/tasks/factory_bundle.mk b/core/tasks/factory_bundle.mk
deleted file mode 100644
index 51531cb..0000000
--- a/core/tasks/factory_bundle.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifeq (,$(ONE_SHOT_MAKEFILE))
-ifneq ($(TARGET_BUILD_PDK),true)
-  TARGET_BUILD_FACTORY=true
-endif
-ifeq ($(TARGET_BUILD_FACTORY),true)
-
-# PRODUCT_FACTORY_RAMDISK_MODULES consists of "<module_name>:<install_path>[:<install_path>...]" tuples.
-# <install_path> is relative to the staging directory for the bundle.
-# 
-# Only host modules can be installed here. 
-# (It's possible to relax this, but it's not needed and kind of tricky.  We'll need to add
-# a better way of specifying the class. Really the answer is to stop having modules with
-# duplicate names)
-#
-# You can also add files with PRODUCT_COPY_FILES if necessary.
-#
-# For example:
-# PRODUCT_FACTORY_BUNDLE_MODULES := \
-#     adb:adb fastboot:fastboot
-requested_modules := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_FACTORY_BUNDLE_MODULES))
-
-root_dir := $(PRODUCT_OUT)/factory_bundle
-leaf := $(strip $(TARGET_PRODUCT))-factory_bundle-$(FILE_NAME_TAG)
-named_dir := $(PRODUCT_OUT)/$(leaf)
-tarball := $(PRODUCT_OUT)/$(leaf).tgz
-
-copied_files := \
-  $(foreach _fb_m, $(requested_modules), $(strip \
-    $(eval _fb_m_tuple := $(subst :, ,$(_fb_m))) \
-    $(eval _fb_m_name := $(word 1,$(_fb_m_tuple))) \
-    $(eval _fb_dests := $(wordlist 2,999,$(_fb_m_tuple))) \
-    $(eval _fb_m_built := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(_fb_m_name).BUILT))) \
-    $(if $(_fb_m_built),,$(warning no built file in requested_modules for '$(_fb_m_built)'))\
-    $(foreach _fb_f,$(_fb_dests),$(eval $(call copy-one-file,$(_fb_m_built),$(root_dir)/$(_fb_f))))\
-    $(addprefix $(root_dir)/,$(_fb_dests)) \
-    )) \
-  $(filter $(root_dir)/%, $(ALL_DEFAULT_INSTALLED_MODULES))
-
-ifneq (,$(strip $(copied_files)))
-
-#
-# These files are made by magic so we need to explicitly include them
-#
-$(eval $(call copy-one-file,$(TARGET_OUT)/build.prop,$(root_dir)/build.prop))
-copied_files += $(root_dir)/build.prop
-
-$(eval $(call copy-one-file,$(PRODUCT_OUT)/factory_ramdisk.img,$(root_dir)/factory_ramdisk.img))
-copied_files += $(root_dir)/factory_ramdisk.img
-#
-# End magic
-#
-
-$(tarball): PRIVATE_ROOT_DIR := $(root_dir)
-$(tarball): PRIVATE_NAMED_DIR := $(named_dir)
-
-$(tarball): $(copied_files)
-	@echo "Tarball: $@"
-	$(hide) rm -rf $(PRIVATE_NAMED_DIR)
-	$(hide) ( cp -r $(PRIVATE_ROOT_DIR) $(PRIVATE_NAMED_DIR) \
-			&& tar cfz $@ -C $(dir $(PRIVATE_NAMED_DIR)) $(notdir $(PRIVATE_NAMED_DIR)) \
-			) && rm -rf $(PRIVATE_NAMED_DIR)
-
-INSTALLED_FACTORY_BUNDLE_TARGET := $(tarball)
-
-endif
-
-endif # TARGET_BUILD_PDK
-endif # ONE_SHOT_MAKEFILE
diff --git a/core/tasks/factory_ramdisk.mk b/core/tasks/factory_ramdisk.mk
deleted file mode 100644
index d65d931..0000000
--- a/core/tasks/factory_ramdisk.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifeq (,$(ONE_SHOT_MAKEFILE))
-ifneq ($(TARGET_BUILD_PDK),true)
-  TARGET_BUILD_FACTORY=true
-endif
-ifeq ($(TARGET_BUILD_FACTORY),true)
-
-# PRODUCT_FACTORY_RAMDISK_MODULES consists of "<module_name>:<install_path>[:<install_path>...]" tuples.
-# <install_path> is relative to TARGET_FACTORY_RAMDISK_OUT.
-# We can have multiple <install_path>s because multiple modules may have the same name.
-# For example:
-# PRODUCT_FACTORY_RAMDISK_MODULES := \
-#     toolbox:system/bin/toolbox adbd:sbin/adbd adb:system/bin/adb
-factory_ramdisk_modules := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_FACTORY_RAMDISK_MODULES))
-ifneq (,$(factory_ramdisk_modules))
-
-# A module name may end up in multiple modules (so multiple built files)
-# with the same name.
-# This function selects the module built file based on the install path.
-# $(1): the dest install path
-# $(2): the module built files
-define install-one-factory-ramdisk-module
-$(eval _iofrm_suffix := $(suffix $(1))) \
-$(if $(_iofrm_suffix), \
-    $(eval _iofrm_pattern := %$(_iofrm_suffix)), \
-    $(eval _iofrm_pattern := %$(notdir $(1)))) \
-$(eval _iofrm_src := $(filter $(_iofrm_pattern),$(2))) \
-$(if $(filter 1,$(words $(_iofrm_src))), \
-    $(eval _fulldest := $(TARGET_FACTORY_RAMDISK_OUT)/$(1)) \
-    $(eval $(call copy-one-file,$(_iofrm_src),$(_fulldest))) \
-    $(eval INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES += $(_fulldest)), \
-    $(warning Warning: Cannot find built file in "$(2)" for "$(1)") \
-    )
-endef
-
-INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES :=
-$(foreach m, $(factory_ramdisk_modules), \
-    $(eval _fr_m_tuple := $(subst :, ,$(m))) \
-    $(eval _fr_m_name := $(word 1,$(_fr_m_tuple))) \
-    $(eval _fr_dests := $(wordlist 2,999,$(_fr_m_tuple))) \
-    $(eval _fr_m_built := $(filter $(PRODUCT_OUT)/%, $(ALL_MODULES.$(_fr_m_name).BUILT))) \
-    $(foreach d,$(_fr_dests),$(call install-one-factory-ramdisk-module,$(d),$(_fr_m_built))) \
-    )
-endif
-
-# Files may also be installed via PRODUCT_COPY_FILES, PRODUCT_PACKAGES etc.
-INTERNAL_FACTORY_RAMDISK_FILES := $(filter $(TARGET_FACTORY_RAMDISK_OUT)/%, \
-    $(ALL_DEFAULT_INSTALLED_MODULES))
-
-ifneq (,$(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES)$(INTERNAL_FACTORY_RAMDISK_FILES))
-
-# These files are made by magic in build/core/Makefile so we need to explicitly include them
-$(eval $(call copy-one-file,$(TARGET_OUT)/build.prop,$(TARGET_FACTORY_RAMDISK_OUT)/system/build.prop))
-INTERNAL_FACTORY_RAMDISK_FILES += $(TARGET_FACTORY_RAMDISK_OUT)/system/build.prop
-
-BUILT_FACTORY_RAMDISK_FS := $(PRODUCT_OUT)/factory_ramdisk.gz
-BUILT_FACTORY_RAMDISK_TARGET := $(PRODUCT_OUT)/factory_ramdisk.img
-
-INSTALLED_FACTORY_RAMDISK_FS := $(BUILT_FACTORY_RAMDISK_FS)
-$(INSTALLED_FACTORY_RAMDISK_FS) : $(MKBOOTFS) \
-    $(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES) $(INTERNAL_FACTORY_RAMDISK_FILES) | $(MINIGZIP)
-	$(call pretty,"Target factory ram disk file system: $@")
-	$(hide) $(MKBOOTFS) $(TARGET_FACTORY_RAMDISK_OUT) | $(MINIGZIP) > $@
-
-TARGET_RAMDISK_KERNEL := $(INSTALLED_KERNEL_TARGET)
-INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET)
-ifneq (,$(BOARD_KERNEL_CMDLINE_FACTORY_BOOT))
-  RAMDISK_CMDLINE := --cmdline "$(BOARD_KERNEL_CMDLINE_FACTORY_BOOT)"
-else
-  RAMDISK_CMDLINE :=
-endif
-$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTIMG) $(TARGET_RAMDISK_KERNEL) $(INSTALLED_FACTORY_RAMDISK_FS)
-	$(call pretty,"Target factory ram disk img format: $@")
-	$(MKBOOTIMG) --kernel $(TARGET_RAMDISK_KERNEL) --ramdisk $(INSTALLED_FACTORY_RAMDISK_FS) \
-            --base $(BOARD_KERNEL_BASE) $(BOARD_MKBOOTIMG_ARGS) $(RAMDISK_CMDLINE) --output $@
-
-endif
-
-endif # TARGET_BUILD_PDK
-endif # ONE_SHOT_MAKEFILE
diff --git a/core/tasks/product-graph.mk b/core/tasks/product-graph.mk
index c095c0f..db2cf71 100644
--- a/core/tasks/product-graph.mk
+++ b/core/tasks/product-graph.mk
@@ -116,7 +116,6 @@
 	$(hide) echo 'PRODUCT_DEFAULT_WIFI_CHANNELS=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_WIFI_CHANNELS)' >> $$@
 	$(hide) echo 'PRODUCT_DEFAULT_DEV_CERTIFICATE=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_DEV_CERTIFICATE)' >> $$@
 	$(hide) echo 'PRODUCT_RESTRICT_VENDOR_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_RESTRICT_VENDOR_FILES)' >> $$@
-	$(hide) echo 'PRODUCT_FACTORY_RAMDISK_MODULES=$$(PRODUCTS.$(strip $(1)).PRODUCT_FACTORY_RAMDISK_MODULES)' >> $$@
 	$(hide) echo 'PRODUCT_VENDOR_KERNEL_HEADERS=$$(PRODUCTS.$(strip $(1)).PRODUCT_VENDOR_KERNEL_HEADERS)' >> $$@
 
 $(call product-debug-filename, $(p)): \
diff --git a/tools/product_debug.py b/tools/product_debug.py
index 661c5b7..ff2657c 100755
--- a/tools/product_debug.py
+++ b/tools/product_debug.py
@@ -89,7 +89,6 @@
       "PRODUCT_COPY_FILES",
       "PRODUCT_PACKAGES",
       "PRODUCT_LOCALES",
-      "PRODUCT_FACTORY_RAMDISK_MODULES",
       "PRODUCT_PROPERTY_OVERRIDES",
     )