From 36bbf124b89f48ff61804de1094033f79ef1f1e7 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Wed, 28 Mar 2018 11:28:39 +0100 Subject: [PATCH] Revert Revert: Enable hidden API blacklist APIs which have not been explicitly greylisted have so far been put on the dark greylist. This patch changes the default to blacklist and therefore enables strict enforcement. This reverts commit f712b23d56226c788f7892a984fb9abe6f5144c2. Bug: 64382372 Test: make Change-Id: I1608b1adbe5dcafd13335691ddeb94abbb2c6e71 --- Android.mk | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Android.mk b/Android.mk index b630c3f3aa8e4..e219661b19f1d 100644 --- a/Android.mk +++ b/Android.mk @@ -861,14 +861,11 @@ include $(BUILD_STATIC_JAVA_LIBRARY) # ==== hiddenapi lists ======================================= -# Copy blacklist and light greylist over into the build folder. +# Copy light and dark greylist over into the build folder. # This is for ART buildbots which need to mock these lists and have alternative # rules for building them. Other rules in the build system should depend on the # files in the build folder. -$(eval $(call copy-one-file,frameworks/base/config/hiddenapi-blacklist.txt,\ - $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST))) - # Automatically add all methods which match the following signatures. # These need to be greylisted in order to allow applications to write their # own serializers. @@ -891,25 +888,31 @@ $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): frameworks/base/config/hiddenapi- <(grep -E "\->("$(subst $(space),"|",$(REGEX_SERIALIZATION))")$$" $(PRIVATE_API)) \ > $@ +$(eval $(call copy-one-file,frameworks/base/config/hiddenapi-dark-greylist.txt,\ + $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST))) + # Generate dark greylist as private API minus (blacklist plus light greylist). -$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST): PRIVATE_API := $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) -$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST): BLACKLIST := $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) -$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST): LIGHT_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) -$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST): $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \ - $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) \ - $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) - if [ ! -z "`comm -12 <(sort $(BLACKLIST)) <(sort $(LIGHT_GREYLIST))`" ]; then \ - echo "There should be no overlap between $(BLACKLIST) and $(LIGHT_GREYLIST)" 1>&2; \ +$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST): PRIVATE_API := $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) +$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST): LIGHT_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) +$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST): DARK_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) +$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST): $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \ + $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \ + $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) + if [ ! -z "`comm -12 <(sort $(LIGHT_GREYLIST)) <(sort $(DARK_GREYLIST))`" ]; then \ + echo "There should be no overlap between $(LIGHT_GREYLIST) and $(DARK_GREYLIST)" 1>&2; \ + comm -12 <(sort $(LIGHT_GREYLIST)) <(sort $(DARK_GREYLIST)) 1>&2; \ exit 1; \ - elif [ ! -z "`comm -13 <(sort $(PRIVATE_API)) <(sort $(BLACKLIST))`" ]; then \ - echo "$(BLACKLIST) must be a subset of $(PRIVATE_API)" 1>&2; \ - exit 2; \ elif [ ! -z "`comm -13 <(sort $(PRIVATE_API)) <(sort $(LIGHT_GREYLIST))`" ]; then \ echo "$(LIGHT_GREYLIST) must be a subset of $(PRIVATE_API)" 1>&2; \ + comm -13 <(sort $(PRIVATE_API)) <(sort $(LIGHT_GREYLIST)) 1>&2; \ + exit 2; \ + elif [ ! -z "`comm -13 <(sort $(PRIVATE_API)) <(sort $(DARK_GREYLIST))`" ]; then \ + echo "$(DARK_GREYLIST) must be a subset of $(PRIVATE_API)" 1>&2; \ + comm -13 <(sort $(PRIVATE_API)) <(sort $(DARK_GREYLIST)) 1>&2; \ exit 3; \ fi - comm -23 <(sort $(PRIVATE_API)) <(sort $(BLACKLIST) $(LIGHT_GREYLIST)) > $@ + comm -23 <(sort $(PRIVATE_API)) <(sort $(LIGHT_GREYLIST) $(DARK_GREYLIST)) > $@ # Include subdirectory makefiles # ============================================================