Merge "Revert "Verify init scripts for correctness during build""
diff --git a/Changes.md b/Changes.md
index 7519096..21a0abe 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,62 @@
# Build System Changes for Android.mk Writers
+## Removing '/' from Valid Module Names {#name_slash}
+
+The build system uses module names in path names in many places. Having an
+extra '/' or '../' being inserted can cause problems -- and not just build
+breaks, but stranger invalid behavior.
+
+In every case we've seen, the fix is relatively simple: move the directory into
+`LOCAL_MODULE_RELATIVE_PATH` (or `LOCAL_MODULE_PATH` if you're still using it).
+If this causes multiple modules to be named the same, use unique module names
+and `LOCAL_MODULE_STEM` to change the installed file name:
+
+``` make
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver1/code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware
+...
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver2/code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware
+...
+include $(BUILD_PREBUILT)
+```
+
+Can be rewritten as:
+
+```
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver1_code.bin
+LOCAL_MODULE_STEM := code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/firmware/ver1
+...
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver2_code.bin
+LOCAL_MODULE_STEM := code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/firmware/ver2
+...
+include $(BUILD_PREBUILT)
+```
+
+You just need to make sure that any other references (`PRODUCT_PACKAGES`,
+`LOCAL_REQUIRED_MODULES`, etc) are converted to the new names.
+
+## Valid Module Names {#name}
+
+We've adopted lexical requirements very similar to [Bazel's
+requirements](https://docs.bazel.build/versions/master/build-ref.html#name) for
+target names. Valid characters are `a-z`, `A-Z`, `0-9`, and the special
+characters `_.+-=,@~`. This currently applies to `LOCAL_PACKAGE_NAME`,
+`LOCAL_MODULE`, and `LOCAL_MODULE_SUFFIX`, and `LOCAL_MODULE_STEM*`.
+
+Many other characters already caused problems if you used them, so we don't
+expect this to have a large effect.
+
## PATH Tools {#PATH_Tools}
The build has started restricting the external host tools usable inside the
diff --git a/CleanSpec.mk b/CleanSpec.mk
index beca20b..cea1464 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -479,6 +479,9 @@
# Remove stale init.noenforce.rc
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/gsi/init.noenforce.rc)
+# Remove old merged AndroidManifest.xml location
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/AndroidManifest.xml)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index fc724ea..a5109f0 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1396,10 +1396,6 @@
>> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
$(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
- $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
- rm -rf $(TARGET_RECOVERY_ROOT_OUT)/system; \
- ln -sf /system_root/system $(TARGET_RECOVERY_ROOT_OUT)/system) # Mount the system_root_image to /system_root and symlink /system.
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
@@ -1538,6 +1534,8 @@
# so that we can get the size stat even if the build fails due to too large
# system image.
INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
+INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
+$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -1970,6 +1968,8 @@
$(PDK_FUSION_SYMLINK_STAMP)
INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
+INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
+$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -2047,6 +2047,8 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
+INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
+$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -2102,6 +2104,8 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
+INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
+$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -2278,6 +2282,10 @@
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
endif
+ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
+BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
+endif
+
ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
$(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
endif
@@ -2909,7 +2917,7 @@
# -----------------------------------------------------------------
# NDK Sysroot Package
NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
-$(NDK_SYSROOT_TARGET): ndk
+$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
@echo Package NDK sysroot...
$(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 1dca7ab..0215106 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -6,40 +6,64 @@
LOCAL_MANIFEST_FILE := AndroidManifest.xml
endif
ifdef LOCAL_FULL_MANIFEST_FILE
- full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
+ main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
else
- full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
+ main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
endif
-my_full_libs_manifest_files := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
-my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
-
-# Set up dependency on aar libraries
LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
-ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
-my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
-my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
-# With aapt2, we'll link in the built resource from the AAR.
-ifneq ($(LOCAL_USE_AAPT2),true)
-LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
-endif # LOCAL_USE_AAPT2
-endif # LOCAL_STATIC_JAVA_AAR_LIBRARIES
+my_full_libs_manifest_files :=
+
+ifndef LOCAL_DONT_MERGE_MANIFESTS
+ my_full_libs_manifest_files += $(LOCAL_FULL_LIBS_MANIFEST_FILES)
+
+ ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
+ my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
+ endif
+endif
+
+ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
+ # With aapt2, we'll link in the built resource from the AAR.
+ ifneq ($(LOCAL_USE_AAPT2),true)
+ LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
+ endif
+endif
+
+full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
+
+ifdef LOCAL_MIN_SDK_VERSION
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(LOCAL_MIN_SDK_VERSION)
+else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+else
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(DEFAULT_APP_TARGET_SDK)
+endif
# Set up rules to merge library manifest files
-ifdef my_full_libs_manifest_files
-main_android_manifest := $(full_android_manifest)
-full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
+my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
+$(full_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
+$(full_android_manifest): $(my_exported_sdk_libs_file)
+$(full_android_manifest): $(MANIFEST_FIXER)
+
+ifneq (,$(strip $(my_full_libs_manifest_files)))
+
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
-$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_deps)
+$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
- $(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
+ $(call fix-manifest,$<,$@.tmp,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
+ $(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
--out $@
+ rm $@.tmp
+
+else
+$(full_android_manifest): $(main_android_manifest)
+ @echo "Fix manifest: $@"
+ $(call fix-manifest,$<,$@,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
endif
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
index 20c582a..5feec2b 100644
--- a/core/autogen_test_config.mk
+++ b/core/autogen_test_config.mk
@@ -31,7 +31,7 @@
# Auto generating test config file for native test
$(autogen_test_config_file) : $(autogen_test_config_template)
@echo "Auto generating test config $(notdir $@)"
- $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $^ > $@
+ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $< > $@
my_auto_generate_config := true
else
# Auto generating test config file for instrumentation test
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 075465e..4f0e39f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -31,6 +31,7 @@
ifeq ($(LOCAL_MODULE),)
$(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
endif
+$(call verify-module-name)
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
@@ -557,8 +558,7 @@
# The module itself.
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
- $(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))) \
- $(eval my_compat_dist_config_$(suite) := ))
+ $(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))))
# Make sure we only add the files once for multilib modules.
ifndef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
@@ -605,7 +605,7 @@
ifneq (,$(test_config))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+ $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(test_config):$(dir)/$(LOCAL_MODULE).config)))
endif
@@ -613,14 +613,14 @@
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+ $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(LOCAL_PATH)/DynamicConfig.xml:$(dir)/$(LOCAL_MODULE).dynamic)))
endif
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config))
$(foreach extra_config, $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config), \
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+ $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(extra_config):$(dir)/$(notdir $(extra_config))))))
endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
@@ -639,8 +639,6 @@
is_native :=
$(call create-suite-dependencies)
-$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_config_$(suite) := ))
endif # LOCAL_COMPATIBILITY_SUITE
@@ -795,8 +793,10 @@
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
endif
$(LOCAL_MODULE)-$(h_or_hc_or_t) : $(my_all_targets)
+.PHONY: $(LOCAL_MODULE)-$(h_or_hc_or_t)
ifeq ($(j_or_n),native)
$(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix) : $(my_all_targets)
+.PHONY: $(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix)
endif
endif
diff --git a/core/binary.mk b/core/binary.mk
index 788472d..2899d4d 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -405,6 +405,13 @@
my_cpp_std_cppflags := -std=$(my_cpp_std_version)
endif
+# Extra cflags for projects under external/ directory
+ifeq ($(my_clang),true)
+ifneq ($(filter external/%,$(LOCAL_PATH)),)
+ my_cflags += $(CLANG_EXTERNAL_CFLAGS)
+endif
+endif
+
# arch-specific static libraries go first so that generic ones can depend on them
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 1a33153..5051ef7 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -61,6 +61,7 @@
LOCAL_DONT_CHECK_MODULE:=
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
+LOCAL_DONT_MERGE_MANIFESTS:=
LOCAL_DPI_FILE_STEM:=
LOCAL_DPI_VARIANTS:=
LOCAL_DROIDDOC_ASSET_DIR:=
@@ -83,6 +84,7 @@
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
LOCAL_EXPORT_PROGUARD_FLAG_FILES:=
+LOCAL_EXPORT_SDK_LIBRARIES:=
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
LOCAL_EXTRACT_APK:=
diff --git a/core/config.mk b/core/config.mk
index 6c062a6..0920b56 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -570,9 +570,7 @@
# Work around for b/68406220
# This should match the soong version.
-ifndef USE_D8
- USE_D8 := true
-endif
+USE_D8 := true
# Default R8 behavior when USE_R8 is not specified.
ifndef USE_R8
@@ -586,7 +584,6 @@
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
- DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
@@ -596,7 +593,6 @@
AIDL := $(prebuilt_build_tools_bin)/aidl
AAPT := $(prebuilt_sdk_tools_bin)/aapt
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
- DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 1363c8d..aeead06 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -190,6 +190,15 @@
endif
endif
+# Disable Scudo if ASan or TSan is enabled.
+ifneq ($(filter address thread,$(my_sanitize)),)
+ my_sanitize := $(filter-out scudo,$(my_sanitize))
+endif
+
+ifneq ($(filter scudo,$(my_sanitize)),)
+ my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)SCUDO_RUNTIME_LIBRARY)
+endif
+
# Undefined symbols can occur if a non-sanitized library links
# sanitized static libraries. That's OK, because the executable
# always depends on the ASan runtime library, which defines these
@@ -374,7 +383,7 @@
notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
my_cflags += -fno-sanitize-trap=$(notrap_arg)
# Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
- ifeq ($(filter address thread,$(my_sanitize)),)
+ ifeq ($(filter address thread scudo,$(my_sanitize)),)
# Does not have to be the first DT_NEEDED unlike ASan.
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
endif
diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk
index 48b7787..30df8ea 100644
--- a/core/configure_module_stem.mk
+++ b/core/configure_module_stem.mk
@@ -1,20 +1,26 @@
my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32))
ifdef my_multilib_stem
my_module_stem := $(my_multilib_stem)
+ $(call verify-module-stem,my_multilib_stem)
else ifdef LOCAL_MODULE_STEM
my_module_stem := $(LOCAL_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_MODULE_STEM)
else
my_module_stem := $(LOCAL_MODULE)
endif
ifdef LOCAL_BUILT_MODULE_STEM
my_built_module_stem := $(LOCAL_BUILT_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_BUILT_MODULE_STEM)
else
my_built_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX)
+ $(call verify-module-stem,LOCAL_MODULE_SUFFIX)
endif
ifdef LOCAL_INSTALLED_MODULE_STEM
my_installed_module_stem := $(LOCAL_INSTALLED_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_INSTALLED_MODULE_STEM)
else
my_installed_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX)
+ $(call verify-module-stem,LOCAL_MODULE_SUFFIX)
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index e18f9a4..a8d7b2d 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -731,6 +731,25 @@
endef
endif
+# Get the exported-sdk-libs files which collectively give you the list of exported java sdk
+# lib names that are (transitively) exported from the given set of java libs
+# $(1): library name list
+define exported-sdk-libs-files
+$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/exported-sdk-libs)
+endef
+
+# Fix manifest
+# $(1): input manifest path
+# $(2): output manifest path
+# $(3): min sdk version
+# $(4): (optional) exported-sdk-libs file
+define fix-manifest
+$(MANIFEST_FIXER) \
+--minSdkVersion $(3) \
+$(if $(4),$$(cat $(4) | sort -u | sed -e 's/^/\ --uses-library\ /' | tr '\n' ' ')) \
+$(1) $(2)
+endef
+
###########################################################
## Returns true if $(1) and $(2) are equal. Returns
## the empty string if they are not equal.
@@ -1835,14 +1854,15 @@
###########################################################
ifneq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_EXTRA = && $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_EXTRA = && $(PRIVATE_OBJCOPY_ADD_SECTION) --add-gnu-debuglink=$< $@
TARGET_STRIP_KEEP_SYMBOLS_EXTRA = --add-gnu-debuglink=$<
endif
define transform-to-stripped
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ \
+$(hide) $(PRIVATE_STRIP) $(PRIVATE_STRIP_ALL_FLAGS) $< \
+ $(PRIVATE_STRIP_O_FLAG) $@ \
$(if $(PRIVATE_NO_DEBUGLINK),,$(TARGET_STRIP_EXTRA))
endef
@@ -1850,7 +1870,9 @@
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (mini debug info): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(hide) rm -f $@ $@.dynsyms $@.funcsyms $@.keep_symbols $@.debug $@.mini_debuginfo.xz
-if $(PRIVATE_STRIP) --strip-all -R .comment $< -o $@; then \
+if $(PRIVATE_STRIP) $(PRIVATE_STRIP_ALL_FLAGS) \
+ --remove-section .comment $< \
+ $(PRIVATE_STRIP_O_FLAG) $@; then \
$(PRIVATE_OBJCOPY) --only-keep-debug $< $@.debug && \
$(PRIVATE_NM) -D $< --format=posix --defined-only | awk '{ print $$1 }' | sort >$@.dynsyms && \
$(PRIVATE_NM) $< --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort >$@.funcsyms && \
@@ -1861,7 +1883,7 @@
$(PRIVATE_OBJCOPY) --rename-section saved_debug_frame=.debug_frame $@.mini_debuginfo && \
rm -f $@.mini_debuginfo.xz && \
$(XZ) $@.mini_debuginfo && \
- $(PRIVATE_OBJCOPY) --add-section .gnu_debugdata=$@.mini_debuginfo.xz $@; \
+ $(PRIVATE_OBJCOPY_ADD_SECTION) --add-section .gnu_debugdata=$@.mini_debuginfo.xz $@; \
else \
cp -f $< $@; \
fi
@@ -1870,8 +1892,8 @@
define transform-to-stripped-keep-symbols
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_OBJCOPY) \
- `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \
+$(hide) $(PRIVATE_OBJCOPY_ADD_SECTION) \
+ `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "--remove-section " $$2}' | xargs` \
$(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@
endef
@@ -2374,48 +2396,10 @@
$(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1))
endef
-# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
-define desugar-classes-jar
-@echo Desugar: $@
-@mkdir -p $(dir $@)
-$(hide) rm -f $@ $@.tmp
-@rm -rf $(dir $@)/desugar_dumped_classes
-@mkdir $(dir $@)/desugar_dumped_classes
-$(hide) $(JAVA) \
- $(if $(USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
- -Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
- -jar $(DESUGAR) \
- $(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
- $(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
- --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
- --allow_empty_bootclasspath \
- $(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
- -i $< -o $@.tmp
- mv $@.tmp $@
-endef
-
define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
-$(hide) rm -f $(dir $@)classes*.dex
-$(hide) $(DX_COMMAND) \
- --dex --output=$(dir $@) \
- --min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
- $(if $(NO_OPTIMIZE_DX), \
- --no-optimize) \
- $(if $(GENERATE_DEX_DEBUG), \
- --debug --verbose \
- --dump-to=$(@:.dex=.lst) \
- --dump-width=1000) \
- $(PRIVATE_DX_FLAGS) \
- $<
-endef
-
-
-define transform-classes-d8.jar-to-dex
-@echo "target Dex: $(PRIVATE_MODULE)"
-@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
$(hide) $(DX_COMMAND) \
@@ -2684,18 +2668,6 @@
$$(copy-file-to-target)
endef
-# Copies many xml files and check they are well-formed.
-# $(1): The xml files to copy. Each entry is a ':' separated src:dst pair.
-# Evaluates to the list of the dst files. (ie suitable for a dependency list.)
-define copy-many-xml-files-checked
-$(foreach f, $(1), $(strip \
- $(eval _cmf_tuple := $(subst :, ,$(f))) \
- $(eval _cmf_src := $(word 1,$(_cmf_tuple))) \
- $(eval _cmf_dest := $(word 2,$(_cmf_tuple))) \
- $(eval $(call copy-xml-file-checked,$(_cmf_src),$(_cmf_dest))) \
- $(_cmf_dest)))
-endef
-
# Copy the file only if it is a well-formed manifest file. For use viea $(eval)
# $(1): source file
# $(2): destination file
@@ -3141,20 +3113,15 @@
# For each suite:
# 1. Copy the files to the many suite output directories.
-# And for test config files, we'll check the .xml is well-formed before copy.
# 2. Add all the files to each suite's dependent files list.
# 3. Do the dependency addition to my_all_targets
-# Requires for each suite: use my_compat_dist_config_$(suite) to define the test config.
-# and use my_compat_dist_$(suite) to define the others.
+# Requires for each suite: my_compat_dist_$(suite) to be defined.
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval COMPATIBILITY.$(suite).FILES := \
- $$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
- $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f))))) \
+ $$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))))) \
$(eval $(my_all_targets) : $(call copy-many-files, \
- $(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))) \
- $(call copy-many-xml-files-checked, \
- $(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_config_$(suite))))))
+ $(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))))
endef
###########################################################
@@ -3508,10 +3475,18 @@
$(if $(call has-system-sdk-version,$(1)),$(patsubst system_%,%,$(1)),$(1)))
endef
-# Convert to lower case without requiring a shell, which isn't cacheable.
+###########################################################
+## Convert to lower case without requiring a shell, which isn't cacheable.
+##
+## $(1): string
+###########################################################
to-lower=$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
-# Convert to upper case without requiring a shell, which isn't cacheable.
+###########################################################
+## Convert to upper case without requiring a shell, which isn't cacheable.
+##
+## $(1): string
+###########################################################
to-upper=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
# Sanity-check to-lower and to-upper
@@ -3528,3 +3503,40 @@
lower :=
upper :=
+
+###########################################################
+## Verify module name meets character requirements:
+## a-z A-Z 0-9
+## _.+-=,@~
+##
+## This is a subset of bazel's target name restrictions:
+## https://docs.bazel.build/versions/master/build-ref.html#name
+###########################################################
+define verify-module-name
+$(if $(filter-out $(LOCAL_MODULE),$(subst /,,$(LOCAL_MODULE))), \
+ $(call pretty-warning,Module name contains a /$(comma) use LOCAL_MODULE_STEM and LOCAL_MODULE_RELATIVE_PATH instead)) \
+$(if $(call _invalid-name-chars,$(LOCAL_MODULE)), \
+ $(call pretty-error,Invalid characters in module name: $(call _invalid-name-chars,$(LOCAL_MODULE))))
+endef
+define _invalid-name-chars
+$(subst _,,$(subst .,,$(subst +,,$(subst -,,$(subst =,,$(subst $(comma),,$(subst @,,$(subst ~,,$(subst 0,,$(subst 1,,$(subst 2,,$(subst 3,,$(subst 4,,$(subst 5,,$(subst 6,,$(subst 7,,$(subst 8,,$(subst 9,,$(subst a,,$(subst b,,$(subst c,,$(subst d,,$(subst e,,$(subst f,,$(subst g,,$(subst h,,$(subst i,,$(subst j,,$(subst k,,$(subst l,,$(subst m,,$(subst n,,$(subst o,,$(subst p,,$(subst q,,$(subst r,,$(subst s,,$(subst t,,$(subst u,,$(subst v,,$(subst w,,$(subst x,,$(subst y,,$(subst z,,$(call to-lower,$(1))))))))))))))))))))))))))))))))))))))))))))))
+endef
+.KATI_READONLY := verify-module-name _invalid-name-chars
+
+###########################################################
+## Verify module stem meets character requirements:
+## a-z A-Z 0-9
+## _.+-=,@~
+##
+## This is a subset of bazel's target name restrictions:
+## https://docs.bazel.build/versions/master/build-ref.html#name
+##
+## $(1): The module stem variable to check
+###########################################################
+define verify-module-stem
+$(if $(filter-out $($(1)),$(subst /,,$($(1)))), \
+ $(call pretty-warning,Module stem \($(1)\) contains a /$(comma) use LOCAL_MODULE_RELATIVE_PATH instead)) \
+$(if $(call _invalid-name-chars,$($(1))), \
+ $(call pretty-error,Invalid characters in module stem \($(1)\): $(call _invalid-name-chars,$($(1)))))
+endef
+.KATI_READONLY := verify-module-stem
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 64ad200..b64155c 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -100,6 +100,9 @@
my_use_profile_for_boot_image := true
endif
endif
+ifeq (,$(strip $(LIBART_TARGET_BOOT_DEX_FILES)))
+my_use_profile_for_boot_image := false
+endif
ifeq (true,$(my_use_profile_for_boot_image))
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 693a0e2..939af33 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -117,7 +117,25 @@
endif
endif
-$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+ifeq ($(my_use_clang_lld),true)
+ # b/80093681: GNU strip and objcopy --{add,remove}-section have bug in handling
+ # GNU_RELRO segment of files lnked by clang lld; so they are replaced
+ # by llvm-strip and llvm-objcopy here.
+ $(strip_output): PRIVATE_OBJCOPY_ADD_SECTION := $(LLVM_OBJCOPY)
+ $(strip_output): PRIVATE_STRIP := $(LLVM_STRIP)
+ $(strip_output): PRIVATE_STRIP_O_FLAG :=
+ # GNU strip keeps .ARM.attributes section even with -strip-all,
+ # so here pass -keep=.ARM.attributes to llvm-strip.
+ $(strip_output): PRIVATE_STRIP_ALL_FLAGS := -strip-all -keep=.ARM.attributes
+else
+ $(strip_output): PRIVATE_OBJCOPY_ADD_SECTION := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
+ $(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+ $(strip_output): PRIVATE_STRIP_O_FLAG := -o
+ $(strip_output): PRIVATE_STRIP_ALL_FLAGS := --strip-all
+endif
+# PRIVATE_OBJCOPY is not changed to llvm-objcopy yet.
+# It is used even when my_use_clang_lld is true,
+# because some objcopy flags are not supported by llvm-objcopy yet.
$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
$(strip_output): PRIVATE_NM := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NM)
$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 1ef0ccb..d35f39d 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -33,7 +33,6 @@
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
-full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
@@ -43,7 +42,6 @@
$(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
$(full_classes_combined_jar) \
- $(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(built_dex) \
@@ -158,22 +156,6 @@
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
-ifneq ($(USE_D8_DESUGAR),true)
-my_desugaring :=
-ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
- $(desugar-classes-jar)
-endif
-else
-my_desugaring :=
-endif
-
-ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_jar)
-endif
-
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
@@ -184,12 +166,8 @@
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) $(ZIP2ZIP)
-ifneq ($(USE_D8_DESUGAR),true)
+$(built_dex): $(full_classes_jar) $(DX) $(ZIP2ZIP)
$(transform-classes.jar-to-dex)
-else
- $(transform-classes-d8.jar-to-dex)
-endif
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
diff --git a/core/java.mk b/core/java.mk
index 8e5fd1d..19e6377 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -72,7 +72,6 @@
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
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
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
@@ -94,7 +93,6 @@
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
- $(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(full_classes_combined_jar) \
@@ -376,23 +374,7 @@
LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
endif
-ifneq ($(USE_D8_DESUGAR),true)
-my_desugaring :=
-ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(LOCAL_FULL_CLASSES_JACOCO_JAR) $(full_java_header_libs) $(DESUGAR)
- $(desugar-classes-jar)
-endif
-else
-my_desugaring :=
-endif
-
-ifndef my_desugaring
-full_classes_desugar_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
-endif
-
-full_classes_pre_proguard_jar := $(full_classes_desugar_jar)
+full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
# Keep a copy of the jar just before proguard processing.
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
@@ -563,11 +545,7 @@
ifndef my_r8
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
-ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
-else
- $(transform-classes-d8.jar-to-dex)
-endif
endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
diff --git a/core/java_common.mk b/core/java_common.mk
index f4696d7..5dfbc5f 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -237,6 +237,8 @@
full_java_bootclasspath_libs :=
empty_bootclasspath :=
my_system_modules :=
+exported_sdk_libs_files :=
+my_exported_sdk_libs_file :=
ifndef LOCAL_IS_HOST_MODULE
sdk_libs :=
@@ -326,6 +328,14 @@
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
sdk_libs :=
+
+ # Files that contains the names of SDK libraries exported from dependencies. These will be re-exported.
+ # Note: No need to consider LOCAL_*_ANDROID_LIBRARIES and LOCAL_STATIC_JAVA_AAR_LIBRARIES. They are all appended to
+ # LOCAL_*_JAVA_LIBRARIES in java.mk
+ exported_sdk_libs_files := $(call exported-sdk-libs-files,$(LOCAL_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_LIBRARIES))
+ # The file that contains the names of all SDK libraries that this module exports and re-exports
+ my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
+
else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
@@ -362,6 +372,22 @@
endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
+
+# Export the SDK libs. The sdk library names listed in LOCAL_SDK_LIBRARIES are first exported.
+# Then sdk library names exported from dependencies are all re-exported.
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS_FILES := $(exported_sdk_libs_files)
+$(my_exported_sdk_libs_file): PRIVATE_SDK_LIBS := $(sort $(LOCAL_SDK_LIBRARIES))
+$(my_exported_sdk_libs_file): $(exported_sdk_libs_files)
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@ $@.temp
+ $(if $(PRIVATE_SDK_LIBS),\
+ echo $(PRIVATE_SDK_LIBS) | tr ' ' '\n' > $@.temp,\
+ touch $@.temp)
+ $(if $(PRIVATE_EXPORTED_SDK_LIBS_FILES),\
+ cat $(PRIVATE_EXPORTED_SDK_LIBS_FILES) >> $@.temp)
+ $(hide) cat $@.temp | sort -u > $@
+ $(hide) rm -f $@.temp
+
ifdef empty_bootclasspath
ifdef full_java_bootclasspath_libs
$(call pretty-error,internal error: empty_bootclasspath and full_java_bootclasspath_libs should not both be set)
diff --git a/core/main.mk b/core/main.mk
index c1059d7..a2f624c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -889,47 +889,40 @@
# $(2): The initial module name list.
# Returns empty string (maybe with some whitespaces).
define expand-required-modules
-$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
- $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
+$(eval _erm_req := $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED))) \
+$(eval _erm_new_modules := $(sort $(filter-out $($(1)),$(_erm_req))))\
$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
$(call expand-required-modules,$(1),$(_erm_new_modules)))
endef
+# Determines the files a particular product installs.
+# The base list of modules to build for this product is specified
+# by the appropriate product definition file, which was included
+# by product_config.mk.
+# $(1): product makefile
+define product-installed-files
+ $(eval _pif_modules := $(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGES)) \
+ $(if $(BOARD_VNDK_VERSION),$(eval _pif_modules += vndk_package)) \
+ $(eval ### Filter out the overridden packages and executables before doing expansion) \
+ $(eval _pif_overrides := $(foreach p, $(_pif_modules), $(PACKAGES.$(p).OVERRIDES))) \
+ $(eval _pif_overrides += $(foreach m, $(_pif_modules), $(EXECUTABLES.$(m).OVERRIDES))) \
+ $(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \
+ $(eval ### Resolve the :32 :64 module name) \
+ $(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \
+ $(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \
+ $(eval _pif_modules_rest := $(filter-out %:32 %:64,$(_pif_modules))) \
+ $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
+ $(eval _pif_modules := $(call get-32-bit-modules-if-we-can, $(_pif_modules_32))) \
+ $(eval _pif_modules += $(_pif_modules_64)) \
+ $(eval ### For the rest we add both) \
+ $(eval _pif_modules += $(call get-32-bit-modules, $(_pif_modules_rest))) \
+ $(eval _pif_modules += $(_pif_modules_rest)) \
+ $(call expand-required-modules,_pif_modules,$(_pif_modules)) \
+ $(call module-installed-files, $(_pif_modules))
+endef
+
ifdef FULL_BUILD
- # The base list of modules to build for this product is specified
- # by the appropriate product definition file, which was included
- # by product_config.mk.
- product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
-ifdef BOARD_VNDK_VERSION
- product_MODULES += vndk_package
-endif
- # Filter out the overridden packages before doing expansion
- product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
- $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
- # Filter out executables as well
- product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
- $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
-
- # Resolve the :32 :64 module name
- modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
- modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
- modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
- # Note for 32-bit product, $(modules_32) and $(modules_64) will be
- # added as their original module names.
- product_MODULES := $(call get-32-bit-modules-if-we-can, $(modules_32))
- product_MODULES += $(modules_64)
- # For the rest we add both
- product_MODULES += $(call get-32-bit-modules, $(modules_rest))
- product_MODULES += $(modules_rest)
-
- $(call expand-required-modules,product_MODULES,$(product_MODULES))
-
- product_FILES := $(call module-installed-files, $(product_MODULES))
- ifeq (0,1)
- $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
- $(foreach p,$(product_FILES),$(info : $(p)))
- $(error done)
- endif
+ product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
@@ -938,6 +931,59 @@
product_FILES :=
endif
+# Transforms paths relative to PRODUCT_OUT to absolute paths.
+# $(1): list of relative paths
+# $(2): optional suffix to append to paths
+define resolve-product-relative-paths
+ $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),\
+ $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),\
+ $(foreach p,$(1),$(PRODUCT_OUT)/$(p)$(2))))
+endef
+
+# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
+# $(1): list of files to print
+# $(2): heading to print on failure
+define maybe-print-list-and-error
+$(if $(strip $(1)), \
+ $(warning $(2)) \
+ $(info Offending entries:) \
+ $(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
+ $(error Build failed) \
+)
+endef
+
+# Verify the artifact path requirements made by included products.
+$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
+ $(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
+ $(eval ### Verify that the product only produces files inside its path requirements.) \
+ $(eval whitelist := $(PRODUCTS.$(makefile).ARTIFACT_PATH_WHITELIST)) \
+ $(eval path_patterns := $(call resolve-product-relative-paths,$(requirements),%)) \
+ $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
+ $(eval files := $(call product-installed-files, $(makefile))) \
+ $(eval files := $(filter-out $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%,$(files))) \
+ $(eval offending_files := $(filter-out $(path_patterns) $(whitelist_patterns),$(files))) \
+ $(call maybe-print-list-and-error,$(offending_files),$(makefile) produces files outside its artifact path requirement.) \
+ $(eval unused_whitelist := $(filter-out $(files),$(whitelist_patterns))) \
+ $(call maybe-print-list-and-error,$(unused_whitelist),$(makefile) includes redundant whitelist entries in its artifact path requirement.) \
+ $(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS),\
+ $(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_FILES))) \
+ $(eval whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST)) \
+ $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
+ $(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \
+ $(eval offending_files := $(filter-out $(whitelist_patterns),$(files_in_requirement))) \
+ $(call maybe-print-list-and-error,$(offending_files),$(INTERNAL_PRODUCT) produces files inside $(makefile)s artifact path requirement.) \
+ $(eval unused_whitelist := $(filter-out $(extra_files),$(whitelist_patterns))) \
+ $(call maybe-print-list-and-error,$(unused_whitelist),$(INTERNAL_PRODUCT) includes redundant artifact path requirement whitelist entries.) \
+ ) \
+)
+
+ifeq (0,1)
+ $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
+ $(foreach p,$(product_FILES),$(info : $(p)))
+ $(error done)
+endif
+
eng_MODULES := $(sort \
$(call get-tagged-modules,eng) \
$(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG)) \
@@ -1113,21 +1159,25 @@
# Build files and then package it into the rom formats
.PHONY: droidcore
droidcore: files \
- systemimage \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(INSTALLED_VBMETAIMAGE_TARGET) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_CACHEIMAGE_TARGET) \
- $(INSTALLED_BPTIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
- $(INSTALLED_FILES_FILE) \
- $(INSTALLED_FILES_FILE_VENDOR) \
- $(INSTALLED_FILES_FILE_PRODUCT) \
- $(INSTALLED_FILES_FILE_SYSTEMOTHER) \
- soong_docs
+ systemimage \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(INSTALLED_VBMETAIMAGE_TARGET) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_CACHEIMAGE_TARGET) \
+ $(INSTALLED_BPTIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
+ $(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_JSON) \
+ $(INSTALLED_FILES_FILE_VENDOR) \
+ $(INSTALLED_FILES_JSON_VENDOR) \
+ $(INSTALLED_FILES_FILE_PRODUCT) \
+ $(INSTALLED_FILES_JSON_PRODUCT) \
+ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \
+ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \
+ soong_docs
# dist_files only for putting your library into the dist directory with a full build.
.PHONY: dist_files
@@ -1190,9 +1240,13 @@
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
$(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_JSON) \
$(INSTALLED_FILES_FILE_VENDOR) \
+ $(INSTALLED_FILES_JSON_VENDOR) \
$(INSTALLED_FILES_FILE_PRODUCT) \
+ $(INSTALLED_FILES_JSON_PRODUCT) \
$(INSTALLED_FILES_FILE_SYSTEMOTHER) \
+ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 9dce2b3..08778c5 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -40,6 +40,10 @@
ifdef notice_file
+ifdef my_register_name
+ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
+endif
+
# This relies on the name of the directory in PRODUCT_OUT matching where
# it's installed on the target - i.e. system, data, etc. This does
# not work for root and isn't exact, but it's probably good enough for
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 6a9916a..eab34cd 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -581,15 +581,19 @@
# This is .aar file, archive of classes.jar and Android resources.
my_src_jar := $(intermediates.COMMON)/aar/classes.jar
my_src_proguard_options := $(intermediates.COMMON)/aar/proguard.txt
+my_src_android_manifest := $(intermediates.COMMON)/aar/AndroidManifest.xml
$(my_src_jar) : .KATI_IMPLICIT_OUTPUTS := $(my_src_proguard_options)
+$(my_src_jar) : .KATI_IMPLICIT_OUTPUTS += $(my_src_android_manifest)
$(my_src_jar) : $(my_src_aar)
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res
$(hide) unzip -qo -d $(dir $@) $<
# Make sure the extracted classes.jar has a new timestamp.
$(hide) touch $@
- # Make sure the proguard file exists and has a new timestamp.
+ # Make sure the proguard and AndroidManifest.xml files exist
+ # and have a new timestamp.
$(hide) touch $(dir $@)/proguard.txt
+ $(hide) touch $(dir $@)/AndroidManifest.xml
endif
@@ -641,7 +645,7 @@
# We needed only very few PRIVATE variables and aapt2.mk input variables. Reset the unnecessary ones.
$(my_res_package): PRIVATE_AAPT2_CFLAGS :=
$(my_res_package): PRIVATE_AAPT_FLAGS := --static-lib --no-static-lib-packages --auto-add-overlay
-$(my_res_package): PRIVATE_ANDROID_MANIFEST := $(intermediates.COMMON)/aar/AndroidManifest.xml
+$(my_res_package): PRIVATE_ANDROID_MANIFEST := $(my_src_android_manifest)
$(my_res_package): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
$(my_res_package): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
$(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE :=
@@ -651,6 +655,7 @@
$(my_res_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS :=
$(my_res_package) : $(framework_res_package_export)
+$(my_res_package) : $(my_src_android_manifest)
full_android_manifest :=
my_res_resources :=
@@ -669,6 +674,15 @@
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
+my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES)
+$(my_exported_sdk_libs_file):
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ $(if $(PRIATE_EXPORTED_SDK_LIBS),\
+ $(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
+ $(hide) touch $@)
+
endif # ! prebuilt_module_is_dex_javalib
endif # LOCAL_IS_HOST_MODULE is not set
diff --git a/core/product-graph.mk b/core/product-graph.mk
index 576d14d..4133bd9 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -18,7 +18,7 @@
define gather-all-products
$(sort $(foreach p, \
$(eval _all_products_visited := )
- $(call all-products-inner, $(ALL_PRODUCTS)) \
+ $(call all-products-inner, $(PARENT_PRODUCT_FILES)) \
, $(if $(strip $(p)),$(strip $(p)),)) \
)
endef
@@ -49,7 +49,7 @@
endif
endif
-really_all_products := $(call gather-all-products)
+all_products := $(call gather-all-products)
open_parethesis := (
close_parenthesis := )
@@ -66,7 +66,7 @@
endef
-$(products_graph): PRIVATE_PRODUCTS := $(really_all_products)
+$(products_graph): PRIVATE_PRODUCTS := $(all_products)
$(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list)
$(products_graph): $(this_makefile)
@@ -130,7 +130,7 @@
endef
product_debug_files:=
-$(foreach p,$(really_all_products), \
+$(foreach p,$(all_products), \
$(eval $(call transform-product-debug, $(p))) \
$(eval product_debug_files += $(call product-debug-filename, $(p))) \
)
diff --git a/core/product.mk b/core/product.mk
index 95d169c..f22a3e5 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -198,6 +198,8 @@
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
PRODUCT_USE_LOGICAL_PARTITIONS \
+ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \
+ PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \
define dump-product
$(info ==== $(1) ====)\
@@ -213,10 +215,14 @@
#
# $(1): product to inherit
#
-# Does three things:
+# To be called from product makefiles, and is later evaluated during the import-nodes
+# call below. It does three things:
# 1. Inherits all of the variables from $1.
# 2. Records the inheritance in the .INHERITS_FROM variable
-# 3. Records that we've visited this node, in ALL_PRODUCTS
+# 3. Records the calling makefile in PARENT_PRODUCT_FILES
+#
+# (2) and (3) can be used together to reconstruct the include hierarchy
+# See e.g. product-graph.mk for an example of this.
#
define inherit-product
$(if $(findstring ../,$(1)),\
@@ -224,13 +230,22 @@
$(eval np := $(strip $(1))))\
$(foreach v,$(_product_var_list), \
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
- $(eval inherit_var := \
- PRODUCTS.$(strip $(word 1,$(_include_stack))).INHERITS_FROM) \
+ $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+ $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
$(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
- $(eval inherit_var:=) \
- $(eval ALL_PRODUCTS := $(sort $(ALL_PRODUCTS) $(word 1,$(_include_stack))))
+ $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk)))
endef
+# Specifies a number of path prefixes, relative to PRODUCT_OUT, where the
+# product makefile hierarchy rooted in the current node places its artifacts.
+# Creating artifacts outside the specified paths will cause a build-time error.
+define require-artifacts-in-path
+ $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+ $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \
+ $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_WHITELIST := $(strip $(2))) \
+ $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \
+ $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
+endef
#
# Do inherit-product only if $(1) exists
diff --git a/core/product_config.mk b/core/product_config.mk
index 3a77d0b..8425b09 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -234,6 +234,12 @@
$(call import-products, $(current_product_makefile))
endif # Import all or just the current product makefile
+# Import all the products that have made artifact path requirements, so that we can verify
+# the artifacts they produce.
+$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
+ $(if $(filter-out $(makefile),$(PRODUCTS)),$(eval $(call import-products,$(makefile))))\
+)
+
# Sanity check
$(check-all-products)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 3f1fb66..355f414 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -102,7 +102,7 @@
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
-$(call add_json_bool, UseClangLld, $(filter 1 true,$(USE_CLANG_LLD)))
+$(call add_json_bool, UseClangLld, $(call invert_bool,$(filter 0 false,$(USE_CLANG_LLD))))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 58735cd..eeaab31 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -144,3 +144,13 @@
my_common := COMMON
include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE
+
+# LOCAL_EXPORT_SDK_LIBRARIES set by soong is written to exported-sdk-libs file
+my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES)
+$(my_exported_sdk_libs_file):
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ $(if $(PRIVATE_EXPORTED_SDK_LIBS),\
+ $(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
+ $(hide) touch $@)
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index b9133df..ba48df7 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -36,38 +36,38 @@
)
endef
-# Returns list of file paths of the intermediate objs
+# Returns list of src:dest paths of the intermediate objs
#
# Args:
# $(1): list of module and filename pairs (e.g., ld.config.txt:ld.config.27.txt ...)
-# $(2): target class (e.g., SHARED_LIBRARIES, STATIC_LIBRARIES, ETC)
-# $(3): if not empty, evaluates for TARGET_2ND_ARCH
+# $(2): if not empty, evaluates for TARGET_2ND_ARCH
define paths-of-intermediates
$(strip \
$(foreach pair,$(1), \
- $(eval split_pair := $(subst :,$(space),$(pair))) \
- $(eval module := $(word 1,$(split_pair))) \
- $(eval filename := $(word 2,$(split_pair))) \
- $(eval dir := $(call intermediates-dir-for,$(2),$(module),,,$(3))) \
- $(call append-path,$(dir),$(filename)) \
+ $(eval module := $(call word-colon,1,$(pair))$(if $(2),$(TARGET_2ND_ARCH_MODULE_SUFFIX))) \
+ $(eval built := $(ALL_MODULES.$(module).BUILT_INSTALLED)) \
+ $(eval filename := $(call word-colon,2,$(pair))) \
+ $(if $(wordlist 2,100,$(built)), \
+ $(error Unable to handle multiple built files ($(module)): $(built))) \
+ $(if $(built),$(call word-colon,1,$(built)):$(filename)) \
) \
)
endef
-# Returns paths of notice files under $(TARGET_OUT_NOTICE_FILES)
+# Returns src:dest list of 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) \
- ) \
-)
+ $(eval notice := $(sort \
+ $(ALL_MODULES.$(lib).NOTICES) \
+ $(if $(TARGET_2ND_ARCH),
+ $(ALL_MODULES.$(lib)$(TARGET_2ND_ARCH_MODULE_SUFFIX).NOTICES)))) \
+ $(if $(wordlist 2,100,$(notice)), \
+ $(error Unable to handle multiple notice files ($(lib)): $(notice))) \
+ $(if $(notice),$(notice):$(subst .vendor,,$(lib)).so.txt)))
endef
# If in the future libclang_rt.ubsan* is removed from the VNDK-core list,
@@ -103,34 +103,37 @@
#######################################
# vndkcore.libraries.txt
vndkcore.libraries.txt := $(vndk_snapshot_configs_out)/vndkcore.libraries.txt
-$(vndkcore.libraries.txt): $(vndk_core_libs)
+$(vndkcore.libraries.txt): PRIVATE_LIBS := $(vndk_core_libs)
+$(vndkcore.libraries.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
#######################################
# vndkprivate.libraries.txt
vndkprivate.libraries.txt := $(vndk_snapshot_configs_out)/vndkprivate.libraries.txt
-$(vndkprivate.libraries.txt): $(vndk_private_libs)
+$(vndkprivate.libraries.txt): PRIVATE_LIBS := $(vndk_private_libs)
+$(vndkprivate.libraries.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
#######################################
# module_paths.txt
module_paths.txt := $(vndk_snapshot_configs_out)/module_paths.txt
-$(module_paths.txt): $(vndk_snapshot_libs)
+$(module_paths.txt): PRIVATE_LIBS := $(vndk_snapshot_libs)
+$(module_paths.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
vndk_snapshot_configs := \
@@ -151,70 +154,76 @@
$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_OUT := $(vndk_snapshot_out)
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so))
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT := $(vndk_lib_dir)/shared/vndk-core
-$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(lib).so),SHARED_LIBRARIES)
+$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so))
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT := $(vndk_lib_dir)/shared/vndk-sp
-$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(lib).so),SHARED_LIBRARIES)
+$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
+ $(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt)))) \
+ $(foreach config,$(vndk_snapshot_configs),$(config):$(notdir $(config)))
$(vndk_snapshot_zip): PRIVATE_CONFIGS_OUT := $(vndk_snapshot_variant)/configs
-$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
- $(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt))),ETC) \
- $(vndk_snapshot_configs)
+$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+notices := $(call paths-of-notice-files,$(vndk_core_libs) $(vndk_sp_libs))
$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_OUT := $(vndk_snapshot_variant)/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)
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := $(notices)
+$(vndk_snapshot_zip): $(foreach n,$(notices),$(call word-colon,1,$(n)))
+notices :=
ifdef TARGET_2ND_ARCH
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-core
-$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(lib).so),SHARED_LIBRARIES,true)
+$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-sp
-$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(lib).so),SHARED_LIBRARIES,true)
+$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
endif
# Args
# $(1): destination directory
-# $(2): list of files to copy
-$(vndk_snapshot_zip): private-copy-vndk-intermediates = \
+# $(2): list of files (src:dest) to copy
+$(vndk_snapshot_zip): private-copy-intermediates = \
$(if $(2),$(strip \
- @mkdir -p $(1); \
+ @mkdir -p $(1) && \
$(foreach file,$(2), \
- if [ -e $(file) ]; then \
- cp -p $(file) $(call append-path,$(1),$(subst .vendor,,$(notdir $(file)))); \
- fi; \
+ cp $(call word-colon,1,$(file)) $(call append-path,$(1),$(call word-colon,2,$(file))) && \
) \
+ true \
))
-vndk_snapshot_dependencies := \
- $(vndk_snapshot_libs) \
- $(vndk_prebuilt_txts) \
- $(vndk_snapshot_configs)
-$(vndk_snapshot_zip): $(vndk_snapshot_dependencies) $(SOONG_ZIP)
+$(vndk_snapshot_zip): $(SOONG_ZIP)
@echo 'Generating VNDK snapshot: $@'
@rm -f $@
@rm -rf $(PRIVATE_VNDK_SNAPSHOT_OUT)
@mkdir -p $(PRIVATE_VNDK_SNAPSHOT_OUT)
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_CORE_OUT),$(PRIVATE_VNDK_CORE_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_NOTICE_FILES_OUT),$(PRIVATE_NOTICE_FILES_INTERMEDIATES))
ifdef TARGET_2ND_ARCH
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_CORE_OUT_2ND),$(PRIVATE_VNDK_CORE_INTERMEDIATES_2ND))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_SP_OUT_2ND),$(PRIVATE_VNDK_SP_INTERMEDIATES_2ND))
endif
$(hide) $(SOONG_ZIP) -o $@ -C $(PRIVATE_VNDK_SNAPSHOT_OUT) -D $(PRIVATE_VNDK_SNAPSHOT_OUT)
@@ -240,7 +249,6 @@
binder :=
vndk_lib_dir :=
vndk_lib_dir_2nd :=
-vndk_snapshot_dependencies :=
else # BOARD_VNDK_RUNTIME_DISABLE is set to 'true'
error_msg := "CANNOT generate VNDK snapshot. BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'."
diff --git a/core/use_lld_setup.mk b/core/use_lld_setup.mk
index 17a9e27..d00a5d3 100644
--- a/core/use_lld_setup.mk
+++ b/core/use_lld_setup.mk
@@ -4,12 +4,17 @@
## Output variables: my_use_clang_lld
#############################################################
-# Use LLD only if it's not disabled by LOCAL_USE_CLANG_LLD,
-# and enabled by LOCAL_USE_CLANG_LLD or USE_CLANG_LLD.
-my_use_clang_lld := false
-ifeq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
- ifneq (,$(filter 1 true,$(LOCAL_USE_CLANG_LLD) $(USE_CLANG_LLD)))
- my_use_clang_lld := true
+# Use LLD by default.
+# Do not use LLD if LOCAL_USE_CLANG_LLD is false or 0,
+# of if LOCAL_USE_CLANG_LLD is not set and USE_CLANG_LLD is 0 or false.
+my_use_clang_lld := true
+ifneq (,$(LOCAL_USE_CLANG_LLD))
+ ifneq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
+ my_use_clang_lld := false
+ endif
+else
+ ifneq (,$(filter 0 false,$(USE_CLANG_LLD)))
+ my_use_clang_lld := false
endif
endif
diff --git a/envsetup.sh b/envsetup.sh
index bad16e2..12168e1 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -315,6 +315,17 @@
export BUILD_ENV_SEQUENCE_NUMBER=13
}
+# Takes a command name, and check if it's in ENVSETUP_NO_COMPLETION or not.
+function should_add_completion() {
+ local cmd="$1"
+ case :"$ENVSETUP_NO_COMPLETION": in
+ *:"$cmd":*)
+ return 1
+ ;;
+ esac
+ return 0
+}
+
function addcompletions()
{
local T dir f
@@ -329,13 +340,19 @@
return
fi
+ # Completion can be disabled selectively to allow users to use non-standard completion.
+ # e.g.
+ # ENVSETUP_NO_COMPLETION=adb # -> disable adb completion
+ # ENVSETUP_NO_COMPLETION=adb:bit # -> disable adb and bit completion
for f in system/core/adb/adb.bash system/core/fastboot/fastboot.bash; do
- if [ -f $f ]; then
+ if [ -f "$f" ] && should_add_completion $(basename "$f" .bash) ; then
. $f
fi
done
- complete -C "bit --tab" bit
+ if should_add_completion bit ; then
+ complete -C "bit --tab" bit
+ fi
}
function choosetype()
@@ -742,6 +759,7 @@
\cd ..
done
\cd $HERE
+ return 1
}
function mm()
@@ -869,7 +887,7 @@
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1
fi
- local M=$(findmakefile)
+ local M=$(findmakefile || echo $(realpath $PWD)/Android.mk)
# Remove the path to top as the makefilepath needs to be relative
local M=`echo $M|sed 's:'$T'/::'`
local MODULES_IN_PATHS=MODULES-IN-$(dirname ${M})
@@ -974,28 +992,6 @@
fi
}
-function pid()
-{
- local prepend=''
- local append=''
- if [ "$1" = "--exact" ]; then
- prepend=' '
- append='$'
- shift
- fi
- local EXE="$1"
- if [ "$EXE" ] ; then
- local PID=`adb shell ps \
- | tr -d '\r' \
- | \grep "$prepend$EXE$append" \
- | sed -e 's/^[^ ]* *\([0-9]*\).*$/\1/'`
- echo "$PID"
- else
- echo "usage: pid [--exact] <process name>"
- return 255
- fi
-}
-
# coredump_setup - enable core dumps globally for any process
# that has the core-file-size limit set correctly
#
@@ -1082,53 +1078,6 @@
stacks system_server
}
-function stacks()
-{
- if [[ $1 =~ ^[0-9]+$ ]] ; then
- local PID="$1"
- elif [ "$1" ] ; then
- local PIDLIST="$(pid $1)"
- if [[ $PIDLIST =~ ^[0-9]+$ ]] ; then
- local PID="$PIDLIST"
- elif [ "$PIDLIST" ] ; then
- echo "more than one process: $1"
- else
- echo "no such process: $1"
- fi
- else
- echo "usage: stacks [pid|process name]"
- fi
-
- if [ "$PID" ] ; then
- # Determine whether the process is native
- if adb shell ls -l /proc/$PID/exe | grep -q /system/bin/app_process ; then
- # Dump stacks of Dalvik process
- local TRACES=/data/anr/traces.txt
- local ORIG=/data/anr/traces.orig
- local TMP=/data/anr/traces.tmp
-
- # Keep original traces to avoid clobbering
- adb shell mv $TRACES $ORIG
-
- # Make sure we have a usable file
- adb shell touch $TRACES
- adb shell chmod 666 $TRACES
-
- # Dump stacks and wait for dump to finish
- adb shell kill -3 $PID
- adb shell notify $TRACES >/dev/null
-
- # Restore original stacks, and show current output
- adb shell mv $TRACES $TMP
- adb shell mv $ORIG $TRACES
- adb shell cat $TMP
- else
- # Dump stacks of native process
- adb shell debuggerd -b $PID
- fi
- fi
-}
-
# Read the ELF header from /proc/$PID/exe to determine if the process is
# 64-bit.
function is64bit()
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index ee1bde5..812b7e4 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -8,18 +8,31 @@
TARGET_NO_KERNEL := true
TARGET_ARCH := arm
-# Note: we build the platform images for ARMv7-A _without_ NEON.
+# Note: Before Pi, we built the platform images for ARMv7-A _without_ NEON.
#
-# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but
-# emulated NEON code paths typically ends up 2x slower than the normal C code
-# it is supposed to replace (unlike on real devices where it is 2x to 3x
-# faster).
+ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk,$(MAKECMDGOALS)),)
+# DO NOT USE
#
-# What this means is that the platform image will not use NEON code paths
-# that are slower to emulate. On the other hand, it is possible to emulate
-# application code generated with the NDK that uses NEON in the emulator.
+# This architecture variant should NOT be used for 32 bit arm platform
+# builds. It is the lowest common denominator required to build
+# an unbundled application for all supported 32 platforms.
+# cts for 32 bit arm is built using aosp_arm64 product.
#
+# If you are building a 32 bit platform (and not an application),
+# you should set the following as 2nd arch variant:
+#
+# TARGET_ARCH_VARIANT := armv7-a-neon
+#
+# DO NOT USE
TARGET_ARCH_VARIANT := armv7-a
+# DO NOT USE
+else
+# Starting from Pi, System image of aosp_arm products is the new GSI
+# for real devices newly launched for Pi. These devices are usualy not
+# as performant as the mainstream 64-bit devices and the performance
+# provided by NEON is important for them to pass related CTS tests.
+TARGET_ARCH_VARIANT := armv7-a-neon
+endif
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
@@ -56,13 +69,13 @@
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
# GSI is always userdebug and needs a couple of properties taking precedence
# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
endif
BOARD_VNDK_VERSION := current
diff --git a/target/board/generic/sepolicy/OWNERS b/target/board/generic/sepolicy/OWNERS
deleted file mode 100644
index ff29677..0000000
--- a/target/board/generic/sepolicy/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-alanstokes@google.com
-bowgotsai@google.com
-jbires@google.com
-jeffv@google.com
-jgalenson@google.com
-sspatil@google.com
-tomcherry@google.com
-trong@google.com
diff --git a/target/board/generic/sepolicy/adbd.te b/target/board/generic/sepolicy/adbd.te
deleted file mode 100644
index 9546c1a..0000000
--- a/target/board/generic/sepolicy/adbd.te
+++ /dev/null
@@ -1 +0,0 @@
-set_prop(adbd, ctl_mdnsd_prop);
diff --git a/target/board/generic/sepolicy/audioserver.te b/target/board/generic/sepolicy/audioserver.te
deleted file mode 100644
index c3c4a3a..0000000
--- a/target/board/generic/sepolicy/audioserver.te
+++ /dev/null
@@ -1 +0,0 @@
-allow audioserver bootanim:binder call;
diff --git a/target/board/generic/sepolicy/bootanim.te b/target/board/generic/sepolicy/bootanim.te
deleted file mode 100644
index bc84ee7..0000000
--- a/target/board/generic/sepolicy/bootanim.te
+++ /dev/null
@@ -1,9 +0,0 @@
-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;
-
-allow bootanim graphics_device:chr_file { read ioctl open };
-
-typeattribute bootanim system_writes_vendor_properties_violators;
-set_prop(bootanim, qemu_prop)
diff --git a/target/board/generic/sepolicy/cameraserver.te b/target/board/generic/sepolicy/cameraserver.te
deleted file mode 100644
index 6cf5d6a..0000000
--- a/target/board/generic/sepolicy/cameraserver.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow cameraserver system_file:dir { open read };
-allow cameraserver hal_allocator:fd use;
diff --git a/target/board/generic/sepolicy/device.te b/target/board/generic/sepolicy/device.te
deleted file mode 100644
index d129441..0000000
--- a/target/board/generic/sepolicy/device.te
+++ /dev/null
@@ -1 +0,0 @@
-type qemu_device, dev_type, mlstrustedobject;
diff --git a/target/board/generic/sepolicy/domain.te b/target/board/generic/sepolicy/domain.te
deleted file mode 100644
index 3706dba..0000000
--- a/target/board/generic/sepolicy/domain.te
+++ /dev/null
@@ -1,3 +0,0 @@
-allow domain qemu_device:chr_file rw_file_perms;
-
-get_prop(domain, qemu_prop)
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
deleted file mode 100644
index 521c65e..0000000
--- a/target/board/generic/sepolicy/file_contexts
+++ /dev/null
@@ -1,35 +0,0 @@
-# goldfish
-/dev/block/mtdblock0 u:object_r:system_block_device:s0
-/dev/block/mtdblock1 u:object_r:userdata_block_device:s0
-/dev/block/mtdblock2 u:object_r:cache_block_device:s0
-
-# ranchu
-/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/ttyGF[0-9]* u:object_r:serial_device:s0
-/dev/ttyS2 u:object_r:console_device: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)?/hw/gralloc\.goldfish\.default\.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/genfs_contexts b/target/board/generic/sepolicy/genfs_contexts
deleted file mode 100644
index 91cedf1..0000000
--- a/target/board/generic/sepolicy/genfs_contexts
+++ /dev/null
@@ -1,17 +0,0 @@
-# On the emulator, device tree dir is configured to be
-# /sys/bus/platform/devices/ANDR0001:00/properties/android/ which is a symlink to
-# /sys/devices/platform/ANDR0001:00/properties/android/
-genfscon sysfs /devices/platform/ANDR0001:00/properties/android u:object_r:sysfs_dt_firmware_android:s0
-
-# We expect /sys/class/power_supply/* and everything it links to to be labeled
-# as sysfs_batteryinfo.
-genfscon sysfs /devices/platform/GFSH0001:00/power_supply u:object_r:sysfs_batteryinfo:s0
-
-# /sys/class/rtc
-genfscon sysfs /devices/pnp0/00:00/rtc u:object_r:sysfs_rtc:s0
-genfscon sysfs /devices/platform/GFSH0007:00/rtc u:object_r:sysfs_rtc:s0
-
-# /sys/class/net
-genfscon sysfs /devices/pci0000:00/0000:00:08.0/virtio5/net u:object_r:sysfs_net:s0
-genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim0/net u:object_r:sysfs_net:s0
-genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim1/net u:object_r:sysfs_net:s0
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
deleted file mode 100644
index eb913e9..0000000
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ /dev/null
@@ -1,13 +0,0 @@
-# goldfish-setup service: runs init.goldfish.sh script
-type goldfish_setup, domain;
-type goldfish_setup_exec, vendor_file_type, exec_type, file_type;
-
-init_daemon_domain(goldfish_setup)
-
-set_prop(goldfish_setup, debug_prop);
-allow goldfish_setup self:capability { net_admin net_raw };
-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);
-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
deleted file mode 100644
index eb88c36..0000000
--- a/target/board/generic/sepolicy/hal_camera_default.te
+++ /dev/null
@@ -1,3 +0,0 @@
-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_cas_default.te b/target/board/generic/sepolicy/hal_cas_default.te
deleted file mode 100644
index 3ed3bee..0000000
--- a/target/board/generic/sepolicy/hal_cas_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_cas_default);
diff --git a/target/board/generic/sepolicy/hal_drm_default.te b/target/board/generic/sepolicy/hal_drm_default.te
deleted file mode 100644
index 5a07433..0000000
--- a/target/board/generic/sepolicy/hal_drm_default.te
+++ /dev/null
@@ -1,2 +0,0 @@
-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
deleted file mode 100644
index 42d462a..0000000
--- a/target/board/generic/sepolicy/hal_drm_widevine.te
+++ /dev/null
@@ -1,12 +0,0 @@
-# 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_fingerprint_default.te b/target/board/generic/sepolicy/hal_fingerprint_default.te
deleted file mode 100644
index e5b06f1..0000000
--- a/target/board/generic/sepolicy/hal_fingerprint_default.te
+++ /dev/null
@@ -1,5 +0,0 @@
-# TODO(b/36644492): Remove data_between_core_and_vendor_violators once
-# hal_fingerprint no longer directly accesses fingerprintd_data_file.
-typeattribute hal_fingerprint_default data_between_core_and_vendor_violators;
-allow hal_fingerprint_default fingerprintd_data_file:file create_file_perms;
-allow hal_fingerprint_default fingerprintd_data_file:dir rw_dir_perms;
diff --git a/target/board/generic/sepolicy/hal_gnss_default.te b/target/board/generic/sepolicy/hal_gnss_default.te
deleted file mode 100644
index ddc68cc..0000000
--- a/target/board/generic/sepolicy/hal_gnss_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_gnss_default);
diff --git a/target/board/generic/sepolicy/hal_graphics_allocator_default.te b/target/board/generic/sepolicy/hal_graphics_allocator_default.te
deleted file mode 100644
index 0c8e27d..0000000
--- a/target/board/generic/sepolicy/hal_graphics_allocator_default.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow hal_graphics_allocator_default graphics_device:dir search;
-allow hal_graphics_allocator_default graphics_device:chr_file { ioctl open read write };
diff --git a/target/board/generic/sepolicy/hal_graphics_composer_default.te b/target/board/generic/sepolicy/hal_graphics_composer_default.te
deleted file mode 100644
index 40ecda6..0000000
--- a/target/board/generic/sepolicy/hal_graphics_composer_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_graphics_composer_default);
diff --git a/target/board/generic/sepolicy/healthd.te b/target/board/generic/sepolicy/healthd.te
deleted file mode 100644
index ced6704..0000000
--- a/target/board/generic/sepolicy/healthd.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# Allow to read /sys/class/power_supply directory
-allow healthd sysfs:dir r_dir_perms;
diff --git a/target/board/generic/sepolicy/init.te b/target/board/generic/sepolicy/init.te
deleted file mode 100644
index 84a4e8d..0000000
--- a/target/board/generic/sepolicy/init.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow init tmpfs:lnk_file create_file_perms;
-dontaudit init kernel:system module_request;
diff --git a/target/board/generic/sepolicy/logpersist.te b/target/board/generic/sepolicy/logpersist.te
deleted file mode 100644
index 3fc0250..0000000
--- a/target/board/generic/sepolicy/logpersist.te
+++ /dev/null
@@ -1,13 +0,0 @@
-# goldfish logcat service: runs logcat -Q in logpersist domain
-
-# See global logcat.te/logpersist.te, only set for eng & userdebug,
-# allow for all builds in a non-conflicting manner.
-
-domain_auto_trans(init, logcat_exec, logpersist)
-
-# Read from logd.
-unix_socket_connect(logpersist, logdr, logd)
-
-# Write to /dev/ttyS2 and /dev/ttyGF2.
-allow logpersist serial_device:chr_file { write open };
-get_prop(logpersist, qemu_cmdline)
diff --git a/target/board/generic/sepolicy/mediacodec.te b/target/board/generic/sepolicy/mediacodec.te
deleted file mode 100644
index acf4e59..0000000
--- a/target/board/generic/sepolicy/mediacodec.te
+++ /dev/null
@@ -1 +0,0 @@
-allow mediacodec system_file:dir { open read };
diff --git a/target/board/generic/sepolicy/netd.te b/target/board/generic/sepolicy/netd.te
deleted file mode 100644
index 09a28b9..0000000
--- a/target/board/generic/sepolicy/netd.te
+++ /dev/null
@@ -1,3 +0,0 @@
-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
deleted file mode 100644
index 3d16f32..0000000
--- a/target/board/generic/sepolicy/priv_app.te
+++ /dev/null
@@ -1,5 +0,0 @@
-#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/property.te b/target/board/generic/sepolicy/property.te
deleted file mode 100644
index 56e02ef..0000000
--- a/target/board/generic/sepolicy/property.te
+++ /dev/null
@@ -1,3 +0,0 @@
-type qemu_prop, property_type;
-type qemu_cmdline, property_type;
-type radio_noril_prop, property_type;
diff --git a/target/board/generic/sepolicy/property_contexts b/target/board/generic/sepolicy/property_contexts
deleted file mode 100644
index 3a61b6b..0000000
--- a/target/board/generic/sepolicy/property_contexts
+++ /dev/null
@@ -1,5 +0,0 @@
-qemu. u:object_r:qemu_prop:s0
-qemu.cmdline u:object_r:qemu_cmdline:s0
-ro.emu. u:object_r:qemu_prop:s0
-ro.emulator. u:object_r:qemu_prop:s0
-ro.radio.noril u:object_r:radio_noril_prop:s0
diff --git a/target/board/generic/sepolicy/qemu_props.te b/target/board/generic/sepolicy/qemu_props.te
deleted file mode 100644
index 0f5ec8c..0000000
--- a/target/board/generic/sepolicy/qemu_props.te
+++ /dev/null
@@ -1,9 +0,0 @@
-# qemu-props service: Sets system properties on boot.
-type qemu_props, domain;
-type qemu_props_exec, vendor_file_type, exec_type, file_type;
-
-init_daemon_domain(qemu_props)
-
-set_prop(qemu_props, qemu_prop)
-set_prop(qemu_props, dalvik_prop)
-set_prop(qemu_props, qemu_cmdline)
diff --git a/target/board/generic/sepolicy/shell.te b/target/board/generic/sepolicy/shell.te
deleted file mode 100644
index b246d7e..0000000
--- a/target/board/generic/sepolicy/shell.te
+++ /dev/null
@@ -1 +0,0 @@
-allow shell serial_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/surfaceflinger.te b/target/board/generic/sepolicy/surfaceflinger.te
deleted file mode 100644
index 2bba8a7..0000000
--- a/target/board/generic/sepolicy/surfaceflinger.te
+++ /dev/null
@@ -1,5 +0,0 @@
-allow surfaceflinger self:process execmem;
-allow surfaceflinger ashmem_device:chr_file execute;
-
-typeattribute surfaceflinger system_writes_vendor_properties_violators;
-set_prop(surfaceflinger, qemu_prop)
diff --git a/target/board/generic/sepolicy/system_server.te b/target/board/generic/sepolicy/system_server.te
deleted file mode 100644
index dd70b12..0000000
--- a/target/board/generic/sepolicy/system_server.te
+++ /dev/null
@@ -1 +0,0 @@
-get_prop(system_server, radio_noril_prop)
diff --git a/target/board/generic/sepolicy/vold.te b/target/board/generic/sepolicy/vold.te
deleted file mode 100644
index 5f3bdd4..0000000
--- a/target/board/generic/sepolicy/vold.te
+++ /dev/null
@@ -1 +0,0 @@
-dontaudit vold kernel:system module_request;
diff --git a/target/board/generic/sepolicy/zygote.te b/target/board/generic/sepolicy/zygote.te
deleted file mode 100644
index da403b5..0000000
--- a/target/board/generic/sepolicy/zygote.te
+++ /dev/null
@@ -1,5 +0,0 @@
-typeattribute zygote system_writes_vendor_properties_violators;
-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_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index ee4103d..4f6a10c 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -86,12 +86,12 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
# GSI is always userdebug and needs a couple of properties taking precedence
# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
endif
BOARD_VNDK_VERSION := current
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 3760cc4..f50a84c 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -58,9 +58,14 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
- build/target/board/generic/sepolicy \
- build/target/board/generic_x86/sepolicy
+ device/generic/goldfish/sepolicy/common \
+ device/generic/goldfish/sepolicy/x86
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+# GSI is always userdebug and needs a couple of properties taking precedence
+# over those set by the vendor.
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
+endif
BOARD_VNDK_VERSION := current
BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/generic_x86/sepolicy/OWNERS b/target/board/generic_x86/sepolicy/OWNERS
deleted file mode 100644
index ff29677..0000000
--- a/target/board/generic_x86/sepolicy/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-alanstokes@google.com
-bowgotsai@google.com
-jbires@google.com
-jeffv@google.com
-jgalenson@google.com
-sspatil@google.com
-tomcherry@google.com
-trong@google.com
diff --git a/target/board/generic_x86/sepolicy/domain.te b/target/board/generic_x86/sepolicy/domain.te
deleted file mode 100644
index 0bc8d87..0000000
--- a/target/board/generic_x86/sepolicy/domain.te
+++ /dev/null
@@ -1 +0,0 @@
-allow domain cpuctl_device:dir search;
diff --git a/target/board/generic_x86/sepolicy/healthd.te b/target/board/generic_x86/sepolicy/healthd.te
deleted file mode 100644
index 95fa807..0000000
--- a/target/board/generic_x86/sepolicy/healthd.te
+++ /dev/null
@@ -1 +0,0 @@
-allow healthd self:capability sys_nice;
diff --git a/target/board/generic_x86/sepolicy/init.te b/target/board/generic_x86/sepolicy/init.te
deleted file mode 100644
index 3aa81d1..0000000
--- a/target/board/generic_x86/sepolicy/init.te
+++ /dev/null
@@ -1 +0,0 @@
-allow init tmpfs:lnk_file create_file_perms;
diff --git a/target/board/generic_x86/sepolicy/installd.te b/target/board/generic_x86/sepolicy/installd.te
deleted file mode 100644
index 7a558b1..0000000
--- a/target/board/generic_x86/sepolicy/installd.te
+++ /dev/null
@@ -1 +0,0 @@
-allow installd self:process execmem;
diff --git a/target/board/generic_x86/sepolicy/zygote.te b/target/board/generic_x86/sepolicy/zygote.te
deleted file mode 100644
index 93993a4..0000000
--- a/target/board/generic_x86/sepolicy/zygote.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow zygote self:process execmem;
-allow zygote self:capability sys_nice;
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index ec7a51e..fa9f5ec 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -57,9 +57,14 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
- build/target/board/generic/sepolicy \
- build/target/board/generic_x86/sepolicy
+ device/generic/goldfish/sepolicy/common \
+ device/generic/goldfish/sepolicy/x86
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+# GSI is always userdebug and needs a couple of properties taking precedence
+# over those set by the vendor.
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
+endif
BOARD_VNDK_VERSION := current
# Enable A/B update
diff --git a/target/board/generic_x86_arm/BoardConfig.mk b/target/board/generic_x86_arm/BoardConfig.mk
index 131c001..d1e4884 100644
--- a/target/board/generic_x86_arm/BoardConfig.mk
+++ b/target/board/generic_x86_arm/BoardConfig.mk
@@ -31,6 +31,8 @@
# Tell the build system this isn't a typical 64bit+32bit multilib configuration.
TARGET_TRANSLATE_2ND_ARCH := true
+BUILD_BROKEN_DUP_RULES := true
+
# no hardware camera
USE_CAMERA_STUB := true
@@ -61,4 +63,4 @@
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
diff --git a/target/board/gsi_system.prop b/target/board/gsi_system.prop
new file mode 100644
index 0000000..4b54aaf
--- /dev/null
+++ b/target/board/gsi_system.prop
@@ -0,0 +1,5 @@
+# GSI always generate dex pre-opt in system image
+ro.cp_system_other_odex=0
+
+# GSI always disables adb authentication
+ro.adb.secure=0
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 89b66d3..f445a80 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -42,7 +42,6 @@
$(LOCAL_DIR)/aosp_x86_64.mk
else
PRODUCT_MAKEFILES := \
- $(LOCAL_DIR)/core.mk \
$(LOCAL_DIR)/generic.mk \
$(LOCAL_DIR)/generic_x86.mk \
$(LOCAL_DIR)/aosp_arm.mk \
diff --git a/target/product/base.mk b/target/product/base.mk
index 74514af..d65f124 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -18,71 +18,154 @@
PRODUCT_PACKAGES += \
20-dns.conf \
95-configured \
- org.apache.http.legacy \
- appwidget \
- appops \
+ adb \
+ adbd \
+ adbd.recovery \
am \
+ android.hardware.cas@1.0-service \
+ android.hardware.configstore@1.0-service \
+ android.hardware.media.omx@1.0-service \
+ android.hidl.allocator@1.0-service \
+ android.hidl.base-V1.0-java \
+ android.hidl.manager-V1.0-java \
+ android.hidl.memory@1.0-impl \
+ android.hidl.memory@1.0-impl.vendor \
android.policy \
android.test.mock \
android.test.runner \
- app_process \
applypatch \
+ appops \
+ app_process \
+ appwidget \
+ atrace \
audioserver \
+ BackupRestoreConfirmation \
+ bcc \
bit \
+ blank_screen \
blkid \
bmgr \
+ bootanimation \
+ bootstat \
bpfloader \
+ bu \
bugreport \
bugreportz \
cameraserver \
+ charger \
+ cmd \
+ com.android.location.provider \
+ ContactsProvider \
content \
+ crash_dump \
+ CtsShimPrebuilt \
+ CtsShimPrivPrebuilt \
+ debuggerd\
dnsmasq \
+ DefaultContainerService \
+ DownloadProvider \
dpm \
+ dumpstate \
+ dumpsys \
+ e2fsck \
+ ExtServices \
+ ExtShared \
+ fastboot \
framework \
+ framework-res \
framework-sysconfig.xml \
fsck_msdos \
+ gatekeeperd \
+ gralloc.default \
+ healthd \
hid \
+ hwservicemanager \
+ idmap \
ime \
- incidentd \
+ ims-common \
incident \
+ incidentd \
incident_report \
+ init \
+ init.environ.rc \
+ init.rc \
input \
+ installd \
+ ip \
+ ip6tables \
+ iptables \
+ ip-up-vpn \
javax.obex \
+ keystore \
+ ld.config.recovery.txt \
+ ld.config.txt \
+ ld.mc \
+ libaaudio \
libandroid \
libandroid_runtime \
libandroid_servers \
libaudioeffect_jni \
libaudioflinger \
- libaudiopolicyservice \
libaudiopolicymanager \
+ libaudiopolicyservice \
+ libbinder \
libbundlewrapper \
+ libc \
+ libcamera2ndk \
libcamera_client \
libcameraservice \
- libcamera2ndk \
- libdl \
- libdrmclearkeyplugin \
libclearkeycasplugin \
+ libc_malloc_debug \
+ libc_malloc_hooks \
+ libcutils \
+ libdl \
+ libdownmix \
+ libdrmclearkeyplugin \
+ libdrmframework \
+ libdrmframework_jni \
libeffectproxy \
libeffects \
+ libEGL \
+ libETC1 \
+ libFFTEm \
+ libfilterfw \
+ libgatekeeper \
+ libGLESv1_CM \
+ libGLESv2 \
+ libGLESv3 \
+ libgui \
+ libhardware \
+ libhardware_legacy \
libinput \
libinputflinger \
libiprouteutil \
libjnigraphics \
+ libjpeg \
+ libkeystore \
libldnhncr \
+ liblog \
+ libm \
libmedia \
libmedia_jni \
+ libmediandk \
libmediaplayerservice \
libmtp \
libnetd_client \
libnetlink \
libnetutils \
+ libneuralnetworks \
+ libOpenMAXAL \
+ libOpenSLES \
libpdfium \
+ libpixelflinger \
+ libpower \
libradio_metadata \
libreference-ril \
libreverbwrapper \
libril \
librtp_jni \
libsensorservice \
+ libsigchain \
libskia \
libsonic \
libsonivox \
@@ -97,60 +180,124 @@
libstagefright_foundation \
libstagefright_omx \
libstagefright_yuv \
+ libstdc++ \
+ libsurfaceflinger \
+ libsurfaceflinger_ddmconnection \
+ libsysutils \
+ libui \
libusbhost \
libutils \
libvisualizer \
libvorbisidec \
- libmediandk \
libvulkan \
libwifi-service \
+ libwilhelm \
+ linker \
+ linker.recovery \
+ lmkd \
locksettings \
+ logcat \
+ logd \
+ lshal \
+ mdnsd \
media \
media_cmd \
mediadrmserver \
- mediaserver \
- mediametrics \
mediaextractor \
+ mediametrics \
+ media_profiles_V1_0.dtd \
+ MediaProvider \
+ mediaserver \
+ mke2fs \
monkey \
mtpd \
ndc \
netd \
+ org.apache.http.legacy \
perfetto \
ping \
ping6 \
platform.xml \
- privapp-permissions-platform.xml \
- pppd \
pm \
+ pppd \
+ privapp-permissions-platform.xml \
racoon \
+ recovery \
+ resize2fs \
run-as \
schedtest \
+ screencap \
sdcard \
secdiscard \
+ selinux_policy \
+ sensorservice \
+ service \
+ servicemanager \
services \
settings \
+ SettingsProvider \
sgdisk \
+ Shell \
+ shell_and_utilities \
sm \
+ storaged \
+ surfaceflinger \
svc \
tc \
telecom \
+ telephony-common \
+ thermalserviced \
+ tombstoned \
traced \
traced_probes \
+ tune2fs \
+ tzdatacheck \
+ uiautomator \
+ uncrypt \
+ usbd \
vdc \
+ vndservice \
+ vndservicemanager \
+ voip-common \
vold \
- wm
+ WallpaperBackup \
+ wificond \
+ wifi-service \
+ wm \
-# Essential HAL modules
-PRODUCT_PACKAGES += \
- android.hardware.cas@1.0-service \
- android.hardware.media.omx@1.0-service
-# XML schema files
+# VINTF data
PRODUCT_PACKAGES += \
- media_profiles_V1_0.dtd
+ device_compatibility_matrix.xml \
+ device_manifest.xml \
+ framework_manifest.xml \
+ framework_compatibility_matrix.xml \
+
+# AID Generation for
+# <pwd.h> and <grp.h>
+PRODUCT_PACKAGES += \
+ passwd \
+ group \
+ fs_config_files \
+ fs_config_dirs
+
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/init.usb.rc:root/init.usb.rc \
+ system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
+ system/core/rootdir/ueventd.rc:root/ueventd.rc \
+ system/core/rootdir/etc/hosts:system/etc/hosts
+
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
+
+# Ensure that this property is always defined so that bionic_systrace.cpp
+# can rely on it being initially set by init.
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ debug.atrace.tags.enableflags=0
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
+ adb_keys \
iotop \
logpersist.start \
micro_bench \
@@ -161,7 +308,7 @@
# Packages included only for eng/userdebug builds, when building with SANITIZE_TARGET=address
PRODUCT_PACKAGES_DEBUG_ASAN :=
-PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/preloaded-classes:system/etc/preloaded-classes)
# Note: it is acceptable to not have a dirty-image-objects file. In that case, the special bin
@@ -169,4 +316,9 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/dirty-image-objects:system/etc/dirty-image-objects)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk)
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ ro.zygote=zygote32
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
diff --git a/target/product/core.mk b/target/product/core.mk
deleted file mode 100644
index 90e15db..0000000
--- a/target/product/core.mk
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Copyright (C) 2007 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.
-#
-
-# Base configuration for communication-oriented android devices
-# (phones, tablets, etc.). If you want a change to apply to ALMOST ALL
-# devices (including non-phones and non-tablets), modify
-# core_minimal.mk instead. If you care about wearables, you need to modify
-# core_tiny.mk in addition to core_minimal.mk.
-
-PRODUCT_PACKAGES += \
- BasicDreams \
- BlockedNumberProvider \
- BookmarkProvider \
- Browser2 \
- BuiltInPrintService \
- Calendar \
- CalendarProvider \
- CaptivePortalLogin \
- CertInstaller \
- Contacts \
- DeskClock \
- DocumentsUI \
- DownloadProviderUi \
- Email \
- ExactCalculator \
- ExternalStorageProvider \
- FusedLocation \
- InputDevices \
- KeyChain \
- Keyguard \
- LatinIME \
- Launcher2 \
- ManagedProvisioning \
- MtpDocumentsProvider \
- PacProcessor \
- PrintSpooler \
- PrintRecommendationService \
- ProxyHandler \
- QuickSearchBox \
- Settings \
- SharedStorageBackup \
- StorageManager \
- Telecom \
- TeleService \
- Traceur \
- VpnDialogs \
- vr \
- MmsService
-
-# The set of packages whose code can be loaded by the system server.
-PRODUCT_SYSTEM_SERVER_APPS += \
- FusedLocation \
- InputDevices \
- KeyChain \
- Telecom \
-
-# The set of packages we want to force 'speed' compilation on.
-PRODUCT_DEXPREOPT_SPEED_APPS += \
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 7dc0010..575bd60 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -13,53 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# Note that components added here will be also shared in PDK. Components
-# that should not be in PDK should be added in lower level like core.mk.
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=OnTheHunt.ogg \
ro.config.alarm_alert=Alarm_Classic.ogg
PRODUCT_PACKAGES += \
- ContactsProvider \
- DefaultContainerService \
Home \
TelephonyProvider \
UserDictionaryProvider \
- atrace \
libandroidfw \
- libaudiopreprocessing \
libaudioutils \
- libfilterpack_imageproc \
- libgabi++ \
libmdnssd \
libnfc_ndef \
libpowermanager \
libspeexresampler \
- libstagefright_soft_aacdec \
- libstagefright_soft_aacenc \
- libstagefright_soft_amrdec \
- libstagefright_soft_amrnbenc \
- libstagefright_soft_amrwbenc \
- libstagefright_soft_avcdec \
- libstagefright_soft_avcenc \
- libstagefright_soft_flacdec \
- libstagefright_soft_flacenc \
- libstagefright_soft_g711dec \
- libstagefright_soft_gsmdec \
- libstagefright_soft_hevcdec \
- libstagefright_soft_mp3dec \
- libstagefright_soft_mpeg2dec \
- libstagefright_soft_mpeg4dec \
- libstagefright_soft_mpeg4enc \
- libstagefright_soft_opusdec \
- libstagefright_soft_rawdec \
- libstagefright_soft_vorbisdec \
- libstagefright_soft_vpxdec \
- libstagefright_soft_vpxenc \
libvariablespeed \
libwebrtc_audio_preprocessing \
- mdnsd \
- requestsync \
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 8797248..baa297c 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -16,84 +16,57 @@
# Base configuration for most consumer android devices. Do not put
# things that are specific to communication devices (phones, tables,
-# etc.) here -- for that, use core.mk.
+# etc.) here -- for that, use generic_no_telephony.mk.
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := core
PRODUCT_PACKAGES += \
- BackupRestoreConfirmation \
- CompanionDeviceManager \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
- DownloadProvider \
- ExtShared \
- ExtServices \
- HTMLViewer \
- MediaProvider \
- PackageInstaller \
- SettingsProvider \
- Shell \
- StatementService \
- WallpaperBackup \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java \
- bcc \
- bu \
com.android.future.usb.accessory \
- com.android.location.provider \
- com.android.location.provider.xml \
+ com.android.mediadrm.signer \
com.android.media.remotedisplay \
com.android.media.remotedisplay.xml \
- com.android.mediadrm.signer \
- com.android.mediadrm.signer.xml \
+ CompanionDeviceManager \
drmserver \
ethernet-service \
- framework-res \
- idmap \
- installd \
- ims-common \
- ip \
- ip-up-vpn \
- ip6tables \
- iptables \
- gatekeeperd \
- keystore \
- ld.config.txt \
- ld.mc \
- libaaudio \
- libOpenMAXAL \
- libOpenSLES \
- libdownmix \
- libdrmframework \
- libdrmframework_jni \
- libfilterfw \
- libkeystore \
- libgatekeeper \
- libneuralnetworks \
+ fsck.f2fs \
+ HTMLViewer \
+ libaudiopreprocessing \
+ libfilterpack_imageproc \
+ libgabi++ \
+ libstagefright_soft_aacdec \
+ libstagefright_soft_aacenc \
+ libstagefright_soft_amrdec \
+ libstagefright_soft_amrnbenc \
+ libstagefright_soft_amrwbenc \
+ libstagefright_soft_avcdec \
+ libstagefright_soft_avcenc \
+ libstagefright_soft_flacdec \
+ libstagefright_soft_flacenc \
+ libstagefright_soft_g711dec \
+ libstagefright_soft_gsmdec \
+ libstagefright_soft_hevcdec \
+ libstagefright_soft_mp3dec \
+ libstagefright_soft_mpeg2dec \
+ libstagefright_soft_mpeg4dec \
+ libstagefright_soft_mpeg4enc \
+ libstagefright_soft_opusdec \
+ libstagefright_soft_rawdec \
+ libstagefright_soft_vorbisdec \
+ libstagefright_soft_vpxdec \
+ libstagefright_soft_vpxenc \
libwebviewchromium_loader \
libwebviewchromium_plat_support \
- libwilhelm \
logd \
- mke2fs \
- e2fsck \
- resize2fs \
- tune2fs \
- screencap \
- sensorservice \
- telephony-common \
- uiautomator \
- uncrypt \
+ make_f2fs \
+ PackageInstaller \
+ requestsync \
+ StatementService \
vndk_snapshot_package \
- voip-common \
webview \
webview_zygote \
-# Wifi modules
-PRODUCT_PACKAGES += \
- wifi-service \
- wificond \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml
@@ -132,18 +105,6 @@
SettingsProvider \
WallpaperBackup
-# Adoptable external storage supports both ext4 and f2fs
-PRODUCT_PACKAGES += \
- e2fsck \
- mke2fs \
- fsck.f2fs \
- make_f2fs \
-
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.zygote=zygote32
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
-
PRODUCT_COPY_FILES += \
system/core/rootdir/etc/public.libraries.android.txt:system/etc/public.libraries.txt
@@ -165,5 +126,4 @@
ro.logd.size.stats=64K \
log.tag.stats_log=I
-$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
deleted file mode 100644
index c6bc72c..0000000
--- a/target/product/core_tiny.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# Copyright (C) 2013 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.
-#
-# Tiny configuration for small devices such as wearables. Includes base and embedded.
-# No telephony
-
-PRODUCT_PACKAGES := \
- Bluetooth \
- CalendarProvider \
- ContactsProvider \
- CertInstaller \
- FusedLocation \
- InputDevices
-
-PRODUCT_PACKAGES += \
- clatd \
- clatd.conf \
- pppd
-
-PRODUCT_PACKAGES += \
- audio.primary.default \
- local_time.default \
- power.default
-
-PRODUCT_PACKAGES += \
- BackupRestoreConfirmation \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
- DefaultContainerService \
- ExtShared \
- ExtServices \
- SettingsProvider \
- Shell \
- WallpaperBackup \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java \
- bcc \
- bu \
- com.android.location.provider \
- com.android.location.provider.xml \
- framework-res \
- installd \
- ims-common \
- ip \
- ip-up-vpn \
- ip6tables \
- iptables \
- gatekeeperd \
- keystore \
- ld.config.txt \
- ld.mc \
- libaaudio \
- libOpenMAXAL \
- libOpenSLES \
- libdownmix \
- libfilterfw \
- libgatekeeper \
- libkeystore \
- libwilhelm \
- libdrmframework_jni \
- libdrmframework \
- mke2fs \
- e2fsck \
- resize2fs \
- tune2fs \
- nullwebview \
- screencap \
- sensorservice \
- uiautomator \
- uncrypt \
- telephony-common \
- voip-common \
- logd \
-
-# Wifi modules
-PRODUCT_PACKAGES += \
- wifi-service \
- wificond \
-
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
-endif
-
-# The order matters
-PRODUCT_BOOT_JARS := \
- $(TARGET_CORE_JARS) \
- legacy-test \
- ext \
- framework \
- telephony-common \
- voip-common \
- ims-common \
- nullwebview \
- org.apache.http.legacy.impl \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java
-
-# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
-PRODUCT_SYSTEM_SERVER_JARS := \
- services \
- wifi-service
-
-# The set of packages whose code can be loaded by the system server.
-PRODUCT_SYSTEM_SERVER_APPS += \
- FusedLocation \
- InputDevices \
- SettingsProvider \
- WallpaperBackup \
-
-# The set of packages we want to force 'speed' compilation on.
-PRODUCT_DEXPREOPT_SPEED_APPS := \
-
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.zygote=zygote32
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
-
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.carrier=unknown
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
-$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
-$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
-
-# Overrides
-PRODUCT_BRAND := tiny
-PRODUCT_DEVICE := tiny
-PRODUCT_NAME := core_tiny
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
deleted file mode 100644
index bae5486..0000000
--- a/target/product/embedded.mk
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Copyright (C) 2009 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 is a build configuration for a very minimal build of the
-# Open-Source part of the tree.
-
-PRODUCT_PACKAGES += \
- adb \
- adbd \
- adbd.recovery \
- usbd \
- android.hardware.configstore@1.0-service \
- android.hidl.allocator@1.0-service \
- android.hidl.memory@1.0-impl \
- android.hidl.memory@1.0-impl.vendor \
- atrace \
- blank_screen \
- bootanimation \
- bootstat \
- charger \
- cmd \
- crash_dump \
- debuggerd\
- dumpstate \
- dumpsys \
- fastboot \
- gralloc.default \
- healthd \
- hwservicemanager \
- init \
- init.environ.rc \
- init.rc \
- libEGL \
- libETC1 \
- libFFTEm \
- libGLESv1_CM \
- libGLESv2 \
- libGLESv3 \
- libbinder \
- libc \
- libc_malloc_debug \
- libc_malloc_hooks \
- libcutils \
- libdl \
- libgui \
- libhardware \
- libhardware_legacy \
- libjpeg \
- liblog \
- libm \
- libpixelflinger \
- libpower \
- libsigchain \
- libstdc++ \
- libsurfaceflinger \
- libsurfaceflinger_ddmconnection \
- libsysutils \
- libui \
- libutils \
- linker \
- lmkd \
- logcat \
- lshal \
- recovery \
- service \
- servicemanager \
- shell_and_utilities \
- storaged \
- surfaceflinger \
- thermalserviced \
- tombstoned \
- tzdatacheck \
- vndservice \
- vndservicemanager \
-
-# VINTF data
-PRODUCT_PACKAGES += \
- device_compatibility_matrix.xml \
- device_manifest.xml \
- framework_manifest.xml \
- framework_compatibility_matrix.xml \
-
-# SELinux packages are added as dependencies of the selinux_policy
-# phony package.
-PRODUCT_PACKAGES += \
- selinux_policy \
-
-# AID Generation for
-# <pwd.h> and <grp.h>
-PRODUCT_PACKAGES += \
- passwd \
- group \
- fs_config_files \
- fs_config_dirs
-
-# If there are product-specific adb keys defined, install them on debuggable
-# builds.
-PRODUCT_PACKAGES_DEBUG += \
- adb_keys
-
-# Ensure that this property is always defined so that bionic_systrace.cpp
-# can rely on it being initially set by init.
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
- debug.atrace.tags.enableflags=0
-
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.usb.rc:root/init.usb.rc \
- system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
- system/core/rootdir/ueventd.rc:root/ueventd.rc \
- system/core/rootdir/etc/hosts:system/etc/hosts
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 190a889..5e6957a 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -18,39 +18,80 @@
# It includes the base Android platform.
PRODUCT_PACKAGES := \
+ audio.primary.default \
+ BasicDreams \
+ BlockedNumberProvider \
Bluetooth \
BluetoothMidiService \
+ BookmarkProvider \
+ Browser2 \
+ BuiltInPrintService \
+ Calendar \
+ CalendarProvider \
Camera2 \
+ CaptivePortalLogin \
+ CertInstaller \
+ clatd \
+ clatd.conf \
+ Contacts \
+ DeskClock \
+ DocumentsUI \
+ DownloadProviderUi \
+ EasterEgg \
+ Email \
+ ExactCalculator \
+ ExternalStorageProvider \
+ FusedLocation \
Gallery2 \
+ InputDevices \
+ KeyChain \
+ Keyguard \
+ LatinIME \
+ Launcher3QuickStep \
+ librs_jni \
+ libvideoeditor_core \
+ libvideoeditor_jni \
+ libvideoeditor_osal \
+ libvideoeditorplayer \
+ libvideoeditor_videofilters \
+ local_time.default \
+ ManagedProvisioning \
+ MmsService \
+ MtpDocumentsProvider \
Music \
MusicFX \
NfcNci \
OneTimeInitializer \
+ PacProcessor \
+ power.default \
+ PrintRecommendationService \
+ PrintSpooler \
Provision \
+ ProxyHandler \
+ QuickSearchBox \
+ screenrecord \
+ SecureElement \
+ Settings \
+ SettingsIntelligence \
+ SharedStorageBackup \
+ SimAppDialog \
+ StorageManager \
SystemUI \
SysuiDarkThemeOverlay \
- EasterEgg \
- WallpaperCropper
-
-PRODUCT_PACKAGES += \
- clatd \
- clatd.conf \
- pppd \
- screenrecord
-
-PRODUCT_PACKAGES += \
- librs_jni \
- libvideoeditor_jni \
- libvideoeditor_core \
- libvideoeditor_osal \
- libvideoeditor_videofilters \
- libvideoeditorplayer \
-
-PRODUCT_PACKAGES += \
- audio.primary.default \
- local_time.default \
+ Telecom \
+ TeleService \
+ Traceur \
vibrator.default \
- power.default
+ VpnDialogs \
+ vr \
+ WallpaperCropper \
+
+
+PRODUCT_SYSTEM_SERVER_APPS += \
+ FusedLocation \
+ InputDevices \
+ KeyChain \
+ Telecom \
PRODUCT_COPY_FILES := \
frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf
@@ -68,7 +109,7 @@
$(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)
$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)
# Overrides
PRODUCT_BRAND := generic
diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk
deleted file mode 100644
index b79b8c6..0000000
--- a/target/product/sdk_base.mk
+++ /dev/null
@@ -1,178 +0,0 @@
-#
-# Copyright (C) 2007 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.
-#
-
-PRODUCT_PROPERTY_OVERRIDES :=
-
-PRODUCT_PACKAGES := \
- CellBroadcastReceiver \
- CubeLiveWallpapers \
- CustomLocale \
- Development \
- Dialer \
- EmulatorSmokeTests \
- Gallery2 \
- Launcher3 \
- Camera2 \
- librs_jni \
- libwnndict \
- libWnnEngDic \
- libWnnJpnDic \
- LiveWallpapersPicker \
- Mms \
- Music \
- OpenWnn \
- Protips \
- rild \
- screenrecord \
- SdkSetup \
- SoftKeyboard \
- sqlite3 \
- SystemUI \
- SysuiDarkThemeOverlay \
- EasterEgg \
- WallpaperPicker \
- WidgetPreview
-
-# Define the host tools and libs that are parts of the SDK.
--include sdk/build/product_sdk.mk
--include development/build/product_sdk.mk
-
-# audio libraries.
-PRODUCT_PACKAGES += \
- audio.primary.goldfish \
- audio.r_submix.default \
- local_time.default
-
-# CDD mandates following codecs
-PRODUCT_PACKAGES += \
- libstagefright_soft_aacdec \
- libstagefright_soft_aacenc \
- libstagefright_soft_amrdec \
- libstagefright_soft_amrnbenc \
- libstagefright_soft_amrwbenc \
- libstagefright_soft_avcdec \
- libstagefright_soft_avcenc \
- libstagefright_soft_flacenc \
- libstagefright_soft_g711dec \
- libstagefright_soft_gsmdec \
- libstagefright_soft_hevcdec \
- libstagefright_soft_mp3dec \
- libstagefright_soft_mpeg2dec \
- libstagefright_soft_mpeg4dec \
- libstagefright_soft_mpeg4enc \
- libstagefright_soft_opusdec \
- libstagefright_soft_rawdec \
- libstagefright_soft_vorbisdec \
- libstagefright_soft_vpxdec \
- libstagefright_soft_vpxenc
-
-PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
-
-PRODUCT_COPY_FILES := \
- device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
- device/sample/etc/old-apns-conf.xml:system/etc/old-apns-conf.xml \
- frameworks/base/data/sounds/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
- frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
- frameworks/base/data/sounds/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
- device/generic/goldfish/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
- device/generic/goldfish/camera/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles.xml \
- frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
- frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
- device/generic/goldfish/camera/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
- device/generic/goldfish/camera/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
- device/generic/goldfish/camera/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
- frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
- frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
- frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \
- frameworks/native/data/etc/android.software.autofill.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.autofill.xml \
- frameworks/av/media/libeffects/data/audio_effects.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.conf \
- device/generic/goldfish/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf
-
-include $(SRC_TARGET_DIR)/product/emulator.mk
-
-$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
-$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
-$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
-$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
-$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
-$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
-
-# locale. en_US is both first and in alphabetical order to
-# ensure this is the default locale.
-PRODUCT_LOCALES := \
- en_US \
- ar_EG \
- ar_IL \
- bg_BG \
- ca_ES \
- cs_CZ \
- da_DK \
- de_AT \
- de_CH \
- de_DE \
- de_LI \
- el_GR \
- en_AU \
- en_CA \
- en_GB \
- en_IE \
- en_IN \
- en_NZ \
- en_SG \
- en_US \
- en_ZA \
- es_ES \
- es_US \
- fi_FI \
- fr_BE \
- fr_CA \
- fr_CH \
- fr_FR \
- he_IL \
- hi_IN \
- hr_HR \
- hu_HU \
- id_ID \
- it_CH \
- it_IT \
- ja_JP \
- ko_KR \
- lt_LT \
- lv_LV \
- nb_NO \
- nl_BE \
- nl_NL \
- pl_PL \
- pt_BR \
- pt_PT \
- ro_RO \
- ru_RU \
- sk_SK \
- sl_SI \
- sr_RS \
- sv_SE \
- th_TH \
- tl_PH \
- tr_TR \
- uk_UA \
- vi_VN \
- zh_CN \
- zh_TW
diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk
index 56eb8c7..96f0bfd 100644
--- a/target/product/sdk_phone_arm64.mk
+++ b/target/product/sdk_phone_arm64.mk
@@ -14,31 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib64/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk)
-# 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.
+# Define the host tools and libs that are parts of the SDK.
+$(call inherit-product, sdk/build/product_sdk.mk)
+$(call inherit-product, development/build/product_sdk.mk)
-# 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:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu
-
-$(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)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_armv7.mk b/target/product/sdk_phone_armv7.mk
index 73c42c3..04d8d6a 100644
--- a/target/product/sdk_phone_armv7.mk
+++ b/target/product/sdk_phone_armv7.mk
@@ -14,24 +14,16 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm.mk)
-# 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-64 \
- device/generic/goldfish/fstab.ranchu.arm:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu
+# Define the host tools and libs that are parts of the SDK.
+$(call inherit-product, sdk/build/product_sdk.mk)
+$(call inherit-product, development/build/product_sdk.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
+
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index 32d71eb..abb46ac 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -14,25 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk)
-# 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/4.4/kernel-qemu2:kernel-ranchu-64
+# Define the host tools and libs that are parts of the SDK.
+-include sdk/build/product_sdk.mk
+-include development/build/product_sdk.mk
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index e40ebb5..828b744 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -14,27 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib64/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86_64.mk)
-# 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.
+# Define the host tools and libs that are parts of the SDK.
+-include sdk/build/product_sdk.mk
+-include development/build/product_sdk.mk
-PRODUCT_COPY_FILES += \
- development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
- device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
- prebuilts/qemu-kernel/x86_64/4.4/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)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/vndk/Android.mk b/target/product/vndk/Android.mk
index 768cb80..b9ae116 100644
--- a/target/product/vndk/Android.mk
+++ b/target/product/vndk/Android.mk
@@ -98,8 +98,15 @@
include $(CLEAR_VARS)
LOCAL_MODULE := vndk_snapshot_package
+_binder32 :=
+ifneq ($(TARGET_USES_64_BIT_BINDER),true)
+ifneq ($(TARGET_IS_64_BIT),true)
+_binder32 := _binder32
+endif
+endif
LOCAL_REQUIRED_MODULES := \
- $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH))
+ $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
+_binder32 :=
include $(BUILD_PHONY_PACKAGE)
endif # BOARD_VNDK_VERSION is set
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index 4839578..cd534ec 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -138,13 +138,13 @@
'media_codec': 'mediacodec'
}
- def __init__(self, identifier, value, found):
+ def __init__(self, identifier, value, found, login_shell):
"""
Args:
identifier: The identifier name for a #define <identifier>.
value: The value of the AID, aka the uid.
found (str): The file found in, not required to be specified.
-
+ login_shell (str): The shell field per man (5) passwd file.
Raises:
ValueError: if the friendly name is longer than 31 characters as
that is bionic's internal buffer size for name.
@@ -154,6 +154,8 @@
self.identifier = identifier
self.value = value
self.found = found
+ self.login_shell = login_shell
+
try:
self.normalized_value = str(int(value, 0))
except ValueException:
@@ -171,7 +173,8 @@
return self.identifier == other.identifier \
and self.value == other.value and self.found == other.found \
- and self.normalized_value == other.normalized_value
+ and self.normalized_value == other.normalized_value \
+ and self.login_shell == other.login_shell
@staticmethod
def is_friendly(name):
@@ -336,7 +339,7 @@
ValueError: With message set to indicate the error.
"""
- aid = AID(identifier, value, self._aid_header)
+ aid = AID(identifier, value, self._aid_header, '/system/bin/sh')
# duplicate name
if aid.friendly in self._aid_name_to_value:
@@ -647,7 +650,7 @@
sys.exit(error_message('Found specified but unset "value"'))
try:
- aid = AID(section_name, value, file_name)
+ aid = AID(section_name, value, file_name, '/vendor/bin/sh')
except ValueError as exception:
sys.exit(error_message(exception))
@@ -1280,7 +1283,7 @@
except ValueError as exception:
sys.exit(exception)
- print "%s::%s:%s::/:/system/bin/sh" % (logon, uid, uid)
+ print "%s::%s:%s::/:%s" % (logon, uid, uid, aid.login_shell)
@generator('group')
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 968fd77..a8c821f 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -1517,10 +1517,16 @@
common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
+ # TODO(b/110106408): Remove after properly handling the SHA-1 embedded in
+ # the filename argument in updater code. Prior to that, explicitly list
+ # the SHA-1 of the source image, in case the updater tries to find a
+ # matching backup from /cache. Similarly for the call to
+ # script.ApplyPatch() below.
script.PatchCheck("%s:%s:%d:%s:%d:%s" %
(boot_type, boot_device,
source_boot.size, source_boot.sha1,
- target_boot.size, target_boot.sha1))
+ target_boot.size, target_boot.sha1),
+ source_boot.sha1)
size.append(target_boot.size)
if size:
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index fa62c8f..756bc8a 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -144,28 +144,69 @@
return certmap
+def GetApkFileInfo(filename, compressed_extension):
+ """Returns the APK info based on the given filename.
+
+ Checks if the given filename (with path) looks like an APK file, by taking the
+ compressed extension into consideration.
+
+ Args:
+ filename: Path to the file.
+ compressed_extension: The extension string of compressed APKs (e.g. ".gz"),
+ or None if there's no compressed APKs.
+
+ Returns:
+ (is_apk, is_compressed): is_apk indicates whether the given filename is an
+ APK file. is_compressed indicates whether the APK file is compressed (only
+ meaningful when is_apk is True).
+
+ Raises:
+ AssertionError: On invalid compressed_extension input.
+ """
+ assert compressed_extension is None or compressed_extension.startswith('.'), \
+ "Invalid compressed_extension arg: '{}'".format(compressed_extension)
+
+ compressed_apk_extension = (
+ ".apk" + compressed_extension if compressed_extension else None)
+ is_apk = (filename.endswith(".apk") or
+ (compressed_apk_extension and
+ filename.endswith(compressed_apk_extension)))
+ if not is_apk:
+ return (False, False)
+
+ is_compressed = (compressed_apk_extension and
+ filename.endswith(compressed_apk_extension))
+ return (True, is_compressed)
+
+
def CheckAllApksSigned(input_tf_zip, apk_key_map, compressed_extension):
- """Check that all the APKs we want to sign have keys specified, and
- error out if they don't."""
+ """Checks that all the APKs have keys specified, otherwise errors out.
+
+ Args:
+ input_tf_zip: An open target_files zip file.
+ apk_key_map: A dict of known signing keys key'd by APK names.
+ compressed_extension: The extension string of compressed APKs, such as
+ ".gz", or None if there's no compressed APKs.
+
+ Raises:
+ AssertionError: On finding unknown APKs.
+ """
unknown_apks = []
- compressed_apk_extension = None
- if compressed_extension:
- compressed_apk_extension = ".apk" + compressed_extension
for info in input_tf_zip.infolist():
- if (info.filename.endswith(".apk") or
- (compressed_apk_extension and
- info.filename.endswith(compressed_apk_extension))):
- name = os.path.basename(info.filename)
- if compressed_apk_extension and name.endswith(compressed_apk_extension):
- name = name[:-len(compressed_extension)]
- if name not in apk_key_map:
- unknown_apks.append(name)
- if unknown_apks:
- print("ERROR: no key specified for:\n")
- print(" " + "\n ".join(unknown_apks))
- print("\nUse '-e <apkname>=' to specify a key (which may be an empty "
- "string to not sign this apk).")
- sys.exit(1)
+ (is_apk, is_compressed) = GetApkFileInfo(
+ info.filename, compressed_extension)
+ if not is_apk:
+ continue
+ name = os.path.basename(info.filename)
+ if is_compressed:
+ name = name[:-len(compressed_extension)]
+ if name not in apk_key_map:
+ unknown_apks.append(name)
+
+ assert not unknown_apks, \
+ ("No key specified for:\n {}\n"
+ "Use '-e <apkname>=' to specify a key (which may be an empty string to "
+ "not sign this apk).".format("\n ".join(unknown_apks)))
def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map,
@@ -235,32 +276,23 @@
apk_key_map, key_passwords, platform_api_level,
codename_to_api_level_map,
compressed_extension):
-
- compressed_apk_extension = None
- if compressed_extension:
- compressed_apk_extension = ".apk" + compressed_extension
-
maxsize = max(
[len(os.path.basename(i.filename)) for i in input_tf_zip.infolist()
- if (i.filename.endswith('.apk') or
- (compressed_apk_extension and
- i.filename.endswith(compressed_apk_extension)))])
+ if GetApkFileInfo(i.filename, compressed_extension)[0]])
system_root_image = misc_info.get("system_root_image") == "true"
for info in input_tf_zip.infolist():
- if info.filename.startswith("IMAGES/"):
+ filename = info.filename
+ if filename.startswith("IMAGES/"):
continue
- data = input_tf_zip.read(info.filename)
+ data = input_tf_zip.read(filename)
out_info = copy.copy(info)
+ (is_apk, is_compressed) = GetApkFileInfo(filename, compressed_extension)
# Sign APKs.
- if (info.filename.endswith(".apk") or
- (compressed_apk_extension and
- info.filename.endswith(compressed_apk_extension))):
- is_compressed = (compressed_extension and
- info.filename.endswith(compressed_apk_extension))
- name = os.path.basename(info.filename)
+ if is_apk:
+ name = os.path.basename(filename)
if is_compressed:
name = name[:-len(compressed_extension)]
@@ -276,15 +308,15 @@
common.ZipWriteStr(output_tf_zip, out_info, data)
# System properties.
- elif info.filename in ("SYSTEM/build.prop",
- "VENDOR/build.prop",
- "SYSTEM/etc/prop.default",
- "BOOT/RAMDISK/prop.default",
- "BOOT/RAMDISK/default.prop", # legacy
- "ROOT/default.prop", # legacy
- "RECOVERY/RAMDISK/prop.default",
- "RECOVERY/RAMDISK/default.prop"): # legacy
- print("Rewriting %s:" % (info.filename,))
+ elif filename in ("SYSTEM/build.prop",
+ "VENDOR/build.prop",
+ "SYSTEM/etc/prop.default",
+ "BOOT/RAMDISK/prop.default",
+ "BOOT/RAMDISK/default.prop", # legacy
+ "ROOT/default.prop", # legacy
+ "RECOVERY/RAMDISK/prop.default",
+ "RECOVERY/RAMDISK/default.prop"): # legacy
+ print("Rewriting %s:" % (filename,))
if stat.S_ISLNK(info.external_attr >> 16):
new_data = data
else:
@@ -293,20 +325,20 @@
# Replace the certs in *mac_permissions.xml (there could be multiple, such
# as {system,vendor}/etc/selinux/{plat,nonplat}_mac_permissions.xml).
- elif info.filename.endswith("mac_permissions.xml"):
- print("Rewriting %s with new keys." % (info.filename,))
+ elif filename.endswith("mac_permissions.xml"):
+ print("Rewriting %s with new keys." % (filename,))
new_data = ReplaceCerts(data)
common.ZipWriteStr(output_tf_zip, out_info, new_data)
# Ask add_img_to_target_files to rebuild the recovery patch if needed.
- elif info.filename in ("SYSTEM/recovery-from-boot.p",
- "SYSTEM/etc/recovery.img",
- "SYSTEM/bin/install-recovery.sh"):
+ elif filename in ("SYSTEM/recovery-from-boot.p",
+ "SYSTEM/etc/recovery.img",
+ "SYSTEM/bin/install-recovery.sh"):
OPTIONS.rebuild_recovery = True
# Don't copy OTA keys if we're replacing them.
elif (OPTIONS.replace_ota_keys and
- info.filename in (
+ filename in (
"BOOT/RAMDISK/res/keys",
"BOOT/RAMDISK/etc/update_engine/update-payload-key.pub.pem",
"RECOVERY/RAMDISK/res/keys",
@@ -315,22 +347,21 @@
pass
# Skip META/misc_info.txt since we will write back the new values later.
- elif info.filename == "META/misc_info.txt":
+ elif filename == "META/misc_info.txt":
pass
# Skip verity public key if we will replace it.
elif (OPTIONS.replace_verity_public_key and
- info.filename in ("BOOT/RAMDISK/verity_key",
- "ROOT/verity_key")):
+ filename in ("BOOT/RAMDISK/verity_key",
+ "ROOT/verity_key")):
pass
# Skip verity keyid (for system_root_image use) if we will replace it.
- elif (OPTIONS.replace_verity_keyid and
- info.filename == "BOOT/cmdline"):
+ elif OPTIONS.replace_verity_keyid and filename == "BOOT/cmdline":
pass
# Skip the care_map as we will regenerate the system/vendor images.
- elif info.filename == "META/care_map.txt":
+ elif filename == "META/care_map.txt":
pass
# A non-APK file; copy it verbatim.
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index 26f9e10..71bd259 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -24,7 +24,8 @@
import common
import test_utils
from sign_target_files_apks import (
- EditTags, ReplaceCerts, ReplaceVerityKeyId, RewriteProps)
+ CheckAllApksSigned, EditTags, GetApkFileInfo, ReplaceCerts,
+ ReplaceVerityKeyId, RewriteProps)
class SignTargetFilesApksTest(unittest.TestCase):
@@ -211,3 +212,50 @@
cert2_path[:-9] : 'non-existent',
}
self.assertEqual(output_xml, ReplaceCerts(input_xml))
+
+ def test_CheckAllApksSigned(self):
+ input_file = common.MakeTempFile(suffix='.zip')
+ with zipfile.ZipFile(input_file, 'w') as input_zip:
+ input_zip.writestr('SYSTEM/app/App1.apk', "App1-content")
+ input_zip.writestr('SYSTEM/app/App2.apk.gz', "App2-content")
+
+ apk_key_map = {
+ 'App1.apk' : 'key1',
+ 'App2.apk' : 'key2',
+ 'App3.apk' : 'key3',
+ }
+ with zipfile.ZipFile(input_file) as input_zip:
+ CheckAllApksSigned(input_zip, apk_key_map, None)
+ CheckAllApksSigned(input_zip, apk_key_map, '.gz')
+
+ # 'App2.apk.gz' won't be considered as an APK.
+ CheckAllApksSigned(input_zip, apk_key_map, None)
+ CheckAllApksSigned(input_zip, apk_key_map, '.xz')
+
+ del apk_key_map['App2.apk']
+ self.assertRaises(
+ AssertionError, CheckAllApksSigned, input_zip, apk_key_map, '.gz')
+
+ def test_GetApkFileInfo(self):
+ (is_apk, is_compressed) = GetApkFileInfo("PRODUCT/apps/Chats.apk", None)
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+
+ (is_apk, is_compressed) = GetApkFileInfo("PRODUCT/apps/Chats.dat", None)
+ self.assertFalse(is_apk)
+ self.assertFalse(is_compressed)
+
+ def test_GetApkFileInfo_withCompressedApks(self):
+ (is_apk, is_compressed) = GetApkFileInfo("PRODUCT/apps/Chats.apk.gz", ".gz")
+ self.assertTrue(is_apk)
+ self.assertTrue(is_compressed)
+
+ (is_apk, is_compressed) = GetApkFileInfo("PRODUCT/apps/Chats.apk.gz", ".xz")
+ self.assertFalse(is_apk)
+ self.assertFalse(is_compressed)
+
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "PRODUCT/apps/Chats.apk", "")
+
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "PRODUCT/apps/Chats.apk", "apk")
diff --git a/tools/warn.py b/tools/warn.py
index eb6c164..89f4778 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -499,18 +499,23 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Use parameter comments to document ambiguous literals',
+ 'patterns': [r".*: warning: \[BooleanParameter\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Field name is CONSTANT_CASE, but field is not static and final',
+ 'patterns': [r".*: warning: \[ConstantField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
- 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
- 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ 'Java: This field is only assigned during initialization; consider making it final',
+ 'patterns': [r".*: warning: \[FieldCanBeFinal\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
@@ -519,41 +524,11 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
- 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Methods that can return null should be annotated @Nullable',
- 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Use parameter comments to document ambiguous literals',
- 'patterns': [r".*: warning: \[BooleanParameter\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Field name is CONSTANT CASE, but field is not static and final',
- 'patterns': [r".*: warning: \[ConstantField\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Deprecated item is not annotated with @Deprecated',
- 'patterns': [r".*: warning: \[DepAnn\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
+ r'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
'patterns': [r".*: warning: \[LambdaFunctionalInterface\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
- 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
'Java: A private method that does not reference the enclosing instance can be static',
'patterns': [r".*: warning: \[MethodCanBeStatic\] .+"]},
{'category': 'java',
@@ -589,6 +564,16 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
+ 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
+ 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]},
{'category': 'java',
@@ -599,6 +584,16 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Methods that can return null should be annotated @Nullable',
+ 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Scopes on modules have no function and will soon be an error.',
+ 'patterns': [r".*: warning: \[ScopeOnModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: The default case of a switch should appear at the end of the last statement group',
'patterns': [r".*: warning: \[SwitchDefault\] .+"]},
{'category': 'java',
@@ -629,78 +624,18 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
+ 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: Wildcard imports, static or otherwise, should not be used',
'patterns': [r".*: warning: \[WildcardImport\] .+"]},
{'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: ',
- 'patterns': [r".*: warning: \[RemoveFieldPrefixes\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Prefer assertThrows to ExpectedException',
- 'patterns': [r".*: warning: \[ExpectedExceptionMigration\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Logger instances are not constants -- they are mutable and have side effects -- and should not be named using CONSTANT CASE',
- 'patterns': [r".*: warning: \[LoggerVariableCase\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Prefer assertThrows to @Test(expected=...)',
- 'patterns': [r".*: warning: \[TestExceptionMigration\] .+"]},
- {'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Public fields must be final.',
- 'patterns': [r".*: warning: \[NonFinalPublicFields\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Private fields that are only assigned in the initializer should be made final.',
- 'patterns': [r".*: warning: \[PrivateFieldsNotAssigned\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Lists returned by methods should be immutable.',
- 'patterns': [r".*: warning: \[ReturnedListNotImmutable\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Parameters to log methods should not be generated by a call to String.format() or MessageFormat.format().',
- 'patterns': [r".*: warning: \[SaferLoggerFormat\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Parameters to log methods should not be generated by a call to toString(); see b/22986665.',
- 'patterns': [r".*: warning: \[SaferLoggerToString\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
- 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
- 'patterns': [r".*: warning: \[FragmentInjection\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
- 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Hardcoded reference to /sdcard',
- 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
- 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]},
+ 'Java: Method reference is ambiguous',
+ 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -714,81 +649,26 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: An equality test between objects with incompatible types always returns false',
- 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
- 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
- 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.',
- 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: This code declares a binding for a common value type without a Qualifier annotation.',
- 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
- 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
- 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Double-checked locking on non-volatile fields is unsafe',
- 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Annotations should always be immutable',
- 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Enums should always be immutable',
- 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Writes to static fields should not be guarded by instance locks',
- 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
- 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Method reference is ambiguous',
- 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
'patterns': [r".*: warning: \[AssertFalse\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: The lambda passed to assertThows should contain exactly one statement',
+ 'patterns': [r".*: warning: \[AssertThrowsMultipleStatements\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.',
'patterns': [r".*: warning: \[AssertionFailureIgnored\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
{'category': 'java',
@@ -804,11 +684,26 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
+ 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: This code declares a binding for a common value type without a Qualifier annotation.',
+ 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: valueOf or autoboxing provides better time and space performance',
'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
+ 'patterns': [r".*: warning: \[ByteBufferBackingArray\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Mockito cannot mock final classes',
'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
{'category': 'java',
@@ -869,11 +764,21 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Implicit use of the platform default charset, which can result in differing behavior between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
+ 'Java: Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Prefer collection factory methods or builders to the double-brace initialization pattern.',
+ 'patterns': [r".*: warning: \[DoubleBraceInitialization\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Double-checked locking on non-volatile fields is unsafe',
+ 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Empty top-level type declaration',
'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
{'category': 'java',
@@ -884,6 +789,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: An equality test between objects with incompatible types always returns false',
+ 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Calls to ExpectedException#expect should always be followed by exactly one statement.',
'patterns': [r".*: warning: \[ExpectedExceptionChecker\] .+"]},
{'category': 'java',
@@ -909,6 +819,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
+ 'patterns': [r".*: warning: \[FragmentInjection\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
+ 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Overloads will be ambiguous when passing lambda arguments',
'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
{'category': 'java',
@@ -924,21 +844,51 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Hardcoded reference to /sdcard',
+ 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Hiding fields of superclasses may cause confusion and errors',
'patterns': [r".*: warning: \[HidingField\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Annotations should always be immutable',
+ 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Enums should always be immutable',
+ 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: It is confusing to have a field and a parameter under the same scope that differ only in capitalization.',
+ 'patterns': [r".*: warning: \[InconsistentCapitalization\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
+ 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This for loop increments the same variable in the header and in the body',
'patterns': [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
+ 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
{'category': 'java',
@@ -1069,6 +1019,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Calling toString on Objects that don\'t override toString() doesn\'t provide useful information',
+ 'patterns': [r".*: warning: \[ObjectToString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Use grouping parenthesis to make the operator precedence explicit',
'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
{'category': 'java',
@@ -1094,6 +1049,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
+ 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter',
'patterns': [r".*: warning: \[ParameterName\] .+"]},
{'category': 'java',
@@ -1119,6 +1079,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
+ 'patterns': [r".*: warning: \[QualifierOrScopeOnInjectMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.',
+ 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: reachabilityFence should always be called inside a finally block',
'patterns': [r".*: warning: \[ReachabilityFenceUsage\] .+"]},
{'category': 'java',
@@ -1139,11 +1109,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
+ r'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
'patterns': [r".*: warning: \[ShortCircuitBoolean\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Writes to static fields should not be guarded by instance locks',
+ 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: A static variable or method should be qualified with a class name, not expression',
'patterns': [r".*: warning: \[StaticQualifiedUsingExpression\] .+"]},
{'category': 'java',
@@ -1159,13 +1134,13 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: String.split should never take only a single argument; it has surprising behavior',
- 'patterns': [r".*: warning: \[StringSplit\] .+"]},
+ 'Java: String.split(String) has surprising behavior',
+ 'patterns': [r".*: warning: \[StringSplitter\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Prefer Splitter to String.split',
- 'patterns': [r".*: warning: \[StringSplitter\] .+"]},
+ 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
+ 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -1194,6 +1169,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Argument is not compatible with the subject\'s type.',
+ 'patterns': [r".*: warning: \[TruthIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Type parameter declaration overrides another type parameter already declared',
'patterns': [r".*: warning: \[TypeParameterShadowing\] .+"]},
{'category': 'java',
@@ -1204,7 +1184,7 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Creation of a Set/HashSet/HashMap of java.net.URL. equals() and hashCode() of java.net.URL class make blocking internet connections.',
+ 'Java: Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
'patterns': [r".*: warning: \[URLEqualsHashCode\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
@@ -1239,208 +1219,13 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Pluggable Type checker internal error',
- 'patterns': [r".*: warning: \[PluggableTypeChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Invalid message format-style format specifier ({0}), expected printf-style (%s)',
- 'patterns': [r".*: warning: \[FloggerMessageFormat\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Logger level check is already implied in the log() call. An explicit at[Level]().isEnabled() check is redundant.',
- 'patterns': [r".*: warning: \[FloggerRedundantIsEnabled\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Calling withCause(Throwable) with an inline allocated Throwable is discouraged. Consider using withStackTrace(StackSize) instead, and specifying a reduced stack size (e.g. SMALL, MEDIUM or LARGE) instead of FULL, to improve performance.',
- 'patterns': [r".*: warning: \[FloggerWithCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Use withCause to associate Exceptions with log statements',
- 'patterns': [r".*: warning: \[FloggerWithoutCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: No bug exists to track an ignored test',
- 'patterns': [r".*: warning: \[IgnoredTestWithoutBug\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: @Ignore is preferred to @Suppress for JUnit4 tests. @Suppress may silently fail in JUnit4 (that is, tests may run anyway.)',
- 'patterns': [r".*: warning: \[JUnit4SuppressWithoutIgnore\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Medium and large test classes should document why they are medium or large',
- 'patterns': [r".*: warning: \[JUnit4TestAttributeMissing\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: java.net.IDN implements the older IDNA2003 standard. Prefer com.google.i18n.Idn, which implements the newer UTS #46 standard',
- 'patterns': [r".*: warning: \[JavaNetIdn\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Consider requiring strict parsing on JodaDurationFlag instances. Before adjusting existing flags, check the documentation and your existing configuration to avoid crashes!',
- 'patterns': [r".*: warning: \[JodaDurationFlagStrictParsing\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Logging an exception and throwing it (or a new exception) for the same exceptional situation is an anti-pattern.',
- 'patterns': [r".*: warning: \[LogAndThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: FormattingLogger uses wrong or mismatched format string',
- 'patterns': [r".*: warning: \[MisusedFormattingLogger\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Flags should be final',
- 'patterns': [r".*: warning: \[NonFinalFlag\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Reading a flag from a static field or initializer block will cause it to always receive the default value and will cause an IllegalFlagStateException if the flag is ever set.',
- 'patterns': [r".*: warning: \[StaticFlagUsage\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Apps must use BuildCompat.isAtLeastO to check whether they\'re running on Android O',
- 'patterns': [r".*: warning: \[UnsafeSdkVersionCheck\] .+"]},
+ 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
+ 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Logging tag cannot be longer than 23 characters.',
- 'patterns': [r".*: warning: \[LogTagLength\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Relative class name passed to ComponentName constructor',
- 'patterns': [r".*: warning: \[RelativeComponentName\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Explicitly enumerate all cases in switch statements for certain enum types.',
- 'patterns': [r".*: warning: \[EnumerateAllCasesInEnumSwitch\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Do not call assumeTrue(tester.getExperimentValueFor(...)). Use @RequireEndToEndTestExperiment instead.',
- 'patterns': [r".*: warning: \[JUnitAssumeExperiment\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: The accessed field or method is not visible here. Note that the default production visibility for @VisibleForTesting is Visibility.PRIVATE.',
- 'patterns': [r".*: warning: \[VisibleForTestingChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Detects errors encountered building Error Prone plugins',
- 'patterns': [r".*: warning: \[ErrorPronePluginCorrectness\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Parcelable CREATOR fields should be Creator\u003cT>',
- 'patterns': [r".*: warning: \[ParcelableCreatorType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Enforce reflected Parcelables are kept by Proguard',
- 'patterns': [r".*: warning: \[ReflectedParcelable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Any class that extends IntentService should have @Nullable notation on method onHandleIntent(@Nullable Intent intent) and handle the case if intent is null.',
- 'patterns': [r".*: warning: \[OnHandleIntentNullableChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: In many cases, randomUUID is not necessary, and it slows the performance, which can be quite severe especially when this operation happens at start up time. Consider replacing it with cheaper alternatives, like object.hashCode() or IdGenerator.INSTANCE.getRandomId()',
- 'patterns': [r".*: warning: \[UUIDChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: DynamicActivity.findViewById(int) is slow and should not be used inside View.onDraw(Canvas)!',
- 'patterns': [r".*: warning: \[NoFindViewByIdInOnDrawChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Passing Throwable/Exception argument to the message format L.x(). Calling L.w(tag, message, ex) instead of L.w(tag, ex, message)',
- 'patterns': [r".*: warning: \[WrongThrowableArgumentInLogChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: New splicers are disallowed on paths that are being Libsearched',
- 'patterns': [r".*: warning: \[BlacklistedSplicerPathChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Object serialized in Bundle may have been flattened to base type.',
- 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Log tag too long, cannot exceed 23 characters.',
- 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Certain resources in `android.R.string` have names that do not match their content',
- 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Return value of android.graphics.Rect.intersect() must be checked',
- 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Incompatible type as argument to Object-accepting Java collections method',
- 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @CompatibleWith\'s value is not a type argument.',
- 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Passing argument to a generic method with an incompatible type.',
- 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid printf-style format string',
- 'patterns': [r".*: warning: \[FormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid format string passed to formatting method.',
- 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
- 'patterns': [r".*: warning: \[GuardedBy\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Type declaration annotated with @Immutable is not immutable',
- 'patterns': [r".*: warning: \[Immutable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
- 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
- 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+ 'Java: AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
+ 'patterns': [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -1469,6 +1254,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
{'category': 'java',
@@ -1479,11 +1269,26 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @AutoFactory and @Inject should not be used in the same type.',
+ 'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Arguments to AutoValue constructor are in the wrong order',
+ 'patterns': [r".*: warning: \[AutoValueConstructorOrderChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Shift by an amount that is out of range',
'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Object serialized in Bundle may have been flattened to base type.',
+ 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
{'category': 'java',
@@ -1499,7 +1304,12 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
+ 'Java: Incompatible type as argument to Object-accepting Java collections method',
+ 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ r'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
'patterns': [r".*: warning: \[ComparableType\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1514,6 +1324,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @CompatibleWith\'s value is not a type argument.',
+ 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
{'category': 'java',
@@ -1534,6 +1349,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
+ 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Exception created but not thrown',
'patterns': [r".*: warning: \[DeadException\] .+"]},
{'category': 'java',
@@ -1544,6 +1364,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Deprecated item is not annotated with @Deprecated',
+ 'patterns': [r".*: warning: \[DepAnn\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Division by integer literal zero',
'patterns': [r".*: warning: \[DivZero\] .+"]},
{'category': 'java',
@@ -1574,6 +1399,16 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Invalid printf-style format string',
+ 'patterns': [r".*: warning: \[FormatString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Invalid format string passed to formatting method.',
+ 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.',
'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]},
{'category': 'java',
@@ -1599,6 +1434,26 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
+ 'patterns': [r".*: warning: \[GuardedBy\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
+ 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
+ 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
+ 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: contains() is a legacy method that is equivalent to containsValue()',
'patterns': [r".*: warning: \[HashtableContains\] .+"]},
{'category': 'java',
@@ -1609,11 +1464,21 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Type declaration annotated with @Immutable is not immutable',
+ 'patterns': [r".*: warning: \[Immutable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
'patterns': [r".*: warning: \[ImmutableModification\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Passing argument to a generic method with an incompatible type.',
+ 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The first argument to indexOf is a Unicode code point, and the second is the index to start the search from',
'patterns': [r".*: warning: \[IndexOfChar\] .+"]},
{'category': 'java',
@@ -1629,6 +1494,36 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
+ 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Using more than one qualifier annotation on the same element is not allowed.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A class can be annotated with at most one scope annotation.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on an interface or abstact class is not allowed',
+ 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scoping and qualifier annotations must have runtime retention.',
+ 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Injected constructors cannot be optional nor have binding annotations',
+ 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
{'category': 'java',
@@ -1649,7 +1544,12 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
+ 'Java: Log tag too long, cannot exceed 23 characters.',
+ 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ r'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
'patterns': [r".*: warning: \[IterablePathParameter\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1679,7 +1579,7 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: This looks like a test method but is not run; please add @Test or @Ignore, or, if this is a helper method, reduce its visibility.',
+ 'Java: This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.',
'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1689,16 +1589,41 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Abstract and default methods are not injectable with javax.inject.Inject',
+ 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: @javax.inject.Inject cannot be put on a final field.',
+ 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly',
'patterns': [r".*: warning: \[LiteByteStringUtf8\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
+ 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
+ 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Loop condition is never modified in loop body.',
'patterns': [r".*: warning: \[LoopConditionChecker\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Certain resources in `android.R.string` have names that do not match their content',
+ 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Overriding method is missing a call to overridden super method',
'patterns': [r".*: warning: \[MissingSuperCall\] .+"]},
{'category': 'java',
@@ -1724,6 +1649,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
+ 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The result of this method must be closed.',
'patterns': [r".*: warning: \[MustBeClosedChecker\] .+"]},
{'category': 'java',
@@ -1769,11 +1699,31 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
+ 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.',
+ 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Declaring types inside package-info.java files is very bad form',
'patterns': [r".*: warning: \[PackageInfo\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Method parameter has wrong package',
+ 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Detects classes which implement Parcelable but don\'t have CREATOR',
+ 'patterns': [r".*: warning: \[ParcelableCreator\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
{'category': 'java',
@@ -1809,6 +1759,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @Provides methods need to be declared in a Module to have any effect.',
+ 'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.',
'patterns': [r".*: warning: \[RandomCast\] .+"]},
{'category': 'java',
@@ -1819,6 +1774,16 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Return value of android.graphics.Rect.intersect() must be checked',
+ 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Use of method or class annotated with @RestrictTo',
+ 'patterns': [r".*: warning: \[RestrictTo\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Check for non-whitelisted callers to RestrictedApiChecker.',
'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
{'category': 'java',
@@ -1854,6 +1819,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Static and default interface methods are not natively supported on older Android devices. ',
+ 'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Calling toString on a Stream does not provide useful information',
'patterns': [r".*: warning: \[StreamToString\] .+"]},
{'category': 'java',
@@ -1894,6 +1864,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
+ 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Non-generic methods should not be invoked with type arguments',
'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
{'category': 'java',
@@ -1911,191 +1886,6 @@
'description':
'Java: `var` should not be used as a type name.',
'patterns': [r".*: warning: \[VarTypeName\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Method parameter has wrong package',
- 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Type declaration annotated with @ThreadSafe is not thread safe',
- 'patterns': [r".*: warning: \[ThreadSafe\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of class, field, or method that is not compatible with legacy Android devices',
- 'patterns': [r".*: warning: \[AndroidApiChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid use of Flogger format string',
- 'patterns': [r".*: warning: \[AndroidFloggerFormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use TunnelException.getCauseAs(Class) instead of casting the result of TunnelException.getCause().',
- 'patterns': [r".*: warning: \[DoNotCastTunnelExceptionCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Identifies undesirable mocks.',
- 'patterns': [r".*: warning: \[DoNotMock_ForJavaBuilder\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Duration Flag should NOT have units in the variable name or the @FlagSpec\'s name or altName field.',
- 'patterns': [r".*: warning: \[DurationFlagWithUnits\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Duration.get() only works with SECONDS or NANOS.',
- 'patterns': [r".*: warning: \[DurationGetTemporalUnit\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid printf-style format string',
- 'patterns': [r".*: warning: \[FloggerFormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Test class may not be run because it is missing a @RunWith annotation',
- 'patterns': [r".*: warning: \[JUnit4RunWithMissing\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of class, field, or method that is not compatible with JDK 7',
- 'patterns': [r".*: warning: \[Java7ApiChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of java.time.Duration.withNanos(int) is not allowed.',
- 'patterns': [r".*: warning: \[JavaDurationWithNanos\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of java.time.Duration.withSeconds(long) is not allowed.',
- 'patterns': [r".*: warning: \[JavaDurationWithSeconds\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: java.time APIs that silently use the default system time-zone are not allowed.',
- 'patterns': [r".*: warning: \[JavaTimeDefaultTimeZone\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of new Duration(long) is not allowed. Please use Duration.millis(long) instead.',
- 'patterns': [r".*: warning: \[JodaDurationConstructor\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of duration.withMillis(long) is not allowed. Please use Duration.millis(long) instead.',
- 'patterns': [r".*: warning: \[JodaDurationWithMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of instant.withMillis(long) is not allowed. Please use new Instant(long) instead.',
- 'patterns': [r".*: warning: \[JodaInstantWithMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of JodaTime\'s type.plus(long) or type.minus(long) is not allowed (where \u003ctype> = {Duration,Instant,DateTime,DateMidnight}). Please use type.plus(Duration.millis(long)) or type.minus(Duration.millis(long)) instead.',
- 'patterns': [r".*: warning: \[JodaPlusMinusLong\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Changing JodaTime\'s current time is not allowed in non-testonly code.',
- 'patterns': [r".*: warning: \[JodaSetCurrentMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of Joda-Time\'s DateTime.toDateTime(), Duration.toDuration(), Instant.toInstant(), Interval.toInterval(), and Period.toPeriod() are not allowed.',
- 'patterns': [r".*: warning: \[JodaToSelf\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of JodaTime\'s type.withDurationAdded(long, int) (where \u003ctype> = {Duration,Instant,DateTime}). Please use type.withDurationAdded(Duration.millis(long), int) instead.',
- 'patterns': [r".*: warning: \[JodaWithDurationAddedLong\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: LanguageCode comparison using reference equality instead of value equality',
- 'patterns': [r".*: warning: \[LanguageCodeEquality\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: The zero argument toString is not part of the Localizable interface and likely is just the java Object toString. You probably want to call toString(Locale).',
- 'patterns': [r".*: warning: \[LocalizableWrongToString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Period.get() only works with YEARS, MONTHS, or DAYS.',
- 'patterns': [r".*: warning: \[PeriodGetTemporalUnit\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Return value of methods returning Promise must be checked. Ignoring returned Promises suppresses exceptions thrown from the code that completes the Promises.',
- 'patterns': [r".*: warning: \[PromiseReturnValueIgnored\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: When returning a Promise, use thenChain() instead of then()',
- 'patterns': [r".*: warning: \[PromiseThenReturningPromise\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Streams.iterating() is unsafe for use except in the header of a for-each loop; please see its Javadoc for details.',
- 'patterns': [r".*: warning: \[StreamsIteratingNotInLoop\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: TemporalAccessor.get() only works for certain values of ChronoField.',
- 'patterns': [r".*: warning: \[TemporalAccessorGetChronoField\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Try-with-resources is not supported in this code, use try/finally instead',
- 'patterns': [r".*: warning: \[TryWithResources\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Adds checkOrThrow calls where needed',
- 'patterns': [r".*: warning: \[AddCheckOrThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Equality on Nano protos (== or .equals) might not be the same in Lite',
- 'patterns': [r".*: warning: \[ForbidNanoEquality\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Submessages of a proto cannot be mutated',
- 'patterns': [r".*: warning: \[ForbidSubmessageMutation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Repeated fields on proto messages cannot be directly referenced',
- 'patterns': [r".*: warning: \[NanoUnsafeRepeatedFieldUsage\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Requires that non-@enum int assignments to @enum ints is wrapped in a checkOrThrow',
- 'patterns': [r".*: warning: \[RequireCheckOrThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Assignments into repeated field elements must be sequential',
- 'patterns': [r".*: warning: \[RequireSequentialRepeatedFields\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Future.get in Google Now Producers code',
- 'patterns': [r".*: warning: \[FutureGetInNowProducers\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @SimpleEnum applied to non-enum type',
- 'patterns': [r".*: warning: \[SimpleEnumUsage\] .+"]},
# End warnings generated by Error Prone
@@ -3033,6 +2823,7 @@
def classify_one_warning(line, results):
+ """Classify one warning line."""
for i in range(len(warn_patterns)):
w = warn_patterns[i]
for cpat in w['compiled_patterns']: