Build rules to derive greylists from annotations.
Uses the new class2greylist tool to extract API descriptors from .class
files.
Also add these generated greylist.txt files as dependencies of
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST so they can be merged later in
the build.
Bug: 110868826
Test: m
Change-Id: I406587732b537f9b56768ad9909039dfab34c334
diff --git a/core/java.mk b/core/java.mk
index 78b492d..a8b680d 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -79,6 +79,7 @@
built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
java_source_list_file := $(intermediates.COMMON)/java-source-list
+greylist_txt := $(intermediates.COMMON)/greylist.txt
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
@@ -544,6 +545,13 @@
endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
+ # Derive API greylist from the classes jar.
+ # We use full_classes_proguard_jar here, as that is what is converted to dex
+ # later on. The difference is academic currently, as we don't proguard any
+ # bootclasspath code at the moment. If we were to do that, we should add keep
+ # rules for all members with the @UnsupportedAppUsage annotation.
+ $(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_proguard_jar),$(greylist_txt)))
+ LOCAL_INTERMEDIATE_TARGETS += $(greylist_txt)
$(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
built_dex_copy_from := $(built_dex_hiddenapi)
else # !is_boot_jar