From 0649c8d5b3d73d8f4f3c5283707518bf60cc86da Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Mon, 22 Jan 2018 22:23:13 +0000 Subject: [PATCH] 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 --- Android.mk | 22 ++++++++++++++++++++++ config/hiddenapi-blacklist.txt | 0 config/hiddenapi-dark-greylist.txt | 0 3 files changed, 22 insertions(+) create mode 100644 config/hiddenapi-blacklist.txt create mode 100644 config/hiddenapi-dark-greylist.txt diff --git a/Android.mk b/Android.mk index 5dfa81c581a24..0e7c087c939c6 100644 --- a/Android.mk +++ b/Android.mk @@ -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 # ============================================================ diff --git a/config/hiddenapi-blacklist.txt b/config/hiddenapi-blacklist.txt new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/config/hiddenapi-dark-greylist.txt b/config/hiddenapi-dark-greylist.txt new file mode 100644 index 0000000000000..e69de29bb2d1d