Create hidden API lists

Android is beginning to put restrictions on the usage of private APIs.
In order to facilitate a transitionary period, some APIs will remain
accessible but issue a warning (greylist), other will see restrictions
right away (blacklist).

This patch create two new text files which will be used to store manual
lists of dex signatures of hidden APIs. These are the blacklist and
dark greylist. They should be mutually exclusive and both be subsets of
INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE. The last list, light greylist,
is generated as INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE minus the two
manual lists.

Bug: 64382372
Test: m
Change-Id: Ia694ef79bece819c87db853ccaea5e95f38d3e84
This commit is contained in:
David Brazdil
2018-01-22 22:23:13 +00:00
parent 2a8c24be18
commit 0649c8d5b3
3 changed files with 22 additions and 0 deletions

View File

@@ -697,6 +697,28 @@ LOCAL_SRC_FILES := \
include $(BUILD_HOST_JAVA_LIBRARY)
# ==== hiddenapi lists =======================================
# Generate light greylist as private API minus (blacklist plus dark greylist).
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): PRIVATE_API := $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE)
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): BLACKLIST := $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): DARK_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST)
$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \
$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) \
$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST)
if [ ! -z "`comm -12 <(sort $(BLACKLIST)) <(sort $(DARK_GREYLIST))`" ]; then \
echo "There should be no overlap between $(BLACKLIST) and $(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 $(DARK_GREYLIST))`" ]; then \
echo "$(DARK_GREYLIST) must be a subset of $(PRIVATE_API)" 1>&2; \
exit 3; \
fi
comm -23 <(sort $(PRIVATE_API)) <(sort $(BLACKLIST) $(DARK_GREYLIST)) > $@
# Include subdirectory makefiles
# ============================================================

View File

View File