Merge "Add a verbose option to RunCommand in build_image.py"
diff --git a/core/Makefile b/core/Makefile
index 305cf4e..095f149 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2134,6 +2134,7 @@
system/extras/verity/build_verity_metadata.py \
system/extras/ext4_utils/mke2fs.conf \
external/avb/test/data/testkey_rsa4096.pem \
+ $(shell find system/update_engine/scripts -name \*.pyc -prune -o -type f -print | sort) \
$(shell find build/target/product/security -type f -name \*.x509.pem -o -name \*.pk8 -o \
-name verity_key | sort) \
$(shell find device vendor -type f -name \*.pk8 -o -name verifiedboot\* -o \
@@ -2856,6 +2857,7 @@
$(COVERAGE_ZIP) \
$(INSTALLED_SYSTEMIMAGE) \
$(INSTALLED_QEMU_SYSTEMIMAGE) \
+ $(INSTALLED_QEMU_VENDORIMAGE) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_SDK_BUILD_PROP_TARGET) \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 07d1cd9..57ac23c 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -579,6 +579,9 @@
ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
$(strip $(ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED)\
$(my_required_modules))
+ALL_MODULES.$(my_register_name).TARGET_REQUIRED := \
+ $(strip $(ALL_MODULES.$(my_register_name).TARGET_REQUIRED)\
+ $(LOCAL_TARGET_REQUIRED_MODULES))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
ALL_MODULES.$(my_register_name).MAKEFILE := \
diff --git a/core/binary.mk b/core/binary.mk
index d8fda78..6a58c6c 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -290,6 +290,15 @@
# Move other ldlibs back to shared libraries
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
+else # LOCAL_IS_HOST_MODULE
+ # Add -ldl, -lpthread and -lrt to host builds to match the default behavior of
+ # device builds
+ ifneq ($($(my_prefix)OS),windows)
+ my_ldlibs += -ldl -lpthread
+ ifneq ($(HOST_OS),darwin)
+ my_ldlibs += -lrt
+ endif
+ endif
endif
ifneq ($(LOCAL_SDK_VERSION),)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 1fba952..c38059c 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -233,6 +233,7 @@
LOCAL_STATIC_LIBRARIES:=
LOCAL_STRIP_MODULE:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
+LOCAL_TARGET_REQUIRED_MODULES:=
LOCAL_TEST_DATA:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_TIDY:=
diff --git a/core/definitions.mk b/core/definitions.mk
index 15752f9..ffeb663 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2656,12 +2656,17 @@
# Add resources carried by static Jack libraries.
#
define add-carried-jack-resources
+$(call add-carried-jack-resources-to,$@)
+endef
+
+# $(1) the target jar.
+define add-carried-jack-resources-to
$(hide) if [ -d $(PRIVATE_JACK_INTERMEDIATES_DIR) ] ; then \
find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f | sort \
| sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C \"$(PRIVATE_JACK_INTERMEDIATES_DIR)\" \"?" -e "s/$$/\"/" \
- > $(dir $@)jack_res_jar_flags; \
- if [ -s $(dir $@)jack_res_jar_flags ] ; then \
- $(JAR) uf $@ @$(dir $@)jack_res_jar_flags; \
+ > $(dir $(1))jack_res_jar_flags; \
+ if [ -s $(dir $(1))jack_res_jar_flags ] ; then \
+ $(JAR) uf $(1) @$(dir $(1))jack_res_jar_flags; \
fi; \
fi
endef
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index aa11d15..9616036 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -105,7 +105,7 @@
my_boot_image_profile_location := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
ifeq (,$(my_boot_image_profile_location))
# If not set, use the default.
-my_boot_image_profile_location := frameworks/base/boot-image-profile.txt
+my_boot_image_profile_location := frameworks/base/config/boot-image-profile.txt
endif
# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index b22a98f..a06aaca 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -74,7 +74,7 @@
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
# Use dex2oat debug version for better error reporting
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_boot_image_profile_location)
@echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 949793b..f44b8a8 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -99,10 +99,15 @@
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
breakpad_input := $(relocation_packer_output)
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
-$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS)
+$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
@echo "target breakpad: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
- $(hide) $(BREAKPAD_DUMP_SYMS) -c $< > $@
+ $(hide) if $(PRIVATE_READELF) -S $< > /dev/null 2>&1 ; then \
+ $(BREAKPAD_DUMP_SYMS) -c $< > $@ ; \
+ else \
+ echo "skipped for non-elf file."; \
+ touch $@; \
+ fi
$(LOCAL_BUILT_MODULE) : $(breakpad_output)
endif
diff --git a/core/envsetup.mk b/core/envsetup.mk
index d8be9c3..db6ddd4 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -315,29 +315,17 @@
SOONG_OUT_DIR := $(OUT_DIR)/soong
-DEBUG_OUT_DIR := $(OUT_DIR)/debug
+TARGET_OUT_ROOT := $(OUT_DIR)/target
-# Move the host or target under the debug/ directory
-# if necessary.
-TARGET_OUT_ROOT_release := $(OUT_DIR)/target
-TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target
-TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE))
-
-HOST_OUT_ROOT_release := $(OUT_DIR)/host
-HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
-HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
+HOST_OUT_ROOT := $(OUT_DIR)/host
# We want to avoid two host bin directories in multilib build.
-HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
+HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
# TODO: remove
BUILD_OUT := $(HOST_OUT)
-HOST_CROSS_OUT_release := $(HOST_OUT_ROOT_release)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT_debug := $(HOST_OUT_ROOT_debug)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT := $(HOST_CROSS_OUT_$(HOST_BUILD_TYPE))
+HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index d436d03..241cf6e 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -211,7 +211,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_JACK_INCREMENTAL_DIR :=
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := -g $(LOCAL_JACK_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
diff --git a/core/java.mk b/core/java.mk
index 98df834..cc70368 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -801,7 +801,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
endif # LOCAL_PROGUARD_ENABLED defined
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(annotation_processor_flags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := -g $(LOCAL_JACK_FLAGS) $(annotation_processor_flags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
jack_all_deps := \
diff --git a/core/java_library.mk b/core/java_library.mk
index ea9874b..db4ccb5 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -83,13 +83,13 @@
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
ifdef LOCAL_JACK_ENABLED
- $(create-empty-package)
+ $(call create-empty-package-at,$@.tmp)
else
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@.tmp)
endif
$(call add-dex-to-package-arg,$@.tmp)
ifdef LOCAL_JACK_ENABLED
- $(add-carried-jack-resources)
+ $(call add-carried-jack-resources-to,$@.tmp)
endif
$(hide) $(ZIPTIME) $@.tmp
$(call commit-change-for-toc,$@)
diff --git a/core/main.mk b/core/main.mk
index 81bfae2..2c7a34b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -510,9 +510,10 @@
# If a module is for a cross host os, the required modules must be for
# that OS too.
# If a module is built for 32-bit, the required modules must be 32-bit too;
-# Otherwise if the module is an exectuable or shared library,
+# Otherwise if the module is an executable or shared library,
# the required modules must be 64-bit;
# otherwise we require both 64-bit and 32-bit variant, if one exists.
+define select-bitness-of-required-modules
$(foreach m,$(ALL_MODULES),\
$(eval r := $(ALL_MODULES.$(m).REQUIRED))\
$(if $(r),\
@@ -528,6 +529,8 @@
$(eval ALL_MODULES.$(m).REQUIRED := $(strip $(r_r)))\
)\
)
+endef
+$(call select-bitness-of-required-modules)
r_r :=
define add-required-deps
@@ -542,24 +545,68 @@
$(1): $(2)
endef
+# Sets up dependencies such that whenever a host module is installed,
+# any other host modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
+define add-all-host-to-host-required-modules-deps
+$(foreach m,$(ALL_MODULES), \
+ $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
+ $(if $(r), \
+ $(eval r := $(call module-installed-files,$(r))) \
+ $(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \
+ $(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \
+ $(eval h_m := $(filter-out $(h_r), $(h_m))) \
+ $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
+ $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
+ $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
+ ) \
+)
+endef
+$(call add-all-host-to-host-required-modules-deps)
+
+# Sets up dependencies such that whenever a target module is installed,
+# any other target modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
+define add-all-target-to-target-required-modules-deps
$(foreach m,$(ALL_MODULES), \
$(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
$(if $(r), \
$(eval r := $(call module-installed-files,$(r))) \
$(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
- $(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
- $(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
- $(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \
- $(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \
$(eval t_m := $(filter-out $(t_r), $(t_m))) \
- $(eval h_m := $(filter-out $(h_r), $(h_m))) \
- $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
$(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
- $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
- $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
- ) \
- )
+ ) \
+)
+endef
+$(call add-all-target-to-target-required-modules-deps)
+
+# Sets up dependencies such that whenever a host module is installed,
+# any target modules listed in $(ALL_MODULES.$(m).TARGET_REQUIRED) will also be installed
+define add-all-host-to-target-required-modules-deps
+$(foreach m,$(ALL_MODULES), \
+ $(eval req_mods := $(ALL_MODULES.$(m).TARGET_REQUIRED))\
+ $(if $(req_mods), \
+ $(eval req_files := )\
+ $(foreach req_mod,$(req_mods), \
+ $(eval req_file := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(req_mod)))) \
+ $(if $(strip $(req_file)),\
+ ,\
+ $(error $(m).LOCAL_TARGET_REQUIRED_MODULES : illegal value $(req_mod) : not a device module. If you want to specify host modules to be required to be installed along with your host module, add those module names to LOCAL_REQUIRED_MODULES instead)\
+ )\
+ $(eval req_files := $(req_files)$(space)$(req_file))\
+ )\
+ $(eval req_files := $(strip $(req_files)))\
+ $(eval mod_files := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(m)))) \
+ $(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
+ $(if $(mod_files),\
+ $(eval $(call add-required-deps, $(mod_files),$(req_files))) \
+ )\
+ )\
+)
+endef
+$(call add-all-host-to-target-required-modules-deps)
+
t_m :=
h_m :=
@@ -568,7 +615,7 @@
h_r :=
hc_r :=
-# Establish the dependecies on the shared libraries.
+# Establish the dependencies 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_ or HOST_CROSS_.
@@ -890,6 +937,8 @@
$(TARGET_OUT_DATA)/%, \
$(sort $(call get-tagged-modules,gnu)))
target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES))
+ target_gnu_MODULES := $(filter-out %/libopenjdkjvmti.so,$(target_gnu_MODULES))
+ target_gnu_MODULES := $(filter-out %/libopenjdkjvmtid.so,$(target_gnu_MODULES))
$(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
modules_to_install := \
$(filter-out $(target_gnu_MODULES),$(modules_to_install))
diff --git a/core/package_internal.mk b/core/package_internal.mk
index a626dde..11138db 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -122,7 +122,18 @@
endif
endif
-ifndef enforce_rro_enabled
+ifdef enforce_rro_enabled
+ ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
+ static_only_resource_overlays := $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(package_resource_overlays))
+ ifneq ($(static_only_resource_overlays),)
+ package_resource_overlays := $(filter-out $(static_only_resource_overlays),$(package_resource_overlays))
+ LOCAL_RESOURCE_DIR := $(static_only_resource_overlays) $(LOCAL_RESOURCE_DIR)
+ ifeq ($(package_resource_overlays),)
+ enforce_rro_enabled :=
+ endif
+ endif
+ endif
+else
LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
endif
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 8c986d6..bef183e 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -99,9 +99,6 @@
ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
PDK_FUSION_OUT_DIR := $(OUT_DIR)
-ifeq (debug,$(TARGET_BUILD_TYPE))
-PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR)
-endif
define JAVA_dependency_template
$(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
diff --git a/core/product.mk b/core/product.mk
index 1a0e8c6..95e3b27 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -94,6 +94,7 @@
PRODUCT_EXTRA_RECOVERY_KEYS \
PRODUCT_PACKAGE_OVERLAYS \
DEVICE_PACKAGE_OVERLAYS \
+ PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS \
PRODUCT_ENFORCE_RRO_TARGETS \
PRODUCT_SDK_ATREE_FILES \
PRODUCT_SDK_ADDON_NAME \
diff --git a/core/product_config.mk b/core/product_config.mk
index 4194e00..6ab40c0 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -434,6 +434,10 @@
PRODUCT_IOT := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_IOT))
+# Resource overlay list which must be excluded from enforcing RRO.
+PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS))
+
# Package list to apply enforcing RRO.
PRODUCT_ENFORCE_RRO_TARGETS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_RRO_TARGETS))
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
new file mode 100644
index 0000000..ee8b199
--- /dev/null
+++ b/core/soong_java_prebuilt.mk
@@ -0,0 +1,45 @@
+# Java prebuilt coming from Soong.
+# Extra inputs:
+# LOCAL_SOONG_HEADER_JAR
+# LOCAL_SOONG_DEX
+
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ $(call pretty-error,soong_java_prebuilt.mk may only be used from Soong)
+endif
+
+# TODO: device support
+ifndef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,exporting soong device jars to make not supported yet)
+endif
+
+LOCAL_MODULE_SUFFIX := .jar
+LOCAL_BUILT_MODULE_STEM := javalib.jar
+
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
+full_classes_jar := $(intermediates.COMMON)/classes.jar
+full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
+
+LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(LOCAL_PREBUILT_MODULE_FILE)
+
+#######################################
+include $(BUILD_SYSTEM)/jacoco.mk
+#######################################
+
+$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(LOCAL_BUILT_MODULE)))
+$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
+
+ifdef LOCAL_SOONG_HEADER_JAR
+$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
+else
+$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
+endif
+
+javac-check : $(full_classes_jar)
+javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
+
+# Built in equivalent to include $(CLEAR_VARS)
+LOCAL_SOONG_HEADER_JAR :=
+LOCAL_SOONG_DEX :=
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index e3bd47d..e26773c 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -64,6 +64,7 @@
# Files copied in the system-image directory
files_to_copy += \
$(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
+ $(addon_dir_img):$(INSTALLED_QEMU_VENDORIMAGE):images/$(TARGET_CPU_ABI)/vendor.img \
$(addon_dir_img):$(BUILT_USERDATAIMAGE_TARGET):images/$(TARGET_CPU_ABI)/userdata.img \
$(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \
$(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \
@@ -114,9 +115,10 @@
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
$(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI)
-$(full_target_img): $(full_target) $(addon_img_source_prop)
+$(full_target_img): $(full_target) $(addon_img_source_prop) | $(ACP)
@echo Packaging SDK Addon System-Image: $@
$(hide) mkdir -p $(dir $@)
+ $(ACP) -r $(PRODUCT_OUT)/data $(PRIVATE_STAGING_DIR)/data
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 6267031..8bb3ed0 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -39,6 +39,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
@@ -51,10 +52,16 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648 # 2 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+TARGET_COPY_OUT_VENDOR := vendor
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
-
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index e56a4d1..e18c165 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic/sepolicy/adbd.te b/target/board/generic/sepolicy/adbd.te
new file mode 100644
index 0000000..9546c1a
--- /dev/null
+++ b/target/board/generic/sepolicy/adbd.te
@@ -0,0 +1 @@
+set_prop(adbd, ctl_mdnsd_prop);
diff --git a/target/board/generic/sepolicy/audioserver.te b/target/board/generic/sepolicy/audioserver.te
new file mode 100644
index 0000000..c3c4a3a
--- /dev/null
+++ b/target/board/generic/sepolicy/audioserver.te
@@ -0,0 +1 @@
+allow audioserver bootanim:binder call;
diff --git a/target/board/generic/sepolicy/bootanim.te b/target/board/generic/sepolicy/bootanim.te
index b4b1eef..4be1c8a 100644
--- a/target/board/generic/sepolicy/bootanim.te
+++ b/target/board/generic/sepolicy/bootanim.te
@@ -1,4 +1,5 @@
allow bootanim self:process execmem;
allow bootanim ashmem_device:chr_file execute;
-
+#TODO: This can safely be ignored until b/62954877 is fixed
+dontaudit bootanim system_data_file:dir read;
set_prop(bootanim, qemu_prop)
diff --git a/target/board/generic/sepolicy/cameraserver.te b/target/board/generic/sepolicy/cameraserver.te
new file mode 100644
index 0000000..6cf5d6a
--- /dev/null
+++ b/target/board/generic/sepolicy/cameraserver.te
@@ -0,0 +1,2 @@
+allow cameraserver system_file:dir { open read };
+allow cameraserver hal_allocator:fd use;
diff --git a/target/board/generic/sepolicy/file.te b/target/board/generic/sepolicy/file.te
index 9227f80..f4ae9e4 100644
--- a/target/board/generic/sepolicy/file.te
+++ b/target/board/generic/sepolicy/file.te
@@ -1,2 +1 @@
-type qemud_socket, file_type;
type sysfs_writable, fs_type, sysfs_type, mlstrustedobject;
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
index e9502d9..f550f4d 100644
--- a/target/board/generic/sepolicy/file_contexts
+++ b/target/board/generic/sepolicy/file_contexts
@@ -7,14 +7,29 @@
/dev/block/vda u:object_r:system_block_device:s0
/dev/block/vdb u:object_r:cache_block_device:s0
/dev/block/vdc u:object_r:userdata_block_device:s0
+/dev/block/vdd u:object_r:metadata_block_device:s0
+/dev/block/vde u:object_r:system_block_device:s0
/dev/goldfish_pipe u:object_r:qemu_device:s0
/dev/goldfish_sync u:object_r:qemu_device:s0
/dev/qemu_.* u:object_r:qemu_device:s0
-/dev/socket/qemud u:object_r:qemud_socket:s0
/dev/ttyGF[0-9]* u:object_r:serial_device:s0
/dev/ttyS2 u:object_r:console_device:s0
-/system/bin/qemud u:object_r:qemud_exec:s0
/sys/qemu_trace(/.*)? u:object_r:sysfs_writable:s0
-/system/etc/init.goldfish.sh u:object_r:goldfish_setup_exec:s0
-/system/bin/qemu-props u:object_r:qemu_props_exec:s0
+/vendor/bin/init\.ranchu-core\.sh u:object_r:goldfish_setup_exec:s0
+/vendor/bin/init\.ranchu-net\.sh u:object_r:goldfish_setup_exec:s0
+/vendor/bin/qemu-props u:object_r:qemu_props_exec:s0
+
+/vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0
+
+/vendor/lib(64)?/hw/gralloc\.ranchu\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libEGL_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_CM_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libEGL_swiftshader\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_CM_swiftshader\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_swiftshader\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libOpenglSystemCommon\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/lib_renderControl_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_enc\.so u:object_r:same_process_hal_file:s0
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
index 78d20fc..bcd49bd 100644
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ b/target/board/generic/sepolicy/goldfish_setup.te
@@ -1,29 +1,12 @@
# goldfish-setup service: runs init.goldfish.sh script
type goldfish_setup, domain;
-type goldfish_setup_exec, exec_type, file_type;
+type goldfish_setup_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(goldfish_setup)
-# Inherit open file to shell (interpreter) for script.
-allow goldfish_setup shell_exec:file rx_file_perms;
-
-# Run ifconfig, route commands to configure interfaces and routes.
-allow goldfish_setup system_file:file execute_no_trans;
-allow goldfish_setup toolbox_exec:file rx_file_perms;
allow goldfish_setup self:capability { net_admin net_raw };
-allow goldfish_setup self:udp_socket create_socket_perms;
+allow goldfish_setup self:udp_socket { create ioctl };
+allow goldfish_setup vendor_toolbox_exec:file execute_no_trans;
allowxperm goldfish_setup self:udp_socket ioctl priv_sock_ioctls;
-
-wakelock_use(goldfish_setup)
-net_domain(goldfish_setup)
-
-# Set net.eth0.dns*, debug.sf.nobootanimation
-set_prop(goldfish_setup, system_prop)
-set_prop(goldfish_setup, debug_prop)
-
-# Set ro.radio.noril
-set_prop(goldfish_setup, radio_noril_prop)
-
-# Stop ril-daemon service (by setting ctl.stop to ril-daemon, which
-# transforms to a permission check on ctl.ril-daemon).
-set_prop(goldfish_setup, ctl_rildaemon_prop)
+wakelock_use(goldfish_setup);
+allow goldfish_setup vendor_shell_exec:file { rx_file_perms };
diff --git a/target/board/generic/sepolicy/hal_camera_default.te b/target/board/generic/sepolicy/hal_camera_default.te
new file mode 100644
index 0000000..eb88c36
--- /dev/null
+++ b/target/board/generic/sepolicy/hal_camera_default.te
@@ -0,0 +1,3 @@
+vndbinder_use(hal_camera_default);
+allow hal_camera_default hal_graphics_mapper_hwservice:hwservice_manager find;
+hal_client_domain(hal_camera_default, hal_graphics_composer)
diff --git a/target/board/generic/sepolicy/hal_drm_default.te b/target/board/generic/sepolicy/hal_drm_default.te
new file mode 100644
index 0000000..5a07433
--- /dev/null
+++ b/target/board/generic/sepolicy/hal_drm_default.te
@@ -0,0 +1,2 @@
+vndbinder_use(hal_drm_default);
+hal_client_domain(hal_drm_default, hal_graphics_composer)
diff --git a/target/board/generic/sepolicy/hal_drm_widevine.te b/target/board/generic/sepolicy/hal_drm_widevine.te
new file mode 100644
index 0000000..42d462a
--- /dev/null
+++ b/target/board/generic/sepolicy/hal_drm_widevine.te
@@ -0,0 +1,12 @@
+# define SELinux domain
+type hal_drm_widevine, domain;
+hal_server_domain(hal_drm_widevine, hal_drm)
+
+type hal_drm_widevine_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(hal_drm_widevine)
+
+allow hal_drm mediacodec:fd use;
+allow hal_drm { appdomain -isolated_app }:fd use;
+
+vndbinder_use(hal_drm_widevine);
+hal_client_domain(hal_drm_widevine, hal_graphics_composer);
diff --git a/target/board/generic/sepolicy/hal_gnss_default.te b/target/board/generic/sepolicy/hal_gnss_default.te
new file mode 100644
index 0000000..ddc68cc
--- /dev/null
+++ b/target/board/generic/sepolicy/hal_gnss_default.te
@@ -0,0 +1 @@
+vndbinder_use(hal_gnss_default);
diff --git a/target/board/generic/sepolicy/hal_graphics_composer_default.te b/target/board/generic/sepolicy/hal_graphics_composer_default.te
new file mode 100644
index 0000000..40ecda6
--- /dev/null
+++ b/target/board/generic/sepolicy/hal_graphics_composer_default.te
@@ -0,0 +1 @@
+vndbinder_use(hal_graphics_composer_default);
diff --git a/target/board/generic/sepolicy/init.te b/target/board/generic/sepolicy/init.te
index 3aa81d1..84a4e8d 100644
--- a/target/board/generic/sepolicy/init.te
+++ b/target/board/generic/sepolicy/init.te
@@ -1 +1,2 @@
allow init tmpfs:lnk_file create_file_perms;
+dontaudit init kernel:system module_request;
diff --git a/target/board/generic/sepolicy/mediacodec.te b/target/board/generic/sepolicy/mediacodec.te
new file mode 100644
index 0000000..acf4e59
--- /dev/null
+++ b/target/board/generic/sepolicy/mediacodec.te
@@ -0,0 +1 @@
+allow mediacodec system_file:dir { open read };
diff --git a/target/board/generic/sepolicy/netd.te b/target/board/generic/sepolicy/netd.te
index 2b002ec..09a28b9 100644
--- a/target/board/generic/sepolicy/netd.te
+++ b/target/board/generic/sepolicy/netd.te
@@ -1 +1,3 @@
dontaudit netd self:capability sys_module;
+#TODO: This can safely be ignored until b/62954877 is fixed
+dontaudit netd kernel:system module_request;
diff --git a/target/board/generic/sepolicy/priv_app.te b/target/board/generic/sepolicy/priv_app.te
new file mode 100644
index 0000000..3d16f32
--- /dev/null
+++ b/target/board/generic/sepolicy/priv_app.te
@@ -0,0 +1,5 @@
+#TODO: b/62908025
+dontaudit priv_app firstboot_prop:file { getattr open };
+dontaudit priv_app device:dir { open read };
+dontaudit priv_app proc_interrupts:file { getattr open read };
+dontaudit priv_app proc_modules:file { getattr open read };
diff --git a/target/board/generic/sepolicy/qemu_props.te b/target/board/generic/sepolicy/qemu_props.te
index d5571fd..0f5ec8c 100644
--- a/target/board/generic/sepolicy/qemu_props.te
+++ b/target/board/generic/sepolicy/qemu_props.te
@@ -1,12 +1,9 @@
# qemu-props service: Sets system properties on boot.
type qemu_props, domain;
-type qemu_props_exec, exec_type, file_type;
+type qemu_props_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(qemu_props)
-# Set properties.
set_prop(qemu_props, qemu_prop)
set_prop(qemu_props, dalvik_prop)
-set_prop(qemu_props, config_prop)
-set_prop(qemu_props, opengles_prop)
set_prop(qemu_props, qemu_cmdline)
diff --git a/target/board/generic/sepolicy/qemud.te b/target/board/generic/sepolicy/qemud.te
deleted file mode 100644
index eee21c4..0000000
--- a/target/board/generic/sepolicy/qemud.te
+++ /dev/null
@@ -1,8 +0,0 @@
-# qemu support daemon
-type qemud, domain;
-type qemud_exec, exec_type, file_type;
-
-init_daemon_domain(qemud)
-
-# Access /dev/ttyS1 and /dev/ttyGF1.
-allow qemud serial_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/rild.te b/target/board/generic/sepolicy/rild.te
deleted file mode 100644
index e148b6c..0000000
--- a/target/board/generic/sepolicy/rild.te
+++ /dev/null
@@ -1 +0,0 @@
-unix_socket_connect(rild, qemud, qemud)
diff --git a/target/board/generic/sepolicy/system_server.te b/target/board/generic/sepolicy/system_server.te
index f9e277b..9063095 100644
--- a/target/board/generic/sepolicy/system_server.te
+++ b/target/board/generic/sepolicy/system_server.te
@@ -1,3 +1,2 @@
-unix_socket_connect(system_server, qemud, qemud)
get_prop(system_server, opengles_prop)
get_prop(system_server, radio_noril_prop)
diff --git a/target/board/generic/sepolicy/vold.te b/target/board/generic/sepolicy/vold.te
new file mode 100644
index 0000000..5f3bdd4
--- /dev/null
+++ b/target/board/generic/sepolicy/vold.te
@@ -0,0 +1 @@
+dontaudit vold kernel:system module_request;
diff --git a/target/board/generic/sepolicy/zygote.te b/target/board/generic/sepolicy/zygote.te
index a90f02b..e97d895 100644
--- a/target/board/generic/sepolicy/zygote.te
+++ b/target/board/generic/sepolicy/zygote.te
@@ -1 +1,4 @@
set_prop(zygote, qemu_prop)
+# TODO (b/63631799) fix this access
+# Suppress denials to storage. Webview zygote should not be accessing.
+dontaudit webview_zygote mnt_expand_file:dir getattr;
diff --git a/target/board/generic/system.prop b/target/board/generic/system.prop
index f2424c9..ad8e5b8 100644
--- a/target/board/generic/system.prop
+++ b/target/board/generic/system.prop
@@ -2,5 +2,4 @@
# system.prop for generic sdk
#
-rild.libpath=/system/lib/libreference-ril.so
-rild.libargs=-d /dev/ttyS0
+rild.libpath=/vendor/lib/libreference-ril.so
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index e6d741a..2feba6b 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -70,6 +70,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
@@ -82,9 +83,16 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2.5 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+TARGET_COPY_OUT_VENDOR := vendor
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk
index 9647a4e..ca287eb 100644
--- a/target/board/generic_arm64/device.mk
+++ b/target/board/generic_arm64/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic_arm64/system.prop b/target/board/generic_arm64/system.prop
index 24578a9..5b0183a 100644
--- a/target/board/generic_arm64/system.prop
+++ b/target/board/generic_arm64/system.prop
@@ -2,5 +2,4 @@
# system.prop for generic arm64 sdk
#
-rild.libpath=/system/lib64/libreference-ril.so
-rild.libargs=-d /dev/ttyS0
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index be98998..a9e46b4 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -47,6 +47,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
@@ -59,9 +60,15 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648 # 2 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 734003200
+TARGET_COPY_OUT_VENDOR := vendor
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
diff --git a/target/board/generic_mips/device.mk b/target/board/generic_mips/device.mk
index 06a7d8a..a2633e1 100644
--- a/target/board/generic_mips/device.mk
+++ b/target/board/generic_mips/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index 7f35c8b..6cb6c11 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -62,6 +62,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
@@ -74,10 +75,16 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1879048192 # 1.75 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 1610612736 # 1.5 GB, lots of space for running tests
+TARGET_COPY_OUT_VENDOR := vendor
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
diff --git a/target/board/generic_mips64/device.mk b/target/board/generic_mips64/device.mk
index 66ec9db..2ccbcbd 100644
--- a/target/board/generic_mips64/device.mk
+++ b/target/board/generic_mips64/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic_mips64/system.prop b/target/board/generic_mips64/system.prop
index aa03eae..4da69c0 100644
--- a/target/board/generic_mips64/system.prop
+++ b/target/board/generic_mips64/system.prop
@@ -2,5 +2,5 @@
# system.prop for generic mips64 sdk
#
-rild.libpath=/system/lib64/libreference-ril.so
+rild.libpath=/vendor/lib64/libreference-ril.so
rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index fef2304..bb2166b 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -26,6 +26,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
@@ -39,12 +40,19 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+TARGET_COPY_OUT_VENDOR := vendor
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
build/target/board/generic/sepolicy \
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index b5b0faf..24c39a5 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic_x86/system.prop b/target/board/generic_x86/system.prop
index 137a0f9..64829f3 100644
--- a/target/board/generic_x86/system.prop
+++ b/target/board/generic_x86/system.prop
@@ -2,5 +2,4 @@
# system.prop for generic sdk
#
-rild.libpath=/system/lib/libreference-ril.so
-rild.libargs=-d /dev/ttyS0
+rild.libpath=/vendor/lib/libreference-ril.so
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 6e16f35..b49a10c 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -32,6 +32,7 @@
endif
TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
@@ -44,10 +45,17 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2.5 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+TARGET_COPY_OUT_VENDOR := vendor
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
build/target/board/generic/sepolicy \
diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk
index b5b0faf..24c39a5 100755
--- a/target/board/generic_x86_64/device.mk
+++ b/target/board/generic_x86_64/device.mk
@@ -19,8 +19,7 @@
PRODUCT_PROPERTY_OVERRIDES := \
ro.ril.hsxpa=1 \
- ro.ril.gprsclass=10 \
- ro.adb.qemud=1
+ ro.ril.gprsclass=10
PRODUCT_COPY_FILES := \
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
diff --git a/target/board/generic_x86_64/system.prop b/target/board/generic_x86_64/system.prop
index 43d4a88..ed9d173 100644
--- a/target/board/generic_x86_64/system.prop
+++ b/target/board/generic_x86_64/system.prop
@@ -2,5 +2,4 @@
# system.prop for generic sdk
#
-rild.libpath=/system/lib64/libreference-ril.so
-rild.libargs=-d /dev/ttyS0
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 781cae6..9ed5284 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -1,5 +1,5 @@
#
-# Copyright 2013 The Android Open-Source Project
+# Copyright 2017 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.
@@ -13,6 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib/libreference-ril.so
+
+# Note: the following lines need to stay at the beginning so that it can
+# take priority and override the rules it inherit from other mk files
+# see copy file rules in core/Makefile
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
+ prebuilts/qemu-kernel/arm/3.18/kernel-qemu2:kernel-ranchu \
+ device/generic/goldfish/fstab.ranchu.arm:root/fstab.ranchu \
+ device/generic/goldfish/fstab.ranchu.early.arm:root/fstab.ranchu.early
+
include $(SRC_TARGET_DIR)/product/full.mk
PRODUCT_NAME := aosp_arm
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 98afe5f..18d613b 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2013 The Android Open-Source Project
+# Copyright (C) 2017 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.
@@ -14,14 +14,22 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib64/libreference-ril.so
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
-# This is for enabling ethernet support for ranchu.
-# Consider removing this after RIL support is provided in ranchu.
-PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
+# Note: the following lines need to stay at the beginning so that it can
+# take priority and override the rules it inherit from other mk files
+# see copy file rules in core/Makefile
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
+ prebuilts/qemu-kernel/arm64/3.18/kernel-qemu2:kernel-ranchu \
+ device/generic/goldfish/fstab.ranchu.arm:root/fstab.ranchu \
+ device/generic/goldfish/fstab.ranchu.early.arm:root/fstab.ranchu.early
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index cba43c4..03203ce 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -13,6 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib/libreference-ril.so
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
+ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
+ prebuilts/qemu-kernel/x86/3.18/kernel-qemu2:kernel-ranchu
+
include $(SRC_TARGET_DIR)/product/full_x86.mk
PRODUCT_NAME := aosp_x86
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 4006346..693bdaf 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -14,18 +14,18 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib64/libreference-ril.so
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
-# If running on an emulator or some other device that has a LAN connection
-# that isn't a wifi connection. This will instruct init.rc to enable the
-# network connection so that you can use it with ADB
-
-# This is for enabling ethernet support for ranchu.
-# Consider removing this after RIL support is provided in ranchu.
-PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
+ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
+ prebuilts/qemu-kernel/x86_64/3.18/kernel-qemu2:kernel-ranchu
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 04aae58..00b3533 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -36,11 +36,13 @@
libGLESv2_emulation \
libGLESv1_enc \
qemu-props \
- qemud \
camera.goldfish \
camera.goldfish.jpeg \
camera.ranchu \
camera.ranchu.jpeg \
+ keystore.goldfish \
+ keystore.ranchu \
+ gatekeeper.ranchu \
lights.goldfish \
gps.goldfish \
gps.ranchu \
@@ -56,8 +58,16 @@
android.hardware.biometrics.fingerprint@2.1-service \
sensors.ranchu \
android.hardware.graphics.composer@2.1-impl \
- hwcomposer.goldfish \
- hwcomposer.ranchu \
+ android.hardware.graphics.composer@2.1-service \
+ android.hardware.graphics.allocator@2.0-service \
+ android.hardware.graphics.allocator@2.0-impl \
+ android.hardware.graphics.mapper@2.0-impl \
+ hwcomposer.goldfish \
+ hwcomposer.ranchu \
+ sh_vendor \
+ vintf \
+ toybox_vendor \
+ CarrierConfig
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-impl \
@@ -66,36 +76,79 @@
android.hardware.soundtrigger@2.0-impl
PRODUCT_PACKAGES += \
- android.hardware.keymaster@3.0-impl \
- android.hardware.keymaster@3.0-service
+ android.hardware.keymaster@3.0-impl \
+ android.hardware.keymaster@3.0-service
PRODUCT_PACKAGES += \
android.hardware.gnss@1.0-service \
android.hardware.gnss@1.0-impl
PRODUCT_PACKAGES += \
- android.hardware.sensors@1.0-impl \
- android.hardware.sensors@1.0-service
+ android.hardware.sensors@1.0-impl \
+ android.hardware.sensors@1.0-service
+
+PRODUCT_PACKAGES += \
+ android.hardware.drm@1.0-service \
+ android.hardware.drm@1.0-impl
PRODUCT_PACKAGES += \
android.hardware.power@1.0-service \
android.hardware.power@1.0-impl
-# camera service treble disable until all backwards compat is complete
-PRODUCT_PROPERTY_OVERRIDES += \
- camera.disable_treble=1
+PRODUCT_PACKAGES += \
+ camera.device@1.0-impl \
+ android.hardware.camera.provider@2.4-service \
+ android.hardware.camera.provider@2.4-impl \
+
+PRODUCT_PACKAGES += \
+ android.hardware.gatekeeper@1.0-impl \
+ android.hardware.gatekeeper@1.0-service
+
+# need this for gles libraries to load properly
+# after moving to /vendor/lib/
+PRODUCT_PACKAGES += \
+ android.hardware.renderscript@1.0.vndk-sp\
+ android.hardware.graphics.allocator@2.0.vndk-sp\
+ android.hardware.graphics.mapper@2.0.vndk-sp\
+ android.hardware.graphics.common@1.0.vndk-sp\
+ libhwbinder.vndk-sp\
+ libbase.vndk-sp\
+ libcutils.vndk-sp\
+ libhardware.vndk-sp\
+ libhidlbase.vndk-sp\
+ libhidltransport.vndk-sp\
+ libutils.vndk-sp\
+ libc++.vndk-sp\
+ libRS_internal.vndk-sp\
+ libRSDriver.vndk-sp\
+ libRSCpuRef.vndk-sp\
+ libbcinfo.vndk-sp\
+ libblas.vndk-sp\
+ libft2.vndk-sp\
+ libpng.vndk-sp\
+ libcompiler_rt.vndk-sp\
+ libbacktrace.vndk-sp\
+ libunwind.vndk-sp\
+ libunwindstack.vndk-sp\
+ liblzma.vndk-sp\
+ libz.vndk-sp\
+
PRODUCT_COPY_FILES += \
- device/generic/goldfish/fstab.goldfish:root/fstab.goldfish \
- device/generic/goldfish/init.goldfish.rc:root/init.goldfish.rc \
- device/generic/goldfish/init.goldfish.sh:system/etc/init.goldfish.sh \
- device/generic/goldfish/ueventd.goldfish.rc:root/ueventd.goldfish.rc \
+ device/generic/goldfish/init.ranchu-core.sh:vendor/bin/init.ranchu-core.sh \
+ device/generic/goldfish/init.ranchu-net.sh:vendor/bin/init.ranchu-net.sh \
device/generic/goldfish/init.ranchu.rc:root/init.ranchu.rc \
device/generic/goldfish/fstab.ranchu:root/fstab.ranchu \
+ device/generic/goldfish/fstab.ranchu.early:root/fstab.ranchu.early \
device/generic/goldfish/ueventd.ranchu.rc:root/ueventd.ranchu.rc \
device/generic/goldfish/input/goldfish_rotary.idc:system/usr/idc/goldfish_rotary.idc \
+ device/generic/goldfish/manifest.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml \
+ device/generic/goldfish/data/etc/permissions/privapp-permissions-goldfish.xml:system/etc/permissions/privapp-permissions-goldfish.xml \
+ device/generic/goldfish/data/etc/config.ini:config.ini \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml
PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay
PRODUCT_CHARACTERISTICS := emulator
+
+PRODUCT_FULL_TREBLE_OVERRIDE := true
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 24eeff9..50b90ac 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -61,12 +61,14 @@
dalvik.vm.image-dex2oat-Xmx=64m \
dalvik.vm.dex2oat-Xms=64m \
dalvik.vm.dex2oat-Xmx=512m \
- ro.dalvik.vm.native.bridge=0 \
dalvik.vm.usejit=true \
dalvik.vm.usejitprofiles=true \
dalvik.vm.dexopt.secondary=true \
dalvik.vm.appimageformat=lz4
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.dalvik.vm.native.bridge=0
+
# Different dexopt types for different package update/install times.
# On eng builds, make "boot" reasons only extract for faster turnaround.
ifeq (eng,$(TARGET_BUILD_VARIANT))
diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk
index 0cdb05d..93356d6 100644
--- a/target/product/sdk_base.mk
+++ b/target/product/sdk_base.mk
@@ -24,11 +24,10 @@
Development \
Dialer \
EmulatorSmokeTests \
- Fallback \
Gallery2 \
GestureBuilder \
Launcher3 \
- LegacyCamera \
+ Camera2 \
librs_jni \
libwnndict \
libWnnEngDic \
@@ -101,6 +100,7 @@
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \
frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml \
+ frameworks/native/data/etc/android.software.autofill.xml:system/etc/permissions/android.software.autofill.xml \
frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf \
device/generic/goldfish/audio_policy.conf:system/etc/audio_policy.conf
diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk
index a689475..2aa688b 100644
--- a/target/product/sdk_phone_arm64.mk
+++ b/target/product/sdk_phone_arm64.mk
@@ -14,11 +14,23 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib64/libreference-ril.so
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+# Note: the following lines need to stay at the beginning so that it can
+# take priority and override the rules it inherit from other mk files
+# see copy file rules in core/Makefile
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
+ prebuilts/qemu-kernel/arm64/3.18/kernel-qemu2:kernel-ranchu \
+ device/generic/goldfish/fstab.ranchu.arm:root/fstab.ranchu \
+ device/generic/goldfish/fstab.ranchu.early.arm:root/fstab.ranchu.early
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
@@ -34,3 +46,5 @@
PRODUCT_NAME := sdk_phone_arm64
PRODUCT_DEVICE := generic_arm64
PRODUCT_MODEL := Android SDK built for arm64
+
+
diff --git a/target/product/sdk_phone_armv7.mk b/target/product/sdk_phone_armv7.mk
index ebdd0e7..e99f0f5 100644
--- a/target/product/sdk_phone_armv7.mk
+++ b/target/product/sdk_phone_armv7.mk
@@ -14,6 +14,18 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib/libreference-ril.so
+
+# Note: the following lines need to stay at the beginning so that it can
+# take priority and override the rules it inherit from other mk files
+# see copy file rules in core/Makefile
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
+ prebuilts/qemu-kernel/arm/3.18/kernel-qemu2:kernel-ranchu \
+ device/generic/goldfish/fstab.ranchu.arm:root/fstab.ranchu \
+ device/generic/goldfish/fstab.ranchu.early.arm:root/fstab.ranchu.early
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
# AOSP emulator images build the AOSP messaging app.
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index 01c2e83..1e82773 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -14,10 +14,17 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib/libreference-ril.so
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
+ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
+ prebuilts/qemu-kernel/x86/3.18/kernel-qemu2:kernel-ranchu
$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index c3bc5e9..a18c4f8 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -14,11 +14,19 @@
# limitations under the License.
#
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/vendor/lib64/libreference-ril.so
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+PRODUCT_COPY_FILES += \
+ development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
+ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
+ prebuilts/qemu-kernel/x86_64/3.18/kernel-qemu2:kernel-ranchu
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
diff --git a/tools/atree/Android.bp b/tools/atree/Android.bp
new file mode 100644
index 0000000..3c3a8ef
--- /dev/null
+++ b/tools/atree/Android.bp
@@ -0,0 +1,13 @@
+// Copyright 2007 The Android Open Source Project
+//
+// Copies files into the directory structure described by a manifest
+
+cc_binary_host {
+ name: "atree",
+ srcs: [
+ "atree.cpp",
+ "files.cpp",
+ "fs.cpp",
+ ],
+ static_libs: ["libhost"],
+}
diff --git a/tools/atree/Android.mk b/tools/atree/Android.mk
deleted file mode 100644
index f598db5..0000000
--- a/tools/atree/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2007 The Android Open Source Project
-#
-# Copies files into the directory structure described by a manifest
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- atree.cpp \
- files.cpp \
- fs.cpp
-
-LOCAL_STATIC_LIBRARIES := \
- libhost
-
-LOCAL_MODULE := atree
-
-include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/tools/checkowners.py b/tools/checkowners.py
index b874955..1190d30 100755
--- a/tools/checkowners.py
+++ b/tools/checkowners.py
@@ -34,8 +34,8 @@
+ urllib.quote(address))
echo('Checking email address: ' + address)
result = urllib2.urlopen(request).read()
- expected = '"email": "' + address + '"'
- checked_addresses[address] = (result.find(expected) >= 0)
+ checked_addresses[address] = (
+ result.find('"email":') >= 0 and result.find('"_account_id":') >= 0)
return checked_addresses[address]
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
new file mode 100644
index 0000000..797cfe2
--- /dev/null
+++ b/tools/fs_config/Android.bp
@@ -0,0 +1,63 @@
+// Copyright (C) 2008 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.
+
+cc_binary_host {
+ name: "fs_config",
+ srcs: ["fs_config.c"],
+ shared_libs: [
+ "libcutils",
+ "libselinux",
+ ],
+ cflags: ["-Werror"],
+}
+
+// -----------------------------------------------------------------------------
+// Unit tests.
+// -----------------------------------------------------------------------------
+
+test_c_flags = [
+ "-fstack-protector-all",
+ "-g",
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-fno-builtin",
+ "-DANDROID_FILESYSTEM_CONFIG=\"android_filesystem_config_test_data.h\"",
+]
+
+//#################################
+// test executable
+cc_test_host {
+ name: "fs_config_generate_test",
+ srcs: ["fs_config_generate.c"],
+ shared_libs: ["libcutils"],
+ cflags: test_c_flags,
+ relative_install_path: "fs_config-unit-tests",
+ no_named_install_directory: true,
+ gtest: false,
+
+}
+
+//#################################
+// gTest tool
+cc_test_host {
+ name: "fs_config-unit-tests",
+ cflags: test_c_flags + ["-DHOST"],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libbase",
+ ],
+ srcs: ["fs_config_test.cpp"],
+}
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index ab7f92d..3773d38 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -14,15 +14,6 @@
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := fs_config.c
-LOCAL_MODULE := fs_config
-LOCAL_SHARED_LIBRARIES := libcutils libselinux
-LOCAL_CFLAGS := -Werror
-
-include $(BUILD_HOST_EXECUTABLE)
-
# One can override the default android_filesystem_config.h file in one of two ways:
#
# 1. The old way:
@@ -306,36 +297,3 @@
fs_config_generate_bin :=
my_gen_oem_aid :=
fs_config_generate_extra_partition_list :=
-
-# -----------------------------------------------------------------------------
-# Unit tests.
-# -----------------------------------------------------------------------------
-
-test_c_flags := \
- -fstack-protector-all \
- -g \
- -Wall \
- -Wextra \
- -Werror \
- -fno-builtin \
- -DANDROID_FILESYSTEM_CONFIG='"android_filesystem_config_test_data.h"'
-
-##################################
-# test executable
-include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config_generate_test
-LOCAL_SRC_FILES := fs_config_generate.c
-LOCAL_SHARED_LIBRARIES := libcutils
-LOCAL_CFLAGS := $(test_c_flags)
-LOCAL_MODULE_RELATIVE_PATH := fs_config-unit-tests
-LOCAL_GTEST := false
-include $(BUILD_HOST_NATIVE_TEST)
-
-##################################
-# gTest tool
-include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config-unit-tests
-LOCAL_CFLAGS += $(test_c_flags) -DHOST
-LOCAL_SHARED_LIBRARIES := liblog libcutils libbase
-LOCAL_SRC_FILES := fs_config_test.cpp
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tools/fs_get_stats/Android.bp b/tools/fs_get_stats/Android.bp
new file mode 100644
index 0000000..6684319
--- /dev/null
+++ b/tools/fs_get_stats/Android.bp
@@ -0,0 +1,8 @@
+cc_binary_host {
+ name: "fs_get_stats",
+ srcs: ["fs_get_stats.c"],
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ ],
+}
diff --git a/tools/fs_get_stats/Android.mk b/tools/fs_get_stats/Android.mk
deleted file mode 100644
index 4501c1f..0000000
--- a/tools/fs_get_stats/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := fs_get_stats.c
-
-LOCAL_MODULE := fs_get_stats
-
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/releasetools/check_ota_package_signature.py b/tools/releasetools/check_ota_package_signature.py
index 548b619..1f8b7bb 100755
--- a/tools/releasetools/check_ota_package_signature.py
+++ b/tools/releasetools/check_ota_package_signature.py
@@ -25,12 +25,19 @@
import re
import subprocess
import sys
+import tempfile
+import zipfile
from hashlib import sha1
from hashlib import sha256
+# 'update_payload' package is under 'system/update_engine/scripts/', which
+# should to be included in PYTHONPATH.
+from update_payload.payload import Payload
+from update_payload.update_metadata_pb2 import Signatures
-def cert_uses_sha256(cert):
+
+def CertUsesSha256(cert):
"""Check if the cert uses SHA-256 hashing algorithm."""
cmd = ['openssl', 'x509', '-text', '-noout', '-in', cert]
@@ -46,7 +53,7 @@
return algorithm.group(1).startswith('sha256')
-def verify_package(cert, package):
+def VerifyPackage(cert, package):
"""Verify the given package with the certificate.
(Comments from bootable/recovery/verifier.cpp:)
@@ -90,7 +97,7 @@
print('Signed data length: %d' % (signed_len,))
print('Signature start: %d' % (signature_start,))
- use_sha256 = cert_uses_sha256(cert)
+ use_sha256 = CertUsesSha256(cert)
print('Use SHA-256: %s' % (use_sha256,))
if use_sha256:
@@ -100,7 +107,7 @@
h.update(package_bytes[:signed_len])
package_digest = h.hexdigest().lower()
- print('Digest: %s\n' % (package_digest,))
+ print('Digest: %s' % (package_digest,))
# Get the signature from the input package.
signature = package_bytes[signature_start:-6]
@@ -141,7 +148,87 @@
assert package_digest == digest_string, "Verification failed."
# Verified successfully upon reaching here.
- print('VERIFIED\n')
+ print('\nWhole package signature VERIFIED\n')
+
+
+def VerifyAbOtaPayload(cert, package):
+ """Verifies the payload and metadata signatures in an A/B OTA payload."""
+
+ def VerifySignatureBlob(hash_file, blob):
+ """Verifies the input hash_file against the signature blob."""
+ signatures = Signatures()
+ signatures.ParseFromString(blob)
+
+ extracted_sig_file = common.MakeTempFile(
+ prefix='extracted-sig-', suffix='.bin')
+ # In Android, we only expect one signature.
+ assert len(signatures.signatures) == 1, \
+ 'Invalid number of signatures: %d' % len(signatures.signatures)
+ signature = signatures.signatures[0]
+ length = len(signature.data)
+ assert length == 256, 'Invalid signature length %d' % (length,)
+ with open(extracted_sig_file, 'w') as f:
+ f.write(signature.data)
+
+ # Verify the signature file extracted from the payload, by reversing the
+ # signing operation. Alternatively, this can be done by calling 'openssl
+ # rsautl -verify -certin -inkey <cert.pem> -in <extracted_sig_file> -out
+ # <output>', then to assert that
+ # <output> == SHA-256 DigestInfo prefix || <hash_file>.
+ cmd = ['openssl', 'pkeyutl', '-verify', '-certin', '-inkey', cert,
+ '-pkeyopt', 'digest:sha256', '-in', hash_file,
+ '-sigfile', extracted_sig_file]
+ p = common.Run(cmd, stdout=subprocess.PIPE)
+ result, _ = p.communicate()
+
+ # https://github.com/openssl/openssl/pull/3213
+ # 'openssl pkeyutl -verify' (prior to 1.1.0) returns non-zero return code,
+ # even on successful verification. To avoid the false alarm with older
+ # openssl, check the output directly.
+ assert result.strip() == 'Signature Verified Successfully', result.strip()
+
+ package_zip = zipfile.ZipFile(package, 'r')
+ if 'payload.bin' not in package_zip.namelist():
+ common.ZipClose(package_zip)
+ return
+
+ print('Verifying A/B OTA payload signatures...')
+
+ package_dir = tempfile.mkdtemp(prefix='package-')
+ common.OPTIONS.tempfiles.append(package_dir)
+
+ payload_file = package_zip.extract('payload.bin', package_dir)
+ payload = Payload(open(payload_file, 'rb'))
+ payload.Init()
+
+ # Extract the payload hash and metadata hash from the payload.bin.
+ payload_hash_file = common.MakeTempFile(prefix='hash-', suffix='.bin')
+ metadata_hash_file = common.MakeTempFile(prefix='hash-', suffix='.bin')
+ cmd = ['brillo_update_payload', 'hash',
+ '--unsigned_payload', payload_file,
+ '--signature_size', '256',
+ '--metadata_hash_file', metadata_hash_file,
+ '--payload_hash_file', payload_hash_file]
+ p = common.Run(cmd, stdout=subprocess.PIPE)
+ p.communicate()
+ assert p.returncode == 0, 'brillo_update_payload hash failed'
+
+ # Payload signature verification.
+ assert payload.manifest.HasField('signatures_offset')
+ payload_signature = payload.ReadDataBlob(
+ payload.manifest.signatures_offset, payload.manifest.signatures_size)
+ VerifySignatureBlob(payload_hash_file, payload_signature)
+
+ # Metadata signature verification.
+ metadata_signature = payload.ReadDataBlob(
+ -payload.header.metadata_signature_len,
+ payload.header.metadata_signature_len)
+ VerifySignatureBlob(metadata_hash_file, metadata_signature)
+
+ common.ZipClose(package_zip)
+
+ # Verified successfully upon reaching here.
+ print('\nPayload signatures VERIFIED\n\n')
def main():
@@ -150,7 +237,8 @@
parser.add_argument('package', help='The OTA package to be verified.')
args = parser.parse_args()
- verify_package(args.certificate, args.package)
+ VerifyPackage(args.certificate, args.package)
+ VerifyAbOtaPayload(args.certificate, args.package)
if __name__ == '__main__':
@@ -159,3 +247,5 @@
except AssertionError as err:
print('\n ERROR: %s\n' % (err,))
sys.exit(1)
+ finally:
+ common.Cleanup()
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 8ac3322..4b34820 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -44,8 +44,8 @@
return sparse_img.SparseImage(path, mappath, clobbered_blocks)
-def _CalculateFileSha1(file_name, unpacked_name, round_up=False):
- """Calculate the SHA-1 for a given file. Round up its size to 4K if needed."""
+def _ReadFile(file_name, unpacked_name, round_up=False):
+ """Constructs and returns a File object. Rounds up its size if needed."""
def RoundUpTo4K(value):
rounded_up = value + 4095
@@ -58,7 +58,7 @@
if round_up:
file_size_rounded_up = RoundUpTo4K(file_size)
file_data += '\0' * (file_size_rounded_up - file_size)
- return common.File(file_name, file_data).sha1
+ return common.File(file_name, file_data)
def ValidateFileAgainstSha1(input_tmp, file_name, file_path, expected_sha1):
@@ -67,7 +67,7 @@
logging.info('Validating the SHA-1 of {}'.format(file_name))
unpacked_name = os.path.join(input_tmp, file_path)
assert os.path.exists(unpacked_name)
- actual_sha1 = _CalculateFileSha1(file_name, unpacked_name, False)
+ actual_sha1 = _ReadFile(file_name, unpacked_name, False).sha1
assert actual_sha1 == expected_sha1, \
'SHA-1 mismatches for {}. actual {}, expected {}'.format(
file_name, actual_sha1, expected_sha1)
@@ -92,8 +92,20 @@
# The filename under unpacked directory, such as SYSTEM/bin/sh.
unpacked_name = os.path.join(
input_tmp, which.upper(), entry[(len(prefix) + 1):])
- file_sha1 = _CalculateFileSha1(entry, unpacked_name, True)
+ unpacked_file = _ReadFile(entry, unpacked_name, True)
+ file_size = unpacked_file.size
+ # block.map may contain less blocks, because mke2fs may skip allocating
+ # blocks if they contain all zeros. We can't reconstruct such a file from
+ # its block list. (Bug: 65213616)
+ if file_size > ranges.size() * 4096:
+ logging.warning(
+ 'Skipping %s that has less blocks: file size %d-byte,'
+ ' ranges %s (%d-byte)', entry, file_size, ranges,
+ ranges.size() * 4096)
+ continue
+
+ file_sha1 = unpacked_file.sha1
assert blocks_sha1 == file_sha1, \
'file: %s, range: %s, blocks_sha1: %s, file_sha1: %s' % (
entry, ranges, blocks_sha1, file_sha1)
diff --git a/tools/zipalign/Android.bp b/tools/zipalign/Android.bp
new file mode 100644
index 0000000..cfc6aec
--- /dev/null
+++ b/tools/zipalign/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright 2008 The Android Open Source Project
+//
+// Zip alignment tool
+//
+
+cc_binary_host {
+ name: "zipalign",
+
+ srcs: [
+ "ZipAlign.cpp",
+ "ZipEntry.cpp",
+ "ZipFile.cpp",
+ ],
+
+ static_libs: [
+ "libandroidfw",
+ "libutils",
+ "libcutils",
+ "liblog",
+ "libzopfli",
+ "libz",
+ ],
+
+ target: {
+ windows: {
+ host_ldlibs: ["-lpthread"],
+ enabled: true,
+ },
+ },
+}
diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk
deleted file mode 100644
index 8c0240a..0000000
--- a/tools/zipalign/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright 2008 The Android Open Source Project
-#
-# Zip alignment tool
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- ZipAlign.cpp \
- ZipEntry.cpp \
- ZipFile.cpp
-
-LOCAL_C_INCLUDES += external/zlib \
- external/zopfli/src
-
-LOCAL_STATIC_LIBRARIES := \
- libandroidfw \
- libutils \
- libcutils \
- liblog \
- libzopfli
-
-LOCAL_LDLIBS_linux += -lrt
-
-LOCAL_STATIC_LIBRARIES_windows += libz
-LOCAL_LDLIBS_linux += -lz
-LOCAL_LDLIBS_darwin += -lz
-
-ifneq ($(strip $(BUILD_HOST_static)),)
-LOCAL_LDLIBS += -lpthread
-endif # BUILD_HOST_static
-
-LOCAL_MODULE := zipalign
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-include $(BUILD_HOST_EXECUTABLE)