summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2018-08-22 17:43:24 +0100
committerDavid Brazdil <dbrazdil@google.com>2018-08-23 10:35:05 +0100
commit9b1068cc52a8b55d45aae395cd5e309d5bc6fff8 (patch)
tree58d8968167b654f3f210842e73698884507e36c6
parentc9b01b87b11d4caa33a29db18287416b25179ef7 (diff)
Support whitelist entries from class2greylist
Whitelist used to be the same as all entries in API stubs. This is no longer true as libcore will generate hidden bridge methods which are supposed to be whitelisted. CL in build/make calls class2greylist on each boot classpath module to dump their list and this patch creates a build rule for the new whitelist. Bug: 112186571 Test: m appcompat, diff public-list.txt whitelist.txt Change-Id: I7b3957ea9ed8bebb483609d94b1e6f169f4379dd
-rw-r--r--Android.mk24
1 files changed, 18 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk
index 29454e4ae304..84b708e53cdb 100644
--- a/Android.mk
+++ b/Android.mk
@@ -325,6 +325,7 @@ $(OUT_DOCS)/offline-sdk-timestamp: $(OUT_DOCS)/offline-sdk-docs-docs.zip
include $(CLEAR_VARS)
# File names of final API lists
+LOCAL_WHITELIST := $(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST)
LOCAL_LIGHT_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST)
LOCAL_DARK_GREYLIST := $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST)
LOCAL_BLACKLIST := $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
@@ -374,6 +375,13 @@ endef
# or have alternative rules for building them. Other rules in the build system
# should depend on the files in the build folder.
+# Merge whitelist from:
+# (1) public API stubs
+# (2) whitelist entries generated by class2greylist (PRIVATE_WHITELIST_INPUTS)
+$(LOCAL_WHITELIST): $(LOCAL_SRC_PUBLIC_API)
+ sort $(LOCAL_SRC_PUBLIC_API) $(PRIVATE_WHITELIST_INPUTS) > $@
+ $(call assert-has-no-duplicates,$@)
+
# Merge light greylist from multiple files:
# (1) manual greylist LOCAL_SRC_GREYLIST
# (2) list of usages from vendor apps LOCAL_SRC_VENDOR_LIST
@@ -384,6 +392,7 @@ endef
# Automatically adds all methods which match the signatures in
# REGEX_SERIALIZATION. These are greylisted in order to allow applications
# to write their own serializers.
+# (5) greylist entries generated by class2greylist (PRIVATE_GREYLIST_INPUTS)
$(LOCAL_LIGHT_GREYLIST): REGEX_SERIALIZATION := \
"readObject\(Ljava/io/ObjectInputStream;\)V" \
"readObjectNoData\(\)V" \
@@ -392,7 +401,7 @@ $(LOCAL_LIGHT_GREYLIST): REGEX_SERIALIZATION := \
"serialPersistentFields:\[Ljava/io/ObjectStreamField;" \
"writeObject\(Ljava/io/ObjectOutputStream;\)V" \
"writeReplace\(\)Ljava/lang/Object;"
-$(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL)
+$(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL) $(LOCAL_WHITELIST)
sort $(LOCAL_SRC_GREYLIST) $(LOCAL_SRC_VENDOR_LIST) $(PRIVATE_GREYLIST_INPUTS) \
<(grep -E "\->("$(subst $(space),"|",$(REGEX_SERIALIZATION))")$$" \
$(LOCAL_SRC_PRIVATE_API)) \
@@ -400,6 +409,7 @@ $(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL)
> $@
$(call assert-has-no-duplicates,$@)
$(call assert-is-subset,$@,$(LOCAL_SRC_PRIVATE_API))
+ $(call assert-has-no-overlap,$@,$(LOCAL_WHITELIST))
$(call assert-has-no-overlap,$@,$(LOCAL_SRC_FORCE_BLACKLIST))
# Generate dark greylist as remaining classes and class members in the same
@@ -412,9 +422,9 @@ $(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL)
# name but do not contain another forward-slash in the class name, e.g.
# matching '^Lpackage/subpackage/[^/;]*;'
# (4) subtract entries shared with LOCAL_LIGHT_GREYLIST
-$(LOCAL_DARK_GREYLIST): $(LOCAL_SRC_ALL) $(LOCAL_LIGHT_GREYLIST)
- comm -13 <(sort $(LOCAL_LIGHT_GREYLIST) $(LOCAL_SRC_FORCE_BLACKLIST)) \
- <(cat $(LOCAL_SRC_PUBLIC_API) $(LOCAL_LIGHT_GREYLIST) | \
+$(LOCAL_DARK_GREYLIST): $(LOCAL_SRC_ALL) $(LOCAL_WHITELIST) $(LOCAL_LIGHT_GREYLIST)
+ comm -13 <(sort $(LOCAL_WHITELIST) $(LOCAL_LIGHT_GREYLIST) $(LOCAL_SRC_FORCE_BLACKLIST)) \
+ <(cat $(LOCAL_WHITELIST) $(LOCAL_LIGHT_GREYLIST) | \
sed 's/\->.*//' | sed 's/\(.*\/\).*/\1/' | sort | uniq | \
while read PKG_NAME; do \
grep -E "^$${PKG_NAME}[^/;]*;" $(LOCAL_SRC_PRIVATE_API); \
@@ -422,16 +432,18 @@ $(LOCAL_DARK_GREYLIST): $(LOCAL_SRC_ALL) $(LOCAL_LIGHT_GREYLIST)
> $@
$(call assert-is-subset,$@,$(LOCAL_SRC_PRIVATE_API))
$(call assert-has-no-duplicates,$@)
+ $(call assert-has-no-overlap,$@,$(LOCAL_WHITELIST))
$(call assert-has-no-overlap,$@,$(LOCAL_LIGHT_GREYLIST))
$(call assert-has-no-overlap,$@,$(LOCAL_SRC_FORCE_BLACKLIST))
# Generate blacklist as private API minus (light greylist plus dark greylist).
-$(LOCAL_BLACKLIST): $(LOCAL_SRC_ALL) $(LOCAL_LIGHT_GREYLIST) $(LOCAL_DARK_GREYLIST)
- comm -13 <(sort $(LOCAL_LIGHT_GREYLIST) $(LOCAL_DARK_GREYLIST)) \
+$(LOCAL_BLACKLIST): $(LOCAL_SRC_ALL) $(LOCAL_WHITELIST) $(LOCAL_LIGHT_GREYLIST) $(LOCAL_DARK_GREYLIST)
+ comm -13 <(sort $(LOCAL_WHITELIST) $(LOCAL_LIGHT_GREYLIST) $(LOCAL_DARK_GREYLIST)) \
<(sort $(LOCAL_SRC_PRIVATE_API)) \
> $@
$(call assert-is-subset,$@,$(LOCAL_SRC_PRIVATE_API))
$(call assert-has-no-duplicates,$@)
+ $(call assert-has-no-overlap,$@,$(LOCAL_WHITELIST))
$(call assert-has-no-overlap,$@,$(LOCAL_LIGHT_GREYLIST))
$(call assert-has-no-overlap,$@,$(LOCAL_DARK_GREYLIST))
$(call assert-is-subset,$(LOCAL_SRC_FORCE_BLACKLIST),$@)