Merge "Allow devices to extend the system manifest."
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 1a84e8f..7e23ee0 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -450,6 +450,12 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk-sp)
+# Remove old dex output directories
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/with-local/)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/no-local/)
+$(call add-clean-step, rm -rf $(HOST_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/with-local/)
+$(call add-clean-step, rm -rf $(HOST_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/no-local/)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
new file mode 100644
index 0000000..9f3a2a6
--- /dev/null
+++ b/core/autogen_test_config.mk
@@ -0,0 +1,60 @@
+#
+# 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.
+# 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.
+#
+
+# This build rule allows TradeFed test config file to be created based on
+# following inputs:
+# is_native: If the test is a native test.
+# LOCAL_MANIFEST_FILE: Name of the AndroidManifest file for the test. If it's
+# not set, default value `AndroidManifest.xml` will be used.
+# Output:
+# autogen_test_config_file: Path to the test config file generated.
+
+autogen_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config
+ifeq (true,$(is_native))
+# Auto generating test config file for native test
+$(autogen_test_config_file) : $(NATIVE_TEST_CONFIG_TEMPLATE)
+ @echo "Auto generating test config $(notdir $@)"
+ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $^ > $@
+my_auto_generate_config := true
+else
+# Auto generating test config file for instrumentation test
+ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
+ LOCAL_MANIFEST_FILE := AndroidManifest.xml
+endif
+ifdef LOCAL_FULL_MANIFEST_FILE
+ my_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
+else
+ my_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
+endif
+ifneq (,$(wildcard $(my_android_manifest)))
+$(autogen_test_config_file) : $(my_android_manifest) $(EMPTY_TEST_CONFIG) $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE)
+ @echo "Auto generating test config $(notdir $@)"
+ @rm -f $@
+ $(hide) $(AUTOGEN_TEST_CONFIG_SCRIPT) $@ $^
+my_auto_generate_config := true
+endif # ifeq (,$(wildcard $(my_android_manifest)))
+endif # ifneq (true,$(is_native))
+
+ifeq (true,$(my_auto_generate_config))
+ LOCAL_INTERMEDIATE_TARGETS += $(autogen_test_config_file)
+ $(LOCAL_BUILT_MODULE): $(autogen_test_config_file)
+ ALL_MODULES.$(my_register_name).auto_test_config := true
+else
+ autogen_test_config_file :=
+endif
+
+my_android_manifest :=
+my_auto_generate_config :=
diff --git a/core/base_rules.mk b/core/base_rules.mk
index dc3a78b..9234abe 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -510,7 +510,6 @@
endif
ifdef is_native
arch_dir := /$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- is_native :=
endif
# The module itself.
@@ -531,13 +530,35 @@
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(s):$(dir)/$(n)))))
+test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
+ifeq (,$(test_config))
+ ifneq (true,$(is_native))
+ is_instrumentation_test := true
+ ifeq (true, $(LOCAL_IS_HOST_MODULE))
+ is_instrumentation_test := false
+ endif
+ endif
+ # CTS modules can be used for test data, so test config files must be
+ # explicitly created using AndroidTest.xml
+ ifeq (,$(filter cts, $(LOCAL_COMPATIBILITY_SUITE)))
+ ifeq (true, $(filter true,$(is_native) $(is_instrumentation_test)))
+ include $(BUILD_SYSTEM)/autogen_test_config.mk
+ test_config := $(autogen_test_config_file)
+ autogen_test_config_file :=
+ endif
+ endif
+endif
-ifneq (,$(wildcard $(LOCAL_PATH)/AndroidTest.xml))
+is_instrumentation_test :=
+
+ifneq (,$(test_config))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
- $(LOCAL_PATH)/AndroidTest.xml:$(dir)/$(LOCAL_MODULE).config)))
+ $(test_config):$(dir)/$(LOCAL_MODULE).config)))
endif
+test_config :=
+
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
@@ -552,6 +573,9 @@
endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
+arch_dir :=
+is_native :=
+
ifneq ($(my_test_data_file_pairs),)
$(foreach pair, $(my_test_data_file_pairs), \
$(eval parts := $(subst :,$(space),$(pair))) \
diff --git a/core/config.mk b/core/config.mk
index 50c2baa..43eaf01 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -156,8 +156,15 @@
BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
-BUILD_HOST_TEST_CONFIG:= $(BUILD_SYSTEM)/host_test_config.mk
-BUILD_TARGET_TEST_CONFIG:= $(BUILD_SYSTEM)/target_test_config.mk
+BUILD_HOST_TEST_CONFIG := $(BUILD_SYSTEM)/host_test_config.mk
+BUILD_TARGET_TEST_CONFIG := $(BUILD_SYSTEM)/target_test_config.mk
+
+INSTRUMENTATION_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/instrumentation_test_config_template.xml
+NATIVE_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_test_config_template.xml
+EMPTY_TEST_CONFIG := $(BUILD_SYSTEM)/empty_test_config.xml
+
+# Tool to generate TradeFed test config file automatically.
+AUTOGEN_TEST_CONFIG_SCRIPT := build/make/tools/auto_gen_test_config.py
# ###############################################################
# Parse out any modifier targets.
@@ -713,14 +720,8 @@
TARGET_OPENJDK9 := true
endif
-# Path to tools.jar, or empty if USE_OPENJDK9 is unset
-HOST_JDK_TOOLS_JAR :=
-# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8
-# toolchains are no longer supported (i.e. when USE_OPENJDK9 is enforced).
-# http://b/38418220
-ifndef USE_OPENJDK9
-HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar
-endif # ifndef USE_OPENJDK9
+# Path to tools.jar
+HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
diff --git a/core/definitions.mk b/core/definitions.mk
index 5ad78fd..a20bf44 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2421,8 +2421,7 @@
--output $(dir $@) \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
$(subst --main-dex-list=, --main-dex-list , \
- $(subst --no-locals, --release, \
- $(filter-out --core-library --multi-dex --minimal-main-dex,$(PRIVATE_DX_FLAGS)))) \
+ $(filter-out --core-library --multi-dex --minimal-main-dex,$(PRIVATE_DX_FLAGS))) \
$(dir $@)d8_input.jar
$(hide) rm -f $(dir $@)d8_input.jar
endef
diff --git a/core/empty_test_config.xml b/core/empty_test_config.xml
new file mode 100644
index 0000000..7c9daff
--- /dev/null
+++ b/core/empty_test_config.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+<!-- No AndroidTest.xml was provided and the manifest does not include
+ instrumentation, hence this apk is not instrumentable.
+-->
+<configuration description="Empty Configuration" />
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 4b12bfe..1ff9b91 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -176,7 +176,7 @@
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_desugar_jar) $(DX)
+$(built_dex): $(full_classes_desugar_jar) $(DX) $(ZIP2ZIP)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
diff --git a/core/instrumentation_test_config_template.xml b/core/instrumentation_test_config_template.xml
new file mode 100644
index 0000000..a0badab
--- /dev/null
+++ b/core/instrumentation_test_config_template.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs {LABEL}.">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="test-file-name" value="{MODULE}.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.{TEST_TYPE}" >
+ <option name="package" value="{PACKAGE}" />
+ <option name="runner" value="{RUNNER}" />
+ </test>
+</configuration>
diff --git a/core/java.mk b/core/java.mk
index 08e4035..3e0123b 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -59,15 +59,6 @@
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-# Choose leaf name for the compiled jar file.
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-full_classes_compiled_jar_leaf := classes-no-debug-var.jar
-built_dex_intermediate_leaf := no-local
-else
-full_classes_compiled_jar_leaf := classes-full-debug.jar
-built_dex_intermediate_leaf := with-local
-endif
-
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
LOCAL_PROGUARD_ENABLED :=
endif
@@ -75,14 +66,13 @@
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
-full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
+full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
-jarjar_leaf := classes-jarjar.jar
-full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
-built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
+built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
java_source_list_file := $(intermediates.COMMON)/java-source-list
@@ -751,15 +741,6 @@
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-# If you instrument class files that have local variable debug information in
-# them emma does not correctly maintain the local variable table.
-# This will cause an error when you try to convert the class files for Android.
-# The workaround here is to build different dex file here based on emma switch
-# then later copy into classes.dex. When emma is on, dx is run with --no-locals
-# option to remove local variable information
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
-endif
my_r8 :=
ifdef LOCAL_PROGUARD_ENABLED
@@ -777,7 +758,7 @@
endif # LOCAL_PROGUARD_ENABLED
ifndef my_r8
-$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
+$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
diff --git a/core/java_common.mk b/core/java_common.mk
index aac5982..cfc9d7f 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -36,6 +36,27 @@
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
###########################################################
+
+# OpenJDK versions up to 8 shipped with bootstrap and tools jars
+# (rt.jar, jce.jar, tools.jar etc.). These are no longer part of
+# OpenJDK 9, but we still make them available for host tools that
+# are targeting older versions.
+USE_HOST_BOOTSTRAP_JARS := true
+ifeq (,$(filter $(LOCAL_JAVA_LANGUAGE_VERSION), 1.6 1.7 1.8))
+USE_HOST_BOOTSTRAP_JARS := false
+endif
+
+###########################################################
+
+# Drop HOST_JDK_TOOLS_JAR from classpath when targeting versions > 9 (which don't have it).
+# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once host
+# bootstrap jars are no longer supported (ie. when USE_HOST_BOOTSTRAP_JARS
+# is always false). http://b/38418220
+ifneq ($(USE_HOST_BOOTSTRAP_JARS),true)
+LOCAL_CLASSPATH := $(filter-out $(HOST_JDK_TOOLS_JAR),$(LOCAL_CLASSPATH))
+endif
+
+###########################################################
## .proto files: Compile proto files to .java
###########################################################
ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
@@ -290,7 +311,23 @@
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true)
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),true)
else # !USE_CORE_LIB_BOOTCLASSPATH
-
+ # Give host-side tools a version of OpenJDK's standard libraries
+ # close to what they're targeting. As of Dec 2017, AOSP is only
+ # bundling OpenJDK 8 and 9, so nothing < 8 is available.
+ #
+ # When building with OpenJDK 8, the following should have no
+ # effect since those jars would be available by default.
+ #
+ # When building with OpenJDK 9 but targeting a version < 1.8,
+ # putting them on the bootclasspath means that:
+ # a) code can't (accidentally) refer to OpenJDK 9 specific APIs
+ # b) references to existing APIs are not reinterpreted in an
+ # OpenJDK 9-specific way, eg. calls to subclasses of
+ # java.nio.Buffer as in http://b/70862583
+ ifeq ($(USE_HOST_BOOTSTRAP_JARS),true)
+ full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/jce.jar
+ full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/rt.jar
+ endif
full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
full_shared_java_header_libs := $(full_shared_java_libs)
diff --git a/core/native_test_config_template.xml b/core/native_test_config_template.xml
new file mode 100644
index 0000000..a960529
--- /dev/null
+++ b/core/native_test_config_template.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs {MODULE}.">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="{MODULE}" />
+ </test>
+</configuration>
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 11ca473..bbad4c8 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -122,6 +122,8 @@
$(call add_json_bool, Uml, $(filter true,$(TARGET_USER_MODE_LINUX)))
$(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR))
+$(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM))
+$(call add_json_str, OemPath, $(TARGET_COPY_OUT_OEM))
$(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk
index f6d688c..b45526f 100644
--- a/core/tasks/module-info.mk
+++ b/core/tasks/module-info.mk
@@ -12,6 +12,7 @@
'"tags": [$(foreach w,$(sort $(ALL_MODULES.$(m).TAGS)),"$(w)", )], ' \
'"installed": [$(foreach w,$(sort $(ALL_MODULES.$(m).INSTALLED)),"$(w)", )], ' \
'"compatibility_suites": [$(foreach w,$(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES)),"$(w)", )], ' \
+ '"auto_test_config": [$(ALL_MODULES.$(m).auto_test_config)], ' \
'},\n' \
) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
$(hide) echo '}' >> $@
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index 962fae1..1bbd3b0 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -46,6 +46,22 @@
)
endef
+# Returns paths of notice files under $(TARGET_OUT_NOTICE_FILES)
+#
+# Args:
+# $(1): list of lib names (e.g., libfoo.vendor)
+# $(2): vndk lib type, one of 'vndk' or 'vndk-sp'
+define paths-of-notice-files
+$(strip \
+ $(eval lib_dir := lib$(if $(TARGET_IS_64BIT),64,)) \
+ $(eval vndk_dir := $(2)-$(PLATFORM_VNDK_VERSION)) \
+ $(foreach lib,$(1), \
+ $(eval notice_file_name := $(patsubst %.vendor,%.so.txt,$(lib))) \
+ $(TARGET_OUT_NOTICE_FILES)/src/system/$(lib_dir)/$(vndk_dir)/$(notice_file_name) \
+ ) \
+)
+endef
+
# If in the future libclang_rt.ubsan* is removed from the VNDK-core list,
# need to update the related logic in this file.
ifeq (,$(filter libclang_rt.ubsan%,$(VNDK_CORE_LIBRARIES)))
@@ -101,9 +117,21 @@
$(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+#######################################
+# module_paths.txt
+module_paths.txt := $(vndk_snapshot_configs_out)/module_paths.txt
+$(module_paths.txt): $(vndk_snapshot_libs)
+ @echo 'Generating: $@'
+ @rm -f $@
+ @mkdir -p $(dir $@)
+ $(hide) echo -n > $@
+ $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
+
+
vndk_snapshot_configs := \
$(vndkcore.libraries.txt) \
- $(vndkprivate.libraries.txt)
+ $(vndkprivate.libraries.txt) \
+ $(module_paths.txt)
#######################################
# vndk_snapshot_zip
@@ -125,6 +153,11 @@
$(call paths-of-intermediates,$(vndk_prebuilt_txts),ETC) \
$(vndk_snapshot_configs)
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_OUT := $(vndk_snapshot_arch)/NOTICE_FILES
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := \
+ $(call paths-of-notice-files,$(vndk_core_libs),vndk) \
+ $(call paths-of-notice-files,$(vndk_sp_libs),vndk-sp)
+
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# vndk_snapshot_arch_2ND := $(vndk_snapshot_out)/arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)
@@ -165,6 +198,8 @@
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
$(call private-copy-vndk-intermediates, \
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
+ $(call private-copy-vndk-intermediates, \
+ $(PRIVATE_NOTICE_FILES_OUT),$(PRIVATE_NOTICE_FILES_INTERMEDIATES))
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# $(call private-copy-vndk-intermediates, \
@@ -182,6 +217,7 @@
# clear global vars
clang-ubsan-vndk-core :=
paths-of-intermediates :=
+paths-of-notice-files :=
vndk_core_libs :=
vndk_sp_libs :=
vndk_snapshot_libs :=
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index 7ff5acb..c385352 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -87,3 +87,7 @@
system/core/rootdir/etc/ld.config.txt:system/etc/ld.config.noenforce.txt \
build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc \
build/make/target/product/vndk/init.noenforce.rc:system/etc/init/gsi/init.noenforce.rc
+
+#Set current VNDK version for GSI
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ ro.gsi.vndk.version=$(PLATFORM_VNDK_VERSION)
diff --git a/target/product/vndk/init.noenforce.rc b/target/product/vndk/init.noenforce.rc
index 9371cc8..6cf1df7 100644
--- a/target/product/vndk/init.noenforce.rc
+++ b/target/product/vndk/init.noenforce.rc
@@ -1,3 +1,5 @@
on early-init
# If ro.vndk.version is not set, use ld.config.nonenforce.txt
export LD_CONFIG_FILE /system/etc/ld.config.noenforce.txt
+ # To use current VNDK libs, set ro.vndk.version to system vndk version
+ setprop ro.vndk.version ${ro.gsi.vndk.version}
diff --git a/tools/auto_gen_test_config.py b/tools/auto_gen_test_config.py
new file mode 100755
index 0000000..da4443c
--- /dev/null
+++ b/tools/auto_gen_test_config.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# 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.
+# 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.
+
+"""A tool to generate TradeFed test config file.
+"""
+
+import os
+import shutil
+import sys
+from xml.dom.minidom import parse
+
+ATTRIBUTE_LABEL = 'android:label'
+ATTRIBUTE_RUNNER = 'android:name'
+ATTRIBUTE_PACKAGE = 'package'
+
+PLACEHOLDER_LABEL = '{LABEL}'
+PLACEHOLDER_MODULE = '{MODULE}'
+PLACEHOLDER_PACKAGE = '{PACKAGE}'
+PLACEHOLDER_RUNNER = '{RUNNER}'
+PLACEHOLDER_TEST_TYPE = '{TEST_TYPE}'
+
+
+def main(argv):
+ """Entry point of auto_gen_test_config.
+
+ Args:
+ argv: A list of arguments.
+ Returns:
+ 0 if no error, otherwise 1.
+ """
+ if len(argv) != 4:
+ sys.stderr.write(
+ 'Invalid arguements. The script requires 4 arguments for file paths: '
+ 'target_config android_manifest empty_config '
+ 'instrumentation_test_config_template.\n')
+ return 1
+ target_config = argv[0]
+ android_manifest = argv[1]
+ empty_config = argv[2]
+ instrumentation_test_config_template = argv[3]
+
+ manifest = parse(android_manifest)
+ instrumentation_elements = manifest.getElementsByTagName('instrumentation')
+ manifest_elements = manifest.getElementsByTagName('manifest')
+ if len(instrumentation_elements) != 1 or len(manifest_elements) != 1:
+ # Failed to locate instrumentation or manifest element in AndroidManifest.
+ # file. Empty test config file will be created.
+ shutil.copyfile(empty_config, target_config)
+ return 0
+
+ module = os.path.splitext(os.path.basename(target_config))[0]
+ instrumentation = instrumentation_elements[0]
+ manifest = manifest_elements[0]
+ if instrumentation.attributes.has_key(ATTRIBUTE_LABEL):
+ label = instrumentation.attributes[ATTRIBUTE_LABEL].value
+ else:
+ label = module
+ runner = instrumentation.attributes[ATTRIBUTE_RUNNER].value
+ package = manifest.attributes[ATTRIBUTE_PACKAGE].value
+ test_type = ('AndroidJUnitTest' if runner.endswith('.AndroidJUnitRunner')
+ else 'InstrumentationTest')
+
+ with open(instrumentation_test_config_template) as template:
+ config = template.read()
+ config = config.replace(PLACEHOLDER_LABEL, label)
+ config = config.replace(PLACEHOLDER_MODULE, module)
+ config = config.replace(PLACEHOLDER_PACKAGE, package)
+ config = config.replace(PLACEHOLDER_TEST_TYPE, test_type)
+ config = config.replace(PLACEHOLDER_RUNNER, runner)
+ with open(target_config, 'w') as config_file:
+ config_file.write(config)
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/tools/auto_gen_test_config_test.py b/tools/auto_gen_test_config_test.py
new file mode 100644
index 0000000..e70eff8
--- /dev/null
+++ b/tools/auto_gen_test_config_test.py
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+#
+# 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.
+# 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.
+
+"""Unittests for auto_gen_test_config."""
+
+import os
+import shutil
+import tempfile
+import unittest
+
+import auto_gen_test_config
+
+TEST_MODULE = 'TestModule'
+
+MANIFEST_INVALID = """<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+</manifest>
+"""
+
+MANIFEST_JUNIT_TEST = """<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.my.tests.x">
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.my.tests" />
+</manifest>
+"""
+
+MANIFEST_INSTRUMENTATION_TEST = """<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.my.tests.x">
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.my.tests"
+ android:label="My Tests" />
+</manifest>
+"""
+
+EXPECTED_JUNIT_TEST_CONFIG = """<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs TestModule.">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="test-file-name" value="TestModule.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.my.tests.x" />
+ <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ </test>
+</configuration>
+"""
+
+EXPECTED_INSTRUMENTATION_TEST_CONFIG = """<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs My Tests.">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="test-file-name" value="TestModule.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.InstrumentationTest" >
+ <option name="package" value="com.android.my.tests.x" />
+ <option name="runner" value="android.test.InstrumentationTestRunner" />
+ </test>
+</configuration>
+"""
+
+TOOLS_DIR = os.path.dirname(os.path.dirname(__file__))
+EMPTY_TEST_CONFIG = os.path.join(
+ TOOLS_DIR, '..', 'core', 'empty_test_config.xml')
+INSTRUMENTATION_TEST_CONFIG_TEMPLATE = os.path.join(
+ TOOLS_DIR, '..', 'core', 'instrumentation_test_config_template.xml')
+
+
+class AutoGenTestConfigUnittests(unittest.TestCase):
+ """Unittests for auto_gen_test_config."""
+
+ def setUp(self):
+ """Setup directory for test."""
+ self.test_dir = tempfile.mkdtemp()
+ self.config_file = os.path.join(self.test_dir, TEST_MODULE + '.config')
+ self.manifest_file = os.path.join(self.test_dir, 'AndroidManifest.xml')
+
+ def tearDown(self):
+ """Cleanup the test directory."""
+ shutil.rmtree(self.test_dir, ignore_errors=True)
+
+ def testInvalidManifest(self):
+ """An empty test config should be generated if AndroidManifest is invalid.
+ """
+ with open(self.manifest_file, 'w') as f:
+ f.write(MANIFEST_INVALID)
+
+ argv = [self.config_file,
+ self.manifest_file,
+ EMPTY_TEST_CONFIG,
+ INSTRUMENTATION_TEST_CONFIG_TEMPLATE]
+ auto_gen_test_config.main(argv)
+ with open(self.config_file) as config_file:
+ with open(EMPTY_TEST_CONFIG) as empty_config:
+ self.assertEqual(config_file.read(), empty_config.read())
+
+ def testCreateJUnitTestConfig(self):
+ """Test creating test config for AndroidJUnitTest.
+ """
+ with open(self.manifest_file, 'w') as f:
+ f.write(MANIFEST_JUNIT_TEST)
+
+ argv = [self.config_file,
+ self.manifest_file,
+ EMPTY_TEST_CONFIG,
+ INSTRUMENTATION_TEST_CONFIG_TEMPLATE]
+ auto_gen_test_config.main(argv)
+ with open(self.config_file) as config_file:
+ self.assertEqual(config_file.read(), EXPECTED_JUNIT_TEST_CONFIG)
+
+ def testCreateInstrumentationTestConfig(self):
+ """Test creating test config for AndroidJUnitTest.
+ """
+ with open(self.manifest_file, 'w') as f:
+ f.write(MANIFEST_INSTRUMENTATION_TEST)
+
+ argv = [self.config_file,
+ self.manifest_file,
+ EMPTY_TEST_CONFIG,
+ INSTRUMENTATION_TEST_CONFIG_TEMPLATE]
+ auto_gen_test_config.main(argv)
+ with open(self.config_file) as config_file:
+ self.assertEqual(
+ config_file.read(), EXPECTED_INSTRUMENTATION_TEST_CONFIG)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 829b8db..12e757d 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1431,11 +1431,9 @@
self.disable_imgdiff = disable_imgdiff
if version is None:
- version = 1
- if OPTIONS.info_dict:
- version = max(
- int(i) for i in
- OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(","))
+ version = max(
+ int(i) for i in
+ OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(","))
assert version >= 3
self.version = version
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 60e2e5c..d5ac922 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -409,10 +409,10 @@
# in the target build.
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
- recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
oem_dicts = None
if oem_props:
+ recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
oem_dicts = _LoadOemDicts(script, recovery_mount_options)
target_fp = CalculateFingerprint(oem_props, oem_dicts and oem_dicts[0],
@@ -503,8 +503,6 @@
if HasVendorPartition(input_zip):
system_progress -= 0.1
- recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
-
script.ShowProgress(system_progress, 0)
# Full OTA is done as an "incremental" against an empty source image. This
@@ -632,12 +630,12 @@
source_version, OPTIONS.target_info_dict,
fstab=OPTIONS.source_info_dict["fstab"])
- recovery_mount_options = OPTIONS.source_info_dict.get(
- "recovery_mount_options")
source_oem_props = OPTIONS.source_info_dict.get("oem_fingerprint_properties")
target_oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
oem_dicts = None
- if source_oem_props and target_oem_props:
+ if source_oem_props or target_oem_props:
+ recovery_mount_options = OPTIONS.source_info_dict.get(
+ "recovery_mount_options")
oem_dicts = _LoadOemDicts(script, recovery_mount_options)
metadata = {
@@ -684,11 +682,10 @@
system_src = GetImage("system", OPTIONS.source_tmp)
system_tgt = GetImage("system", OPTIONS.target_tmp)
- blockimgdiff_version = 1
- if OPTIONS.info_dict:
- blockimgdiff_version = max(
- int(i) for i in
- OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(","))
+ blockimgdiff_version = max(
+ int(i) for i in
+ OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(","))
+ assert blockimgdiff_version >= 3
# Check the first block of the source system partition for remount R/W only
# if the filesystem is ext4.
@@ -786,32 +783,20 @@
device_specific.IncrementalOTA_VerifyBegin()
- # When blockimgdiff version is less than 3 (non-resumable block-based OTA),
- # patching on a device that's already on the target build will damage the
- # system. Because operations like move don't check the block state, they
- # always apply the changes unconditionally.
- if blockimgdiff_version <= 2:
- if source_oem_props is None:
- script.AssertSomeFingerprint(source_fp)
- else:
- script.AssertSomeThumbprint(
- GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
-
- else: # blockimgdiff_version > 2
- if source_oem_props is None and target_oem_props is None:
- script.AssertSomeFingerprint(source_fp, target_fp)
- elif source_oem_props is not None and target_oem_props is not None:
- script.AssertSomeThumbprint(
- GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
- GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
- elif source_oem_props is None and target_oem_props is not None:
- script.AssertFingerprintOrThumbprint(
- source_fp,
- GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict))
- else:
- script.AssertFingerprintOrThumbprint(
- target_fp,
- GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
+ if source_oem_props is None and target_oem_props is None:
+ script.AssertSomeFingerprint(source_fp, target_fp)
+ elif source_oem_props is not None and target_oem_props is not None:
+ script.AssertSomeThumbprint(
+ GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict),
+ GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
+ elif source_oem_props is None and target_oem_props is not None:
+ script.AssertFingerprintOrThumbprint(
+ source_fp,
+ GetBuildProp("ro.build.thumbprint", OPTIONS.target_info_dict))
+ else:
+ script.AssertFingerprintOrThumbprint(
+ target_fp,
+ GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
# Check the required cache size (i.e. stashed blocks).
size = []