Support hidden API whitelist generated by class2greylist
Libcore has support for annotating a virtual method which is known to change its return type in a future release. This annotation is recognized by the dexer and a future-proof bridge method is created. This patch integrates changes in class2greylist to support this annotation into the build system and generation of hidden API lists. Calling class2greylist on each boot classpath module now produces two text files instead of one: signatures for greylisting and now also whitelisting. They are passed on to the hidden API list generating rules in frameworks/base. Bug: 112186571 Test: m appcompat, diff public-list.txt whitelist.txt Change-Id: I9861203e6e07a17d50850892ec13880971457d11
This commit is contained in:
@@ -1116,6 +1116,7 @@ endif
|
||||
|
||||
INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-public-list.txt
|
||||
INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-private-list.txt
|
||||
INTERNAL_PLATFORM_HIDDENAPI_WHITELIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-whitelist.txt
|
||||
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt
|
||||
INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt
|
||||
INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt
|
||||
|
@@ -2877,12 +2877,18 @@ endef
|
||||
define hiddenapi-generate-greylist-txt
|
||||
ifneq (,$(wildcard frameworks/base))
|
||||
# Only generate this target if we're in a tree with frameworks/base present.
|
||||
$(2): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
|
||||
$(CLASS2GREYLIST) --public-api-list $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) $(1) > $(2)
|
||||
$(3): .KATI_IMPLICIT_OUTPUTS := $(2)
|
||||
$(3): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
|
||||
$(CLASS2GREYLIST) --public-api-list $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) $(1) \
|
||||
--write-whitelist $(2) --write-greylist $(3)
|
||||
|
||||
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): $(2)
|
||||
$(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST): $(2)
|
||||
$(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST): \
|
||||
PRIVATE_WHITELIST_INPUTS := $$(PRIVATE_WHITELIST_INPUTS) $(2)
|
||||
|
||||
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): $(3)
|
||||
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): \
|
||||
PRIVATE_GREYLIST_INPUTS := $$(PRIVATE_GREYLIST_INPUTS) $(2)
|
||||
PRIVATE_GREYLIST_INPUTS := $$(PRIVATE_GREYLIST_INPUTS) $(3)
|
||||
endif
|
||||
endef
|
||||
|
||||
|
@@ -74,8 +74,8 @@ built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
|
||||
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
|
||||
|
||||
hiddenapi_whitelist_txt := $(intermediates.COMMON)/hiddenapi/whitelist.txt
|
||||
hiddenapi_greylist_txt := $(intermediates.COMMON)/hiddenapi/greylist.txt
|
||||
|
||||
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
|
||||
# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
|
||||
@@ -502,8 +502,8 @@ ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
|
||||
# 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_pre_proguard_jar),$(greylist_txt)))
|
||||
LOCAL_INTERMEDIATE_TARGETS += $(greylist_txt)
|
||||
$(eval $(call hiddenapi-generate-greylist-txt, $(full_classes_pre_proguard_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt)))
|
||||
LOCAL_INTERMEDIATE_TARGETS += $(hiddenapi_whitelist_txt) $(hiddenapi_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
|
||||
|
@@ -19,7 +19,8 @@ full_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
|
||||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
|
||||
greylist_txt := $(intermediates.COMMON)/greylist.txt
|
||||
hiddenapi_whitelist_txt := $(intermediates.COMMON)/hiddenapi/whitelist.txt
|
||||
hiddenapi_greylist_txt := $(intermediates.COMMON)/hiddenapi/greylist.txt
|
||||
|
||||
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar)))
|
||||
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_pre_proguard_jar)))
|
||||
@@ -77,7 +78,7 @@ ifdef LOCAL_SOONG_DEX_JAR
|
||||
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
|
||||
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
|
||||
# java.mk.
|
||||
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(greylist_txt)))
|
||||
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt)))
|
||||
$(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
||||
else # !is_boot_jar
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
||||
|
Reference in New Issue
Block a user