Merge "Remove useless stuff from "AndroidConfig.h"."
diff --git a/core/binary.mk b/core/binary.mk
index 33f243b..48b4081 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -209,7 +209,7 @@
 ifdef LOCAL_INSTALLED_MODULE
 ifdef installed_shared_library_module_names
 $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
-    $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
+    $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
 endif
 endif
 
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 5d144d9..c6a09d8 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -152,9 +152,6 @@
 LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
 LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
 LOCAL_MODULE_HOST_ARCH:=
-LOCAL_MODULE_HOST_ARCH_WARN:=
-LOCAL_MODULE_UNSUPPORTED_HOST_ARCH:=
-LOCAL_MODULE_UNSUPPORTED_HOST_ARCH_WARN:=
 
 # arch specific variables
 LOCAL_SRC_FILES_$(TARGET_ARCH):=
diff --git a/core/definitions.mk b/core/definitions.mk
index 746becf..9260345 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2121,20 +2121,6 @@
 endef
 
 ###########################################################
-## Expand a module name list with REQUIRED modules
-###########################################################
-# $(1): The variable name that holds the initial module name list.
-#       the variable will be modified to hold the expanded results.
-# $(2): The initial module name list.
-# Returns empty string (maybe with some whitespaces).
-define expand-required-modules
-$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
-  $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
-$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
-  $(call expand-required-modules,$(1),$(_erm_new_modules)))
-endef
-
-###########################################################
 ## API Check
 ###########################################################
 
diff --git a/core/host_executable.mk b/core/host_executable.mk
index 53b5fd1..bf3cde1 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -2,6 +2,7 @@
 my_prefix := HOST_
 include $(BUILD_SYSTEM)/multilib.mk
 
+ifndef LOCAL_MODULE_HOST_ARCH
 ifndef my_module_multilib
 ifeq ($(HOST_PREFER_32_BIT),true)
 my_module_multilib := 32
@@ -10,6 +11,7 @@
 my_module_multilib := first
 endif
 endif
+endif
 
 ifeq ($(my_module_multilib),both)
 ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 2fdf61f..438a9ce 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -1,6 +1,7 @@
 my_prefix := HOST_
 include $(BUILD_SYSTEM)/multilib.mk
 
+ifndef LOCAL_MODULE_HOST_ARCH
 ifndef my_module_multilib
 ifeq ($(HOST_PREFER_32_BIT),true)
 my_module_multilib := 32
@@ -9,6 +10,7 @@
 my_module_multilib := first
 endif
 endif
+endif
 
 LOCAL_2ND_ARCH_VAR_PREFIX :=
 include $(BUILD_SYSTEM)/module_arch_supported.mk
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index c40cf7d..74ac2ea 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -1,6 +1,7 @@
 my_prefix := HOST_
 include $(BUILD_SYSTEM)/multilib.mk
 
+ifndef LOCAL_MODULE_HOST_ARCH
 ifndef my_module_multilib
 ifeq ($(HOST_PREFER_32_BIT),true)
 my_module_multilib := 32
@@ -9,6 +10,7 @@
 my_module_multilib := first
 endif
 endif
+endif
 
 LOCAL_2ND_ARCH_VAR_PREFIX :=
 include $(BUILD_SYSTEM)/module_arch_supported.mk
diff --git a/core/main.mk b/core/main.mk
index e3b7089..15b4cbc 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -569,7 +569,6 @@
 # brought in as requirements of other modules.
 #
 # Resolve the required module name to 32-bit or 64-bit variant.
-ifeq ($(TARGET_IS_64_BIT),true)
 # Get a list of corresponding 32-bit module names, if one exists.
 define get-32-bit-modules
 $(strip $(foreach m,$(1),\
@@ -599,12 +598,10 @@
         $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\
        )\
      )\
-     $(eval ALL_MODULES.$(m).REQUIRED := $(r_r))\
+     $(eval ALL_MODULES.$(m).REQUIRED := $(strip $(r_r)))\
   )\
 )
 r_r :=
-endif
-
 
 define add-required-deps
 $(1): | $(2)
@@ -630,37 +627,36 @@
 t_r :=
 h_r :=
 
-# Resolve the dependencies on shared libraries.
-$(foreach m,$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
-  $(eval p := $(subst :,$(space),$(m))) \
-  $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
-    $(subst $(comma),$(space),$(lastword $(p)))))) \
-  $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
-$(foreach m,$(HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \
-  $(eval p := $(subst :,$(space),$(m))) \
-  $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
-    $(subst $(comma),$(space),$(lastword $(p)))))) \
-  $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+# Establish the dependecies on the shared libraries.
+# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
+# so they can be expanded to product_MODULES later.
+# $(1): TARGET_ or HOST_.
+# $(2): non-empty for 2nd arch.
+define resolve-shared-libs-depes
+$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
+  $(eval p := $(subst :,$(space),$(m)))\
+  $(eval mod := $(firstword $(p)))\
+  $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
+  $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
+  $(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\
+    $(deps))))\
+  $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\
+  $(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
+endef
+
+$(call resolve-shared-libs-depes,TARGET_)
 ifdef TARGET_2ND_ARCH
-$(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
-  $(eval p := $(subst :,$(space),$(m))) \
-  $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
-    $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX), \
-      $(subst $(comma),$(space),$(lastword $(p))))))) \
-  $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+$(call resolve-shared-libs-depes,TARGET_,true)
 endif
+$(call resolve-shared-libs-depes,HOST_)
 ifdef HOST_2ND_ARCH
-$(foreach m,$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \
-  $(eval p := $(subst :,$(space),$(m))) \
-  $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
-    $(addsuffix $(HOST_2ND_ARCH_MODULE_SUFFIX), \
-      $(subst $(comma),$(space),$(lastword $(p))))))) \
-  $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+$(call resolve-shared-libs-depes,HOST_,true)
 endif
 
 m :=
 r :=
 p :=
+deps :=
 add-required-deps :=
 
 # -------------------------------------------------------------------
@@ -669,6 +665,20 @@
 # Of the modules defined by the component makefiles,
 # determine what we actually want to build.
 
+###########################################################
+## Expand a module name list with REQUIRED modules
+###########################################################
+# $(1): The variable name that holds the initial module name list.
+#       the variable will be modified to hold the expanded results.
+# $(2): The initial module name list.
+# Returns empty string (maybe with some whitespaces).
+define expand-required-modules
+$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
+  $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
+$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
+  $(call expand-required-modules,$(1),$(_erm_new_modules)))
+endef
+
 ifdef FULL_BUILD
   # The base list of modules to build for this product is specified
   # by the appropriate product definition file, which was included
@@ -682,17 +692,14 @@
   modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
   modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
   modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
-  ifeq ($(TARGET_IS_64_BIT),true)
-    product_MODULES := $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX),$(modules_32))
-    product_MODULES += $(modules_64)
-    # For the rest we add both
-    product_MODULES += $(call get-32-bit-modules, $(modules_rest))
-    product_MODULES += $(modules_rest)
-  else
-    product_MODULES := $(modules_32) $(modules_64) $(modules_rest)
-  endif
+  product_MODULES := $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX),$(modules_32))
+  product_MODULES += $(modules_64)
+  # For the rest we add both
+  product_MODULES += $(call get-32-bit-modules, $(modules_rest))
+  product_MODULES += $(modules_rest)
 
   $(call expand-required-modules,product_MODULES,$(product_MODULES))
+
   product_FILES := $(call module-installed-files, $(product_MODULES))
   ifeq (0,1)
     $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
@@ -759,7 +766,7 @@
   # TODO: Should we do this for all builds and not just the sdk?
   dangling_modules :=
   $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \
-    $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
+    $(if $(strip $(ALL_MODULES.$(m).INSTALLED) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).INSTALLED)),,\
       $(eval dangling_modules += $(m))))
   ifneq ($(TARGET_IS_64_BIT),true)
     # We know those 64-bit modules don't exist in the 32-bit SDK build.
diff --git a/core/native_test.mk b/core/native_test.mk
index bc7f2e7..93b7e1a 100644
--- a/core/native_test.mk
+++ b/core/native_test.mk
@@ -5,6 +5,10 @@
 
 include $(BUILD_SYSTEM)/target_test_internal.mk
 
+ifndef LOCAL_MULTILIB
+ifndef LOCAL_32_BIT_ONLY
 LOCAL_MULTILIB := both
+endif
+endif
 
 include $(BUILD_EXECUTABLE)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 7229b3a..4bcd70a 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -92,7 +92,7 @@
 ifdef LOCAL_INSTALLED_MODULE
 ifdef LOCAL_SHARED_LIBRARIES
 $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
-  $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
+  $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
 
 # We also need the LOCAL_BUILT_MODULE dependency,
 # since we use -rpath-link which points to the built module's path.
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 6e18901..87d723c 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -38,20 +38,7 @@
 
 ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))
 
-_vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
-$(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules))
-
-# Expand the target modules installed via LOCAL_SHARED_LIBRARIES
-# $(1): the list of modules to expand.
-define expand-required-shared-libraries
-$(eval _ersl_new_modules := $(filter $(addsuffix :%,$(1)),$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES)))\
-$(eval _ersl_new_modules := $(foreach p,$(_ersl_new_modules),$(word 3,$(subst :,$(space),$(p)))))\
-$(eval _ersl_new_modules := $(sort $(subst $(comma),$(space),$(_ersl_new_modules))))\
-$(eval _ersl_new_modules := $(filter-out $(_vendor_check_modules),$(_ersl_new_modules)))\
-$(if $(_ersl_new_modules),$(eval _vendor_check_modules += $(_ersl_new_modules))\
-  $(call expand-required-shared-libraries,$(_ersl_new_modules)))
-endef
-$(call expand-required-shared-libraries,$(_vendor_check_modules))
+_vendor_check_modules := $(product_MODULES)
 
 _vendor_module_owner_info :=
 # Restrict owners
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index c383f87..1493bd9 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -23,7 +23,7 @@
 
 TARGET_2ND_ARCH := arm
 TARGET_2ND_ARCH_VARIANT := armv7-a-neon
-TARGET_2ND_CPU_VARIANT := generic
+TARGET_2ND_CPU_VARIANT := cortex-a15
 TARGET_2ND_CPU_ABI := armeabi-v7a
 TARGET_2ND_CPU_ABI2 := armeabi
 
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 9880cd2..cfac003 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -75,7 +75,8 @@
     seapp_contexts \
     property_contexts \
     mac_permissions.xml \
-    selinux_version
+    selinux_version \
+    service_contexts
 
 
 PRODUCT_COPY_FILES += \